public boolean aptEnabledInEditor() { return aptOptions.annotationProcessingEnabled().contains(AnnotationProcessingQuery.Trigger.IN_EDITOR); }
private Collection<Processor> lookupProcessors(ClassLoader cl, boolean onScan) { Iterable<? extends String> processorNames = aptOptions.annotationProcessorsToRun(); if (processorNames == null) { processorNames = getProcessorNames(cl); } List<Processor> result = new LinkedList<Processor>(); for (String name : processorNames) { try { Class<?> clazz = Class.forName(name, true, cl); Object instance = clazz.newInstance(); if (instance instanceof Processor) { result.add((Processor) instance); } } catch (ThreadDeath td) { throw td; } catch (Throwable t) { LOG.log(Level.FINE, null, t); } } if (!onScan) result.addAll(HARDCODED_PROCESSORS.lookupAll(Processor.class)); return result; }
if (srURL.equals(AnnotationProcessingQuery.getAnnotationProcessingOptions(sr).sourceOutputDirectory())) { continue;
boolean apEnabledOnScan = aptOptions.annotationProcessingEnabled().contains(AnnotationProcessingQuery.Trigger.ON_SCAN); if (JavaIndex.ensureAttributeValue(url, APT_ENABLED, apEnabledOnScan ? Boolean.TRUE.toString() : null, checkOnly)) { JavaIndex.LOG.fine("forcing reindex due to change in annotation processing options"); //NOI18N if (JavaIndex.ensureAttributeValue(url, ANNOTATION_PROCESSORS, encodeToStirng(aptOptions.annotationProcessorsToRun()), checkOnly)) { JavaIndex.LOG.fine("forcing reindex due to change in annotation processors"); //NOI18N vote = true;
@NonNull static Set<? extends URL> getAptBuildGeneratedFolders(@NonNull final List<ClassPath.Entry> entries) { final Set<URL> roots = new HashSet<>(); for (ClassPath.Entry entry : entries) { roots.add(entry.getURL()); } for (ClassPath.Entry entry : entries) { final FileObject fo = entry.getRoot(); if (fo != null) { URL aptRoot; final APTUtils aptUtils = APTUtils.getIfExist(fo); if (aptUtils != null) { aptRoot = aptUtils.sourceOutputDirectory(); } else { aptRoot = AnnotationProcessingQuery.getAnnotationProcessingOptions(fo).sourceOutputDirectory(); } if (roots.contains(aptRoot)) { return Collections.singleton(aptRoot); } } } return Collections.<URL>emptySet(); }
/** * Resolves the APT sources cache root * Depends on the JavaIndex rather than on AptCacheForSourceQuery due to performance reasons */ private static FileObject[] resolveAptSourceCache(final FileObject sourceRoot) { try { final AnnotationProcessingQuery.Result result = AnnotationProcessingQuery.getAnnotationProcessingOptions(sourceRoot); final URL annotationOutputURL = result.sourceOutputDirectory(); final FileObject userAnnotationOutput = annotationOutputURL == null ? null : URLMapper.findFileObject(annotationOutputURL); final FileObject cacheAnnoationOutput = FileUtil.toFileObject(JavaIndex.getAptFolder(sourceRoot.getURL(), false)); return userAnnotationOutput == null ? cacheAnnoationOutput == null ? new FileObject[0] : new FileObject[] {cacheAnnoationOutput} : cacheAnnoationOutput == null ? new FileObject[] {userAnnotationOutput} : new FileObject[] {userAnnotationOutput, cacheAnnoationOutput}; } catch (IOException ex) { Exceptions.printStackTrace(ex); return null; } } }
public Map<? extends String, ? extends String> processorOptions() { return aptOptions.processorOptions(); }
public boolean aptEnabledOnScan() { return aptOptions.annotationProcessingEnabled().contains(AnnotationProcessingQuery.Trigger.ON_SCAN); }
@CheckForNull public URL sourceOutputDirectory() { return aptOptions.sourceOutputDirectory(); }
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; }
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 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; }