|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tools.javac.tree.JCTree.Visitor
com.sun.tools.javac.tree.TreeTranslator
com.sun.tools.javac.comp.Lower
public class Lower
This pass translates away some syntactic sugar: inner classes, class literals, assertions, foreach loops, etc.
This is NOT part of any API supported by Sun Microsystems. 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 Class Summary | |
|---|---|
(package private) class |
Lower.ClassMap
A navigator class for assembling a mapping from local class symbols to class definition trees. |
(package private) class |
Lower.EnumMapping
This map gives a translation table to be used for enum switches. |
(package private) class |
Lower.FreeVarCollector
A navigator class for collecting the free variables accessed from a local class. |
(package private) static interface |
Lower.TreeBuilder
Building blocks for let expressions |
| Field Summary | |
|---|---|
private java.util.Map<Symbol,Symbol.MethodSymbol> |
accessConstrs
A mapping from (constructor) symbols to access constructor symbols. |
private ListBuffer<Symbol> |
accessed
A queue for all accessed symbols. |
private java.util.Map<Symbol,java.lang.Integer> |
accessNums
A mapping from symbols to their access numbers. |
private java.util.Map<Symbol,Symbol.MethodSymbol[]> |
accessSyms
A mapping from symbols to an array of access symbols, indexed by access code. |
(package private) java.util.Map<Symbol,Symbol> |
actualSymbols
A hash table mapping virtual accessed symbols in outer subclasses to the actually referred symbol in superclasses. |
private boolean |
allowEnums
|
private static int |
ASSIGNcode
Access codes for dereferencing, assignment, and pre/post increment/decrement. |
private Attr |
attr
|
(package private) Env<AttrContext> |
attrEnv
Environment for symbol lookup, set by translateTopLevelClass. |
private ConstFold |
cfolder
|
private Check |
chk
|
(package private) java.util.Map<Symbol.ClassSymbol,JCTree.JCClassDecl> |
classdefs
A hash table mapping local classes to their definitions. |
private Name |
classDollar
|
(package private) Lower.ClassMap |
classMap
|
(package private) Symbol.ClassSymbol |
currentClass
The currently enclosing class. |
(package private) JCTree.JCMethodDecl |
currentMethodDef
The current method definition. |
(package private) Symbol.MethodSymbol |
currentMethodSym
The current method symbol. |
private boolean |
debugLower
|
private static int |
DEREFcode
Access codes for dereferencing, assignment, and pre/post increment/decrement. |
private Name |
dollarAssertionsDisabled
|
private JCTree.JCExpression |
enclOp
Visitor argument: enclosing operator node. |
(package private) java.util.Map<JCTree,java.lang.Integer> |
endPositions
A hash table mapping syntax trees to their ending source positions. |
(package private) java.util.Map<Symbol.TypeSymbol,Lower.EnumMapping> |
enumSwitchMap
|
private static int |
FIRSTASGOPcode
Access codes for dereferencing, assignment, and pre/post increment/decrement. |
(package private) java.util.Map<Symbol.ClassSymbol,List<Symbol.VarSymbol>> |
freevarCache
A hash table mapping class symbols to lists of free variables. |
private Log |
log
|
protected static Context.Key<Lower> |
lowerKey
|
private TreeMaker |
make
|
private JCDiagnostic.DiagnosticPosition |
make_pos
|
private Names |
names
|
private static int |
NCODES
Number of access codes |
(package private) JCTree.JCClassDecl |
outermostClassDef
The currently enclosing outermost class definition. |
(package private) JCTree |
outermostMemberDef
The currently enclosing outermost member definition. |
(package private) List<Symbol.VarSymbol> |
outerThisStack
A stack containing the this$n field of the currently translated classes (if needed) in innermost first order. |
private static int |
POSTDECcode
Access codes for dereferencing, assignment, and pre/post increment/decrement. |
private static int |
POSTINCcode
Access codes for dereferencing, assignment, and pre/post increment/decrement. |
private static int |
PREDECcode
Access codes for dereferencing, assignment, and pre/post increment/decrement. |
private static int |
PREINCcode
Access codes for dereferencing, assignment, and pre/post increment/decrement. |
(package private) Scope |
proxies
A scope containing all free variable proxies for currently translated class, as well as its this$n symbol (if needed). |
private ClassReader |
reader
|
private Resolve |
rs
|
private Source |
source
|
private Symtab |
syms
|
private Symbol.MethodSymbol |
systemArraycopyMethod
|
private Target |
target
|
(package private) ListBuffer<JCTree> |
translated
A queue of all translated classes. |
private Types |
types
|
private ClassWriter |
writer
|
| Fields inherited from class com.sun.tools.javac.tree.TreeTranslator |
|---|
result |
| Constructor Summary | |
|---|---|
protected |
Lower(Context context)
|
| Method Summary | ||
|---|---|---|
(package private) JCTree |
abstractLval(JCTree lval,
Lower.TreeBuilder builder)
|
|
(package private) JCTree |
abstractRval(JCTree rval,
Lower.TreeBuilder builder)
|
|
(package private) JCTree |
abstractRval(JCTree rval,
Type type,
Lower.TreeBuilder builder)
Construct an expression using the builder, with the given rval expression as an argument to the builder. |
|
(package private) JCTree.JCExpression |
access(JCTree.JCExpression tree)
Ensure that identifier is accessible, return tree accessing the identifier. |
|
(package private) JCTree.JCExpression |
access(Symbol sym,
JCTree.JCExpression tree,
JCTree.JCExpression enclOp,
boolean refSuper)
Ensure that identifier is accessible, return tree accessing the identifier. |
|
(package private) JCTree.JCExpression |
accessBase(JCDiagnostic.DiagnosticPosition pos,
Symbol sym)
The qualifier to be used for accessing a symbol in an outer class. |
|
(package private) Symbol.ClassSymbol |
accessClass(Symbol sym,
boolean protAccess,
JCTree tree)
The class in which an access method for given symbol goes. |
|
private static int |
accessCode(int bytecode)
Map bytecode of binary operation to access code of corresponding assignment operation. |
|
private static int |
accessCode(JCTree tree,
JCTree enclOp)
return access code for identifier, |
|
(package private) Symbol |
accessConstructor(JCDiagnostic.DiagnosticPosition pos,
Symbol constr)
Return access constructor for a private constructor, or the constructor itself, if no access constructor is needed. |
|
(package private) JCTree |
accessConstructorDef(int pos,
Symbol constr,
Symbol.MethodSymbol accessor)
Construct definition of an access constructor. |
|
(package private) Symbol.ClassSymbol |
accessConstructorTag()
Return an anonymous class nested in this toplevel class. |
|
(package private) JCTree |
accessDef(int pos,
Symbol vsym,
Symbol.MethodSymbol accessor,
int acode)
Construct definition of an access method. |
|
(package private) Name |
accessName(int anum,
int acode)
The name of the access method with number `anum' and access code `acode'. |
|
(package private) Symbol.MethodSymbol |
accessSymbol(Symbol sym,
JCTree tree,
JCTree enclOp,
boolean protAccess,
boolean refSuper)
Return access symbol for a private or protected symbol from an inner class. |
|
private Symbol.MethodSymbol |
addEnumCompareTo(JCTree.JCClassDecl cdef,
Symbol.VarSymbol ordinalSymbol)
|
|
private void |
addEnumCompatibleMembers(JCTree.JCClassDecl cdef)
|
|
private Symbol.MethodSymbol |
addEnumFieldNameMethod(JCTree.JCClassDecl cdef,
Symbol.VarSymbol nameSymbol)
|
|
private Symbol.MethodSymbol |
addEnumFieldOrdinalMethod(JCTree.JCClassDecl cdef,
Symbol.VarSymbol ordinalSymbol)
|
|
private Symbol.VarSymbol |
addEnumNameField(JCTree.JCClassDecl cdef)
|
|
private Symbol.VarSymbol |
addEnumOrdinalField(JCTree.JCClassDecl cdef)
|
|
private Symbol.MethodSymbol |
addEnumToString(JCTree.JCClassDecl cdef,
Symbol.VarSymbol nameSymbol)
|
|
private JCTree.JCExpression |
assertFlagTest(JCDiagnostic.DiagnosticPosition pos)
Code for enabling/disabling assertions. |
|
private Symbol.OperatorSymbol |
binaryAccessOperator(int acode)
Return binary operator that corresponds to given access code. |
|
(package private) List<JCTree.JCExpression> |
boxArgs(List<Type> parameters,
List<JCTree.JCExpression> _args,
Type varargsElement)
|
|
(package private)
|
boxIfNeeded(T tree,
Type type)
Expand a boxing or unboxing conversion if needed. |
|
(package private) JCTree.JCExpression |
boxPrimitive(JCTree.JCExpression tree)
Box up a single primitive expression. |
|
(package private) JCTree.JCExpression |
boxPrimitive(JCTree.JCExpression tree,
Type box)
Box up a single primitive expression. |
|
private Name |
cacheName(java.lang.String sig)
The Name Of The variable to cache T.class values. |
|
private Symbol.VarSymbol |
cacheSym(JCDiagnostic.DiagnosticPosition pos,
java.lang.String sig)
The variable symbol that caches T.class values. |
|
(package private) JCTree.JCClassDecl |
classDef(Symbol.ClassSymbol c)
Map a class symbol to its definition. |
|
private Symbol.MethodSymbol |
classDollarSym(JCDiagnostic.DiagnosticPosition pos)
Return symbol for "class$" method. |
|
(package private) JCTree.JCBlock |
classDollarSymBody(JCDiagnostic.DiagnosticPosition pos,
JCTree.JCMethodDecl md)
Generate code for class$(String name). |
|
private JCTree.JCExpression |
classOf(JCTree clazz)
The tree simulating a T.class expression. |
|
private JCTree.JCExpression |
classOfType(Type type,
JCDiagnostic.DiagnosticPosition pos)
|
|
private JCTree |
convert(JCTree tree,
Type pt)
|
|
private void |
duplicateError(JCDiagnostic.DiagnosticPosition pos,
Symbol sym)
Report a conflict between a user symbol and a synthetic symbol. |
|
private void |
enterSynthetic(JCDiagnostic.DiagnosticPosition pos,
Symbol sym,
Scope s)
Enter a synthetic symbol in a given scope, but complain if there was already one there. |
|
(package private) List<JCTree.JCVariableDecl> |
freevarDefs(int pos,
List<Symbol.VarSymbol> freevars,
Symbol owner)
Proxy definitions for all free variables in given list, in reverse order. |
|
(package private) List<Symbol.VarSymbol> |
freevars(Symbol.ClassSymbol c)
Return the variables accessed from within a local class, which are declared in the local class' owner. |
|
(package private) JCTree.JCStatement |
initField(int pos,
Name name)
Return tree simulating the assignment |
|
(package private) JCTree.JCStatement |
initOuterThis(int pos)
Return tree simulating the assignment |
|
static Lower |
instance(Context context)
|
|
(package private) JCTree.JCExpression |
loadFreevar(JCDiagnostic.DiagnosticPosition pos,
Symbol.VarSymbol v)
|
|
(package private) List<JCTree.JCExpression> |
loadFreevars(JCDiagnostic.DiagnosticPosition pos,
List<Symbol.VarSymbol> freevars)
Return a list of trees that load the free variables in given list, in reverse order. |
|
private Symbol.MethodSymbol |
lookupConstructor(JCDiagnostic.DiagnosticPosition pos,
Type qual,
List<Type> args)
Look up a constructor. |
|
private Symbol.VarSymbol |
lookupField(JCDiagnostic.DiagnosticPosition pos,
Type qual,
Name name)
Look up a field. |
|
private Symbol.MethodSymbol |
lookupMethod(JCDiagnostic.DiagnosticPosition pos,
Name name,
Type qual,
List<Type> args)
Look up a method in a given scope. |
|
private Symbol |
lookupSynthetic(Name name,
Scope s)
Look up a synthetic name in a given scope. |
|
(package private) JCTree |
lowerBoxedPostop(JCTree.JCUnary tree)
Lower a tree of the form e++ or e-- where e is an object type |
|
(package private) TreeMaker |
make_at(JCDiagnostic.DiagnosticPosition pos)
Equivalent to make.at(pos.getStartPosition()) with side effect of caching pos as make_pos, for use in diagnostics. |
|
(package private) void |
makeAccessible(Symbol sym)
Add all required access methods for a private symbol to enclosing class. |
|
(package private) JCTree.JCAssignOp |
makeAssignop(int optag,
JCTree lhs,
JCTree rhs)
Make an attributed assignop expression. |
|
(package private) JCTree.JCBinary |
makeBinary(int optag,
JCTree.JCExpression lhs,
JCTree.JCExpression rhs)
Make an attributed binary expression. |
|
private JCTree.JCMethodInvocation |
makeCall(JCTree.JCExpression left,
Name name,
List<JCTree.JCExpression> args)
Create an attributed tree of the form left.name(). |
|
(package private) JCTree |
makeComma(JCTree expr1,
JCTree expr2)
|
|
(package private) Symbol.ClassSymbol |
makeEmptyClass(long flags,
Symbol.ClassSymbol owner)
Create an empty anonymous class definition and enter and complete its symbol. |
|
(package private) JCTree.JCExpression |
makeLit(Type type,
java.lang.Object value)
Make an attributed tree representing a literal. |
|
(package private) JCTree.JCNewClass |
makeNewClass(Type ctype,
List<JCTree.JCExpression> args)
Make an attributed class instance creation expression. |
|
(package private) JCTree.JCExpression |
makeNull()
Make an attributed tree representing null. |
|
(package private) JCTree.JCExpression |
makeOuterThis(JCDiagnostic.DiagnosticPosition pos,
Symbol.TypeSymbol c)
Construct a tree that represents the outer instance |
|
(package private) JCTree.JCExpression |
makeOwnerThis(JCDiagnostic.DiagnosticPosition pos,
Symbol sym,
boolean preciseMatch)
Construct a tree that represents the closest outer instance |
|
(package private) JCTree.JCExpression |
makeOwnerThisN(JCDiagnostic.DiagnosticPosition pos,
Symbol sym,
boolean preciseMatch)
Similar to makeOwnerThis but will never pick "this". |
|
(package private) JCTree.JCExpression |
makeString(JCTree.JCExpression tree)
Convert tree into string object, unless it has already a reference type.. |
|
(package private) JCTree.JCExpression |
makeThis(JCDiagnostic.DiagnosticPosition pos,
Symbol.TypeSymbol c)
Construct a tree simulating the expression |
|
(package private) JCTree.JCUnary |
makeUnary(int optag,
JCTree.JCExpression arg)
Make an attributed unary expression. |
|
(package private) Lower.EnumMapping |
mapForEnum(JCDiagnostic.DiagnosticPosition pos,
Symbol.TypeSymbol enumClass)
|
|
(package private) boolean |
needsPrivateAccess(Symbol sym)
Do we need an access method to reference private symbol? |
|
(package private) boolean |
needsProtectedAccess(Symbol sym,
JCTree tree)
Do we need an access method to reference symbol in other package? |
|
private Symbol.ClassSymbol |
outerCacheClass()
Return the symbol of a class to contain a cache of compiler-generated statics such as class$ and the $assertionsDisabled flag. |
|
(package private) JCTree.JCVariableDecl |
outerThisDef(int pos,
Symbol owner)
Definition for this$n field. |
|
(package private) Name |
outerThisName(Type type,
Symbol owner)
The name of a this$n field |
|
private void |
patchTargets(JCTree body,
JCTree src,
JCTree dest)
Patch up break and continue targets. |
|
(package private) Name |
proxyName(Name name)
The name of a free variable proxy. |
|
|
translate(List<T> trees,
JCTree.JCExpression enclOp)
Visitor method: Translate list of trees. |
|
|
translate(List<T> trees,
Type type)
Visitor method: Translate list of trees. |
|
|
translate(T tree)
Visitor method: Translate a single node. |
|
|
translate(T tree,
JCTree.JCExpression enclOp)
Visitor method: Translate tree. |
|
|
translate(T tree,
Type type)
Visitor method: Translate a single node, boxing or unboxing if needed. |
|
List<JCTree> |
translateTopLevelClass(Env<AttrContext> env,
JCTree cdef,
TreeMaker make)
Translate a toplevel class and return a list consisting of the translated class and translated versions of all inner classes. |
|
private static int |
treeTag(Symbol.OperatorSymbol operator)
Return tree tag for assignment operation corresponding to given binary operator. |
|
(package private) JCTree.JCExpression |
unbox(JCTree.JCExpression tree,
Type primitive)
Unbox an object to a primitive value. |
|
private boolean |
useClone()
|
|
void |
visitAnnotation(JCTree.JCAnnotation tree)
|
|
void |
visitApply(JCTree.JCMethodInvocation tree)
|
|
private void |
visitArrayForeachLoop(JCTree.JCEnhancedForLoop tree)
A statment of the form |
|
void |
visitAssert(JCTree.JCAssert tree)
Visitor method for assert statements. |
|
void |
visitAssign(JCTree.JCAssign tree)
|
|
void |
visitAssignop(JCTree.JCAssignOp tree)
|
|
void |
visitBinary(JCTree.JCBinary tree)
|
|
void |
visitBlock(JCTree.JCBlock tree)
|
|
void |
visitClassDef(JCTree.JCClassDecl tree)
|
|
void |
visitConditional(JCTree.JCConditional tree)
Visitor method for conditional expressions. |
|
void |
visitDoLoop(JCTree.JCDoWhileLoop tree)
|
|
private void |
visitEnumConstantDef(JCTree.JCVariableDecl var,
int ordinal)
Translate an enumeration constant and its initializer. |
|
private void |
visitEnumDef(JCTree.JCClassDecl tree)
Translate an enum class. |
|
JCTree |
visitEnumSwitch(JCTree.JCSwitch tree)
|
|
void |
visitForeachLoop(JCTree.JCEnhancedForLoop tree)
Translate away the foreach loop. |
|
void |
visitForLoop(JCTree.JCForLoop tree)
|
|
void |
visitIdent(JCTree.JCIdent tree)
|
|
void |
visitIf(JCTree.JCIf tree)
Visitor method for if statements. |
|
void |
visitIndexed(JCTree.JCArrayAccess tree)
|
|
private void |
visitIterableForeachLoop(JCTree.JCEnhancedForLoop tree)
A statement of the form |
|
void |
visitLetExpr(JCTree.LetExpr tree)
|
|
void |
visitMethodDef(JCTree.JCMethodDecl tree)
|
|
private void |
visitMethodDefInternal(JCTree.JCMethodDecl tree)
|
|
void |
visitNewArray(JCTree.JCNewArray tree)
|
|
void |
visitNewClass(JCTree.JCNewClass tree)
|
|
void |
visitParens(JCTree.JCParens tree)
Visitor method for parenthesized expressions. |
|
void |
visitReturn(JCTree.JCReturn tree)
|
|
void |
visitSelect(JCTree.JCFieldAccess tree)
|
|
void |
visitSwitch(JCTree.JCSwitch tree)
|
|
void |
visitTopLevel(JCTree.JCCompilationUnit tree)
|
|
void |
visitTypeCast(JCTree.JCTypeCast tree)
|
|
void |
visitUnary(JCTree.JCUnary tree)
|
|
void |
visitVarDef(JCTree.JCVariableDecl tree)
|
|
void |
visitWhileLoop(JCTree.JCWhileLoop tree)
|
|
| Methods inherited from class com.sun.tools.javac.tree.TreeTranslator |
|---|
translate, translateAnnotations, translateCases, translateCatchers, translateTypeParams, translateVarDefs, visitBracketExpr, visitBracketStat, visitBreak, visitCase, visitCatch, visitContinue, visitErroneous, visitExec, visitImport, visitLabelled, visitLiteral, visitModifiers, visitSkip, visitSynchronized, visitThrow, visitTree, visitTry, visitTypeApply, visitTypeArray, visitTypeBoundKind, visitTypeIdent, visitTypeParameter, visitTypeTest, visitWildcard |
| Methods inherited from class com.sun.tools.javac.tree.JCTree.Visitor |
|---|
visitEscapeExpr, visitEscapeStat |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Context.Key<Lower> lowerKey
private Names names
private Log log
private Symtab syms
private Resolve rs
private Check chk
private Attr attr
private TreeMaker make
private JCDiagnostic.DiagnosticPosition make_pos
private ClassWriter writer
private ClassReader reader
private ConstFold cfolder
private Target target
private Source source
private boolean allowEnums
private final Name dollarAssertionsDisabled
private final Name classDollar
private Types types
private boolean debugLower
Symbol.ClassSymbol currentClass
ListBuffer<JCTree> translated
Env<AttrContext> attrEnv
java.util.Map<JCTree,java.lang.Integer> endPositions
java.util.Map<Symbol.ClassSymbol,JCTree.JCClassDecl> classdefs
java.util.Map<Symbol,Symbol> actualSymbols
JCTree.JCMethodDecl currentMethodDef
Symbol.MethodSymbol currentMethodSym
JCTree.JCClassDecl outermostClassDef
JCTree outermostMemberDef
Lower.ClassMap classMap
java.util.Map<Symbol.ClassSymbol,List<Symbol.VarSymbol>> freevarCache
java.util.Map<Symbol.TypeSymbol,Lower.EnumMapping> enumSwitchMap
private static final int DEREFcode
Gen.visitSelect(Select tree),
Constant Field Valuesprivate static final int ASSIGNcode
Gen.visitSelect(Select tree),
Constant Field Valuesprivate static final int PREINCcode
Gen.visitSelect(Select tree),
Constant Field Valuesprivate static final int PREDECcode
Gen.visitSelect(Select tree),
Constant Field Valuesprivate static final int POSTINCcode
Gen.visitSelect(Select tree),
Constant Field Valuesprivate static final int POSTDECcode
Gen.visitSelect(Select tree),
Constant Field Valuesprivate static final int FIRSTASGOPcode
Gen.visitSelect(Select tree),
Constant Field Valuesprivate static final int NCODES
private java.util.Map<Symbol,java.lang.Integer> accessNums
private java.util.Map<Symbol,Symbol.MethodSymbol[]> accessSyms
private java.util.Map<Symbol,Symbol.MethodSymbol> accessConstrs
private ListBuffer<Symbol> accessed
Scope proxies
List<Symbol.VarSymbol> outerThisStack
private JCTree.JCExpression enclOp
private Symbol.MethodSymbol systemArraycopyMethod
| Constructor Detail |
|---|
protected Lower(Context context)
| Method Detail |
|---|
public static Lower instance(Context context)
JCTree.JCClassDecl classDef(Symbol.ClassSymbol c)
c - The class symbol of which we want to determine the definition.List<Symbol.VarSymbol> freevars(Symbol.ClassSymbol c)
Lower.EnumMapping mapForEnum(JCDiagnostic.DiagnosticPosition pos,
Symbol.TypeSymbol enumClass)
TreeMaker make_at(JCDiagnostic.DiagnosticPosition pos)
JCTree.JCExpression makeLit(Type type,
java.lang.Object value)
type - The literal's type.value - The literal's value.JCTree.JCExpression makeNull()
JCTree.JCNewClass makeNewClass(Type ctype,
List<JCTree.JCExpression> args)
ctype - The class type.args - The constructor arguments.
JCTree.JCUnary makeUnary(int optag,
JCTree.JCExpression arg)
optag - The operators tree tag.arg - The operator's argument.
JCTree.JCBinary makeBinary(int optag,
JCTree.JCExpression lhs,
JCTree.JCExpression rhs)
optag - The operators tree tag.lhs - The operator's left argument.rhs - The operator's right argument.
JCTree.JCAssignOp makeAssignop(int optag,
JCTree lhs,
JCTree rhs)
optag - The operators tree tag.lhs - The operator's left argument.rhs - The operator's right argument.JCTree.JCExpression makeString(JCTree.JCExpression tree)
Symbol.ClassSymbol makeEmptyClass(long flags,
Symbol.ClassSymbol owner)
flags - The class symbol's flagsowner - The class symbol's owner
private void duplicateError(JCDiagnostic.DiagnosticPosition pos,
Symbol sym)
private void enterSynthetic(JCDiagnostic.DiagnosticPosition pos,
Symbol sym,
Scope s)
pos - Position for error reporting.sym - The symbol.s - The scope.
private Symbol lookupSynthetic(Name name,
Scope s)
scope - The scope.name - The name.
private Symbol.MethodSymbol lookupMethod(JCDiagnostic.DiagnosticPosition pos,
Name name,
Type qual,
List<Type> args)
private Symbol.MethodSymbol lookupConstructor(JCDiagnostic.DiagnosticPosition pos,
Type qual,
List<Type> args)
private Symbol.VarSymbol lookupField(JCDiagnostic.DiagnosticPosition pos,
Type qual,
Name name)
private static int accessCode(int bytecode)
private static int accessCode(JCTree tree,
JCTree enclOp)
tree - The tree representing the identifier use.enclOp - The closest enclosing operation node of tree,
null if tree is not a subtree of an operation.private Symbol.OperatorSymbol binaryAccessOperator(int acode)
private static int treeTag(Symbol.OperatorSymbol operator)
Name accessName(int anum,
int acode)
Symbol.MethodSymbol accessSymbol(Symbol sym,
JCTree tree,
JCTree enclOp,
boolean protAccess,
boolean refSuper)
sym - The accessed private symbol.tree - The accessing tree.enclOp - The closest enclosing operation node of tree,
null if tree is not a subtree of an operation.protAccess - Is access to a protected symbol in another
package?refSuper - Is access via a (qualified) C.super?
JCTree.JCExpression accessBase(JCDiagnostic.DiagnosticPosition pos,
Symbol sym)
sym - The accessed symbol.boolean needsPrivateAccess(Symbol sym)
boolean needsProtectedAccess(Symbol sym,
JCTree tree)
Symbol.ClassSymbol accessClass(Symbol sym,
boolean protAccess,
JCTree tree)
sym - The access symbolprotAccess - Is access to a protected symbol in another
package?
JCTree.JCExpression access(Symbol sym,
JCTree.JCExpression tree,
JCTree.JCExpression enclOp,
boolean refSuper)
sym - The accessed symbol.tree - The tree referring to the symbol.enclOp - The closest enclosing operation node of tree,
null if tree is not a subtree of an operation.refSuper - Is access via a (qualified) C.super?JCTree.JCExpression access(JCTree.JCExpression tree)
tree - The identifier tree.
Symbol accessConstructor(JCDiagnostic.DiagnosticPosition pos,
Symbol constr)
pos - The position to report diagnostics, if any.constr - The private constructor.Symbol.ClassSymbol accessConstructorTag()
void makeAccessible(Symbol sym)
sym - The symbol.
JCTree accessDef(int pos,
Symbol vsym,
Symbol.MethodSymbol accessor,
int acode)
pos - The source code position of the definition.vsym - The private or protected symbol.accessor - The access method for the symbol.acode - The access code.
JCTree accessConstructorDef(int pos,
Symbol constr,
Symbol.MethodSymbol accessor)
pos - The source code position of the definition.constr - The private constructor.accessor - The access method for the constructor.Name proxyName(Name name)
List<JCTree.JCVariableDecl> freevarDefs(int pos,
List<Symbol.VarSymbol> freevars,
Symbol owner)
pos - The source code position of the definition.freevars - The free variables.owner - The class in which the definitions go.
Name outerThisName(Type type,
Symbol owner)
type - The class referenced by the this$n field
JCTree.JCVariableDecl outerThisDef(int pos,
Symbol owner)
pos - The source code position of the definition.owner - The class in which the definition goes.
List<JCTree.JCExpression> loadFreevars(JCDiagnostic.DiagnosticPosition pos,
List<Symbol.VarSymbol> freevars)
pos - The source code position to be used for the trees.freevars - The list of free variables.
JCTree.JCExpression loadFreevar(JCDiagnostic.DiagnosticPosition pos,
Symbol.VarSymbol v)
JCTree.JCExpression makeThis(JCDiagnostic.DiagnosticPosition pos,
Symbol.TypeSymbol c)
pos - The source code position to be used for the tree.c - The qualifier class.
JCTree.JCExpression makeOuterThis(JCDiagnostic.DiagnosticPosition pos,
Symbol.TypeSymbol c)
pos - The source code position to be used for the tree.c - The qualifier class.
JCTree.JCExpression makeOwnerThis(JCDiagnostic.DiagnosticPosition pos,
Symbol sym,
boolean preciseMatch)
pos - The source code position to be used for the tree.sym - The accessed symbol.preciseMatch - should we accept a type that is a subtype of
sym's owner, even if it doesn't contain sym
due to hiding, overriding, or non-inheritance
due to protection?
JCTree.JCExpression makeOwnerThisN(JCDiagnostic.DiagnosticPosition pos,
Symbol sym,
boolean preciseMatch)
JCTree.JCStatement initField(int pos,
Name name)
JCTree.JCStatement initOuterThis(int pos)
private Symbol.ClassSymbol outerCacheClass()
private Symbol.MethodSymbol classDollarSym(JCDiagnostic.DiagnosticPosition pos)
JCTree.JCBlock classDollarSymBody(JCDiagnostic.DiagnosticPosition pos,
JCTree.JCMethodDecl md)
private JCTree.JCMethodInvocation makeCall(JCTree.JCExpression left,
Name name,
List<JCTree.JCExpression> args)
private Name cacheName(java.lang.String sig)
sig - The signature of type T.
private Symbol.VarSymbol cacheSym(JCDiagnostic.DiagnosticPosition pos,
java.lang.String sig)
sig - The signature of type T.pos - The position to report diagnostics, if any.private JCTree.JCExpression classOf(JCTree clazz)
clazz - The tree identifying type T.
private JCTree.JCExpression classOfType(Type type,
JCDiagnostic.DiagnosticPosition pos)
private JCTree.JCExpression assertFlagTest(JCDiagnostic.DiagnosticPosition pos)
JCTree abstractRval(JCTree rval,
Type type,
Lower.TreeBuilder builder)
(let TYPE TEMP = RVAL;
in (BUILDER(TEMP)))
where TEMP is a newly declared variable
in the let expression.
JCTree abstractRval(JCTree rval,
Lower.TreeBuilder builder)
JCTree abstractLval(JCTree lval,
Lower.TreeBuilder builder)
JCTree makeComma(JCTree expr1,
JCTree expr2)
public <T extends JCTree> T translate(T tree)
translate in class TreeTranslator
public <T extends JCTree> T translate(T tree,
Type type)
public <T extends JCTree> T translate(T tree,
JCTree.JCExpression enclOp)
public <T extends JCTree> List<T> translate(List<T> trees,
JCTree.JCExpression enclOp)
public <T extends JCTree> List<T> translate(List<T> trees,
Type type)
public void visitTopLevel(JCTree.JCCompilationUnit tree)
visitTopLevel in class TreeTranslatorpublic void visitClassDef(JCTree.JCClassDecl tree)
visitClassDef in class TreeTranslatorprivate void visitEnumDef(JCTree.JCClassDecl tree)
private boolean useClone()
private void visitEnumConstantDef(JCTree.JCVariableDecl var,
int ordinal)
public void visitMethodDef(JCTree.JCMethodDecl tree)
visitMethodDef in class TreeTranslatorprivate void visitMethodDefInternal(JCTree.JCMethodDecl tree)
public void visitTypeCast(JCTree.JCTypeCast tree)
visitTypeCast in class TreeTranslatorpublic void visitNewClass(JCTree.JCNewClass tree)
visitNewClass in class TreeTranslatorpublic void visitConditional(JCTree.JCConditional tree)
visitConditional in class TreeTranslator
private JCTree convert(JCTree tree,
Type pt)
public void visitIf(JCTree.JCIf tree)
visitIf in class TreeTranslatorpublic void visitAssert(JCTree.JCAssert tree)
visitAssert in class TreeTranslatorpublic void visitApply(JCTree.JCMethodInvocation tree)
visitApply in class TreeTranslator
List<JCTree.JCExpression> boxArgs(List<Type> parameters,
List<JCTree.JCExpression> _args,
Type varargsElement)
<T extends JCTree> T boxIfNeeded(T tree,
Type type)
JCTree.JCExpression boxPrimitive(JCTree.JCExpression tree)
JCTree.JCExpression boxPrimitive(JCTree.JCExpression tree,
Type box)
JCTree.JCExpression unbox(JCTree.JCExpression tree,
Type primitive)
public void visitParens(JCTree.JCParens tree)
visitParens in class TreeTranslatorpublic void visitIndexed(JCTree.JCArrayAccess tree)
visitIndexed in class TreeTranslatorpublic void visitAssign(JCTree.JCAssign tree)
visitAssign in class TreeTranslatorpublic void visitAssignop(JCTree.JCAssignOp tree)
visitAssignop in class TreeTranslatorJCTree lowerBoxedPostop(JCTree.JCUnary tree)
public void visitUnary(JCTree.JCUnary tree)
visitUnary in class TreeTranslatorpublic void visitBinary(JCTree.JCBinary tree)
visitBinary in class TreeTranslatorpublic void visitIdent(JCTree.JCIdent tree)
visitIdent in class TreeTranslatorpublic void visitForeachLoop(JCTree.JCEnhancedForLoop tree)
visitForeachLoop in class TreeTranslatorprivate void visitArrayForeachLoop(JCTree.JCEnhancedForLoop tree)
for ( T v : arrayexpr ) stmt;
(where arrayexpr is of an array type) gets translated to
for ( { arraytype #arr = arrayexpr;
int #len = array.length;
int #i = 0; };
#i < #len; i$++ ) {
T v = arr$[#i];
stmt;
}
where #arr, #len, and #i are freshly named synthetic local variables.
private void patchTargets(JCTree body,
JCTree src,
JCTree dest)
private void visitIterableForeachLoop(JCTree.JCEnhancedForLoop tree)
for ( T v : coll ) stmt ;
(where coll implements Iterable extends T>) gets translated to
for ( Iterator extends T> #i = coll.iterator(); #i.hasNext(); ) {
T v = (T) #i.next();
stmt;
}
where #i is a freshly named synthetic local variable.
public void visitVarDef(JCTree.JCVariableDecl tree)
visitVarDef in class TreeTranslatorpublic void visitBlock(JCTree.JCBlock tree)
visitBlock in class TreeTranslatorpublic void visitDoLoop(JCTree.JCDoWhileLoop tree)
visitDoLoop in class TreeTranslatorpublic void visitWhileLoop(JCTree.JCWhileLoop tree)
visitWhileLoop in class TreeTranslatorpublic void visitForLoop(JCTree.JCForLoop tree)
visitForLoop in class TreeTranslatorpublic void visitReturn(JCTree.JCReturn tree)
visitReturn in class TreeTranslatorpublic void visitSwitch(JCTree.JCSwitch tree)
visitSwitch in class TreeTranslatorpublic JCTree visitEnumSwitch(JCTree.JCSwitch tree)
public void visitNewArray(JCTree.JCNewArray tree)
visitNewArray in class TreeTranslatorpublic void visitSelect(JCTree.JCFieldAccess tree)
visitSelect in class TreeTranslatorpublic void visitLetExpr(JCTree.LetExpr tree)
visitLetExpr in class TreeTranslatorpublic void visitAnnotation(JCTree.JCAnnotation tree)
visitAnnotation in class TreeTranslator
public List<JCTree> translateTopLevelClass(Env<AttrContext> env,
JCTree cdef,
TreeMaker make)
env - The attribution environment current at the class definition.
We need this for resolving some additional symbols.cdef - The tree representing the class definition.private void addEnumCompatibleMembers(JCTree.JCClassDecl cdef)
private Symbol.VarSymbol addEnumOrdinalField(JCTree.JCClassDecl cdef)
private Symbol.VarSymbol addEnumNameField(JCTree.JCClassDecl cdef)
private Symbol.MethodSymbol addEnumFieldOrdinalMethod(JCTree.JCClassDecl cdef,
Symbol.VarSymbol ordinalSymbol)
private Symbol.MethodSymbol addEnumFieldNameMethod(JCTree.JCClassDecl cdef,
Symbol.VarSymbol nameSymbol)
private Symbol.MethodSymbol addEnumToString(JCTree.JCClassDecl cdef,
Symbol.VarSymbol nameSymbol)
private Symbol.MethodSymbol addEnumCompareTo(JCTree.JCClassDecl cdef,
Symbol.VarSymbol ordinalSymbol)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||