Top Description Inners Fields Constructors Methods
com.sun.tools.javac.processing

public Class JavacProcessingEnvironment

extends Object
implements ProcessingEnvironment, Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable, javax.annotation.processing.ProcessingEnvironment
Imports
java.io.Closeable, .IOException, .PrintWriter, .StringWriter, java.lang.reflect.Method, java.net.MalformedURLException, .URL, java.nio.file.Path, java.util.*, .Map.Entry, java.util.function.Predicate, java.util.regex.*, javax.annotation.processing.*, javax.lang.model.SourceVersion, javax.lang.model.element.*, javax.lang.model.util.*, javax.tools.JavaFileManager, .JavaFileObject, .JavaFileObject.Kind, com.sun.source.util.TaskEvent, com.sun.tools.javac.api.MultiTaskListener, com.sun.tools.javac.code.*, .DeferredCompletionFailureHandler.Handler, .Scope.WriteableScope, .Source.Feature, com.sun.tools.javac.code.Symbol.*, .Type.ClassType, .Types, com.sun.tools.javac.comp.AttrContext, .Check, .Enter, .Env, .Modules, .Annotate, com.sun.tools.javac.file.JavacFileManager, com.sun.tools.javac.main.JavaCompiler, .Option, com.sun.tools.javac.model.JavacElements, .JavacTypes, com.sun.tools.javac.platform.PlatformDescription, .PlatformDescription.PluginInfo, com.sun.tools.javac.resources.CompilerProperties.Errors, .CompilerProperties.Warnings, com.sun.tools.javac.tree.*, com.sun.tools.javac.tree.JCTree.*, com.sun.tools.javac.util.Abort, .Assert, .ClientCodeException, .Context, .Convert, .DefinedBy, .DefinedBy.Api, .Iterators, .JCDiagnostic, .JCDiagnostic.DiagnosticFlag, .JavacMessages, .List, .Log, .MatchingUtils, .ModuleHelper, .Name, .Names, .Options

Objects of this class hold and manage the state needed to support annotation processing.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
JavacProcessingEnvironment.ComputeAnnotationSet

Computes the set of annotations on the symbol in question.

pack-priv class
JavacProcessingEnvironment.DiscoveredProcessors

This class holds information about the processors that have been discovered so far as well as the means to discover more, if necessary.

pack-priv class
private static class
private class
pack-priv static class
JavacProcessingEnvironment.ProcessorState

State about how a processor has been used by the tool.

pack-priv class
JavacProcessingEnvironment.Round

Helper object for a single round of annotation processing.

private class
JavacProcessingEnvironment.ServiceIterator

Use a service loader appropriate for the platform to provide an iterator over annotations processors; fails if a loader is needed but unavailable.

Field Summary

Modifier and TypeField and Description
private final Annotate
private final Check
private final JavaCompiler
private final Context
private final DeferredCompletionFailureHandler
pack-priv JCDiagnostic.Factory
diags

Diagnostic factory.

private JavacProcessingEnvironment.DiscoveredProcessors
discoveredProcs

Holds relevant state history of which processors have been used.

private final JavacElements
private final Enter
private final boolean
private final JavaFileManager
private final JavacFiler
private final Symbol.Completer
private final boolean
pack-priv final Log
log

The log to be used for error reporting.

private final JavacMessager
private JavacMessages
messages

JavacMessages object used for localization

private final Modules
private final Names
public static final Pattern
private final Options
private final Set<String>
platformAnnotations

Annotations implicitly processed and claimed by javac.

private final Preview
preview

Support for preview language features.

private final boolean
private final boolean
private ClassLoader
private SecurityException
private final Map<String, String>
processorOptions

Map of processor-specific options.

private ServiceLoader<Processor>
private final boolean
pack-priv Source
source

Source level of the compile.

private Set<Symbol.PackageSymbol>
specifiedPackages

Set of packages given on command line.

private final Symtab
private MultiTaskListener
private final TreeScanner
private final Types
private final JavacTypes
private final Set<String>
private final boolean
private final boolean

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public boolean
private boolean
public void
close()

Implements java.io.Closeable.close.

Free resources related to annotation processing.
private void
discoverAndRunProcs(Set<TypeElement> annotationsPresent, List<Symbol.ClassSymbol> topLevelClasses, List<Symbol.PackageSymbol> packageInfoFiles, List<Symbol.ModuleSymbol> moduleInfoFiles)

public boolean
doProcessing(List<JCTree.JCCompilationUnit> roots, List<Symbol.ClassSymbol> classSymbols, Iterable<? extends Symbol.PackageSymbol> pckSymbols, Log.DeferredDiagnosticHandler deferredDiagnosticHandler)

public Context
getContext()

For internal use only.

public JavacElements
getElementUtils()

Implements javax.annotation.processing.ProcessingEnvironment.getElementUtils.

Returns an implementation of some utility methods for operating on elements.
public JavacFiler
getFiler()

Implements javax.annotation.processing.ProcessingEnvironment.getFiler.

Returns the filer used to create new source, class, or auxiliary files.
public Locale
getLocale()

Implements javax.annotation.processing.ProcessingEnvironment.getLocale.

Returns the current locale or null if no locale is in effect.
public Messager
getMessager()

Implements javax.annotation.processing.ProcessingEnvironment.getMessager.

Returns the messager used to report errors, warnings, and other notices.
private List<Symbol.ModuleSymbol>
public Map<String, String>
getOptions()

Implements javax.annotation.processing.ProcessingEnvironment.getOptions.

Returns the processor-specific options passed to the annotation processing tool.
private List<Symbol.PackageSymbol>
private List<Symbol.PackageSymbol>
public ClassLoader
getProcessorClassLoader()

For internal use only.

public <S> ServiceLoader<S>
getServiceLoader(Class<S> service)

public SourceVersion
getSourceVersion()

Implements javax.annotation.processing.ProcessingEnvironment.getSourceVersion.

Returns the source version that any generated source and class files should conform to.
public Set<Symbol.PackageSymbol>
private List<Symbol.ClassSymbol>
private List<Symbol.ClassSymbol>
public JavacTypes
getTypeUtils()

Implements javax.annotation.processing.ProcessingEnvironment.getTypeUtils.

Returns an implementation of some utility methods for operating on types.
private void
handleException(String key, Exception e)

Handle a security exception thrown during initializing the Processor iterator.

private Iterator<Processor>
handleServiceLoaderUnavailability(String
The resource key to use to log an error message
key
,
Exception
If non-null, pass this exception to Abort
e
)

Returns an empty processor iterator if no processors are on the relevant path, otherwise if processors are present, logs an error.

private static Pattern
importStringToPattern(boolean allowModules, String s, Processor p, Log log, boolean lint)

Convert import-style string for supported annotations into a regex matching that string.

private Set<String>
private void
initProcessorIterator(Iterable<? extends Processor> processors)

private void
private Map<String, String>
private Set<String>
public static JavacProcessingEnvironment
instance(Context context)

Get the JavacProcessingEnvironment instance for this context.

private boolean
private boolean
private boolean
public boolean
isPreviewEnabled()

Overrides default javax.annotation.processing.ProcessingEnvironment.isPreviewEnabled.

Returns true if preview features are enabled and false otherwise.
public static boolean
private static <T> List<T>
join(List<T> list1, List<T> list2)

private boolean
private boolean
needClassLoader(String procNames, Iterable<? extends Path> workingpath)

public void
setProcessors(Iterable<? extends Processor> processors)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
private static Pattern
warnAndNoMatches(String s, Processor p, Log log, boolean lint)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait