public Map<? extends String, ? extends String> processorOptions() { return aptOptions.processorOptions(); }
private static void sources(File targetFolder, FileObject[][] sources) throws MalformedURLException { if (sources[0] == null) { URL targetFolderURL = FileUtil.urlForArchiveOrDir(targetFolder); sources[0] = SourceForBinaryQuery.findSourceRoots(targetFolderURL).getRoots(); } }
private static boolean hasSourceCache(@NonNull final URL root) { return SourceForBinaryQuery.findSourceRoots2(root).preferSources(); }
/** * Is source level of a given project 1.7 or higher? * * @param project Project * @return true if source level is 1.7 or higher; otherwise false */ private static boolean isSourceLevel17orHigher(Project project) { String srcLevel = SourceLevelQuery.getSourceLevel(project.getProjectDirectory()); if (srcLevel != null) { double sourceLevel = Double.parseDouble(srcLevel); return (sourceLevel >= 1.7); } else return false; }
private void listen() { listenOnProcessorPath(processorPath.get(), this); aptOptions.addChangeListener(WeakListeners.change(this, aptOptions)); if (sourceLevel.supportsChanges()) sourceLevel.addChangeListener(WeakListeners.change(this, sourceLevel)); }
@CheckForNull private static URL getAPTSourceOutputDirectory(@NonNull final FileObject sourceRoot) { final APTUtils au = APTUtils.getIfExist(sourceRoot); return au != null ? au.sourceOutputDirectory(): AnnotationProcessingQuery.getAnnotationProcessingOptions(sourceRoot).sourceOutputDirectory(); } }
private SourceLevelQuery.Result initSourceLevel() { if (!sourceLevelInitialized) { sourceLevel = rootNotNeeded ? null : SourceLevelQuery.getSourceLevel2(ctx.getRoot()); sourceLevelInitialized = true; } return sourceLevel; }
@CheckForNull SourceLevelQuery.Profile getProfile() { final SourceLevelQuery.Result sl = initSourceLevel(); return sl == null ? null : sl.getProfile(); }
@CheckForNull static Profile max (@NullAllowed Profile a, @NullAllowed Profile b) { if (b == null) { return a; } if (a == null) { return b; } return a.compareTo(b) <= 0 ? b : a; }
@Override public void run() { accessibility = Accessibility.fromQuery(AccessibilityQuery.isPubliclyAccessible(folder)); fireIconChange(); } });
public boolean aptEnabledOnScan() { return aptOptions.annotationProcessingEnabled().contains(AnnotationProcessingQuery.Trigger.ON_SCAN); }
@CheckForNull public URL sourceOutputDirectory() { return aptOptions.sourceOutputDirectory(); }
@CheckForNull String getSourceLevel() { final SourceLevelQuery.Result sl = initSourceLevel(); return sl == null ? null : sl.getSourceLevel(); }
private static FileObject getFileFromClasspath(ClassPath cp, String classRelativePath) { for (ClassPath.Entry entry : cp.entries()) { FileObject roots[]; if (entry.isValid()) { roots = new FileObject[]{entry.getRoot()}; } else { SourceForBinaryQuery.Result res = SourceForBinaryQuery.findSourceRoots(entry.getURL()); roots = res.getRoots(); } for (FileObject root : roots) { FileObject metaInf = root.getFileObject(classRelativePath); if (metaInf != null) { return metaInf; } } } return null; }
/** * Says whether the project source level is of 1.7 or above. * @param target target project folder * @return {@code true} if the project which contains the folder uses java source 1.7 and above */ private static Boolean isJava17orLater(FileObject target) { if (target == null) { return Boolean.FALSE; } String sourceLevel = SourceLevelQuery.getSourceLevel(target); if (sourceLevel != null) { Version currentVersion = Version.fromDottedNotationWithFallback(sourceLevel); return currentVersion.isAboveOrEqual(JAVA_VERSION_17); } return Boolean.FALSE; }
private static boolean isAptBuildGeneratedFolder(@NonNull final FileObject root) { final ClassPath scp = ClassPath.getClassPath(root, ClassPath.SOURCE); if (scp != null) { for (FileObject srcRoot : scp.getRoots()) { if (root.toURL().equals( AnnotationProcessingQuery.getAnnotationProcessingOptions(srcRoot).sourceOutputDirectory())) { return true; } } } return false; }
@Override public Accessibility call() throws Exception { return Accessibility.fromQuery(AccessibilityQuery.isPubliclyAccessible(pkg)); } });
public boolean aptEnabledInEditor() { return aptOptions.annotationProcessingEnabled().contains(AnnotationProcessingQuery.Trigger.IN_EDITOR); }
private static boolean isAptBuildGeneratedFolder( @NonNull final URL root, @NonNull final ClassPath srcPath) { Parameters.notNull("root", root); //NOI18N Parameters.notNull("srcPath", srcPath); //NOI18N for (FileObject srcRoot : srcPath.getRoots()) { if (root.equals(AnnotationProcessingQuery.getAnnotationProcessingOptions(srcRoot).sourceOutputDirectory())) { return true; } } return false; }