public class ClassReader extends Object
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.
Modifier and Type | Class and Description |
---|---|
protected static class |
ClassReader.AttributeKind
Reading Attributes
|
protected class |
ClassReader.AttributeReader |
class |
ClassReader.BadClassFile
Error Diagnoses
|
static interface |
ClassReader.SourceCompleter |
Modifier and Type | Field and Description |
---|---|
protected Map<Name,ClassReader.AttributeReader> |
attributeReaders |
protected int |
bp
The current input pointer.
|
protected Set<ClassReader.AttributeKind> |
CLASS_ATTRIBUTE |
protected Set<ClassReader.AttributeKind> |
CLASS_OR_MEMBER_ATTRIBUTE |
protected static Context.Key<ClassReader> |
classReaderKey
The context key for the class reader.
|
protected JavaFileObject |
currentClassFile
The path name of the class file currently being read.
|
protected JavaFileManager.Location |
currentLoc |
protected Symbol |
currentOwner
The class or method currently being read.
|
static int |
INITIAL_BUFFER_SIZE |
protected Set<ClassReader.AttributeKind> |
MEMBER_ATTRIBUTE |
boolean |
preferSource
Switch: prefer source files instead of newer when both source
and class are available
|
Profile |
profile
The currently selected profile.
|
boolean |
readAllOfClassFile
Switch: read constant pool and code sections.
|
boolean |
saveParameterNames
Switch: preserve parameter names from the variable table.
|
ClassReader.SourceCompleter |
sourceCompleter
Can be reassigned from outside:
the completer to be used for ".java" files.
|
protected Scope |
typevars
The current scope where type variables are entered.
|
Modifier | Constructor and Description |
---|---|
protected |
ClassReader(Context context,
boolean definitive)
Construct a new class reader, optionally treated as the
definitive classreader for this invocation.
|
Modifier and Type | Method and Description |
---|---|
ClassReader.BadClassFile |
badClassFile(String key,
Object... args) |
Symbol.ClassSymbol |
defineClass(Name name,
Symbol owner)
Define a new class given its name and owner.
|
Symbol.ClassSymbol |
enterClass(Name flatname)
Create a new member or toplevel class symbol with given flat name
and enter in `classes' unless already there.
|
Symbol.ClassSymbol |
enterClass(Name flatName,
JavaFileObject classFile)
Creates a new toplevel class symbol with given flat name and
given class (or source) file.
|
Symbol.ClassSymbol |
enterClass(Name name,
Symbol.TypeSymbol owner)
Create a new toplevel or member class symbol with given name
and owner and enter in `classes' unless already there.
|
Symbol.PackageSymbol |
enterPackage(Name fullname)
Make a package, given its fully qualified name.
|
Symbol.PackageSymbol |
enterPackage(Name name,
Symbol.PackageSymbol owner)
Make a package, given its unqualified name and enclosing package.
|
protected void |
enterTypevars(Symbol sym) |
protected void |
enterTypevars(Type t)
Enter type variables of this classtype and all enclosing ones in
`typevars'.
|
protected void |
extraFileActions(Symbol.PackageSymbol pack,
JavaFileObject fe)
this is used to support javadoc
|
protected EnumSet<JavaFileObject.Kind> |
getPackageFileKinds()
specifies types of files to be read when filling in a package symbol
|
protected void |
includeClassFile(Symbol.PackageSymbol p,
JavaFileObject file)
Include class corresponding to given class file in package,
unless (1) we already have one the same kind (.class or .java), or
(2) we have one of the other kind, and the given class file
is older.
|
void |
init(Symtab syms)
Initialize classes and packages, treating this as the definitive classreader.
|
static ClassReader |
instance(Context context)
Get the ClassReader instance for this invocation.
|
Symbol.ClassSymbol |
loadClass(Name flatname)
Load a toplevel class with given fully qualified name
The class is entered into `classes' only if load was successful.
|
boolean |
packageExists(Name fullname)
Check to see if a package exists, given its fully qualified name.
|
protected JavaFileObject |
preferredFileObject(JavaFileObject a,
JavaFileObject b)
Implement policy to choose to derive information from a source
file or a class file when both are present.
|
protected void |
readEnclosingMethodAttr(Symbol sym) |
protected static final Context.Key<ClassReader> classReaderKey
public static final int INITIAL_BUFFER_SIZE
public boolean readAllOfClassFile
public boolean saveParameterNames
public boolean preferSource
public final Profile profile
public ClassReader.SourceCompleter sourceCompleter
protected Scope typevars
protected JavaFileObject currentClassFile
protected Symbol currentOwner
protected int bp
protected Set<ClassReader.AttributeKind> CLASS_ATTRIBUTE
protected Set<ClassReader.AttributeKind> MEMBER_ATTRIBUTE
protected Set<ClassReader.AttributeKind> CLASS_OR_MEMBER_ATTRIBUTE
protected Map<Name,ClassReader.AttributeReader> attributeReaders
protected JavaFileManager.Location currentLoc
protected ClassReader(Context context, boolean definitive)
public static ClassReader instance(Context context)
public void init(Symtab syms)
public ClassReader.BadClassFile badClassFile(String key, Object... args)
protected void readEnclosingMethodAttr(Symbol sym)
protected void enterTypevars(Type t)
protected void enterTypevars(Symbol sym)
public Symbol.ClassSymbol defineClass(Name name, Symbol owner)
public Symbol.ClassSymbol enterClass(Name name, Symbol.TypeSymbol owner)
public Symbol.ClassSymbol enterClass(Name flatName, JavaFileObject classFile)
flatName
- a fully qualified binary class nameclassFile
- the class file or compilation unit defining
the class (may be null
)AssertionError
- if the class symbol already existspublic Symbol.ClassSymbol enterClass(Name flatname)
public Symbol.ClassSymbol loadClass(Name flatname) throws Symbol.CompletionFailure
Symbol.CompletionFailure
public boolean packageExists(Name fullname)
public Symbol.PackageSymbol enterPackage(Name fullname)
public Symbol.PackageSymbol enterPackage(Name name, Symbol.PackageSymbol owner)
protected void includeClassFile(Symbol.PackageSymbol p, JavaFileObject file)
protected JavaFileObject preferredFileObject(JavaFileObject a, JavaFileObject b)
protected EnumSet<JavaFileObject.Kind> getPackageFileKinds()
protected void extraFileActions(Symbol.PackageSymbol pack, JavaFileObject fe)
Copyright © 2017 earcam. All rights reserved.