| java.lang.Object com.sun.tools.javac.tree.JCTree com.sun.tools.javac.tree.TreeTranslator com.sun.tools.javac.comp.TransTypes
TransTypes | public class TransTypes extends TreeTranslator (Code) | | This pass translates Generic Java to conventional Java.
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.
|
Method Summary | |
void | addBridge(DiagnosticPosition pos, MethodSymbol meth, MethodSymbol impl, ClassSymbol origin, boolean hypothetical, ListBuffer<JCTree> bridges) Add a bridge definition and enter corresponding method symbol in
local scope of origin. | void | addBridgeIfNeeded(DiagnosticPosition pos, Symbol sym, ClassSymbol origin, ListBuffer<JCTree> bridges) Add bridge if given symbol is a non-private, non-static member
of the given class, which is either defined in the class or non-final
inherited, and one of the two following conditions holds:
1. | void | addBridges(DiagnosticPosition pos, TypeSymbol i, ClassSymbol origin, ListBuffer<JCTree> bridges) | void | addBridges(DiagnosticPosition pos, ClassSymbol origin, ListBuffer<JCTree> bridges) Add all necessary bridges to some class appending them to list buffer. | JCExpression | cast(JCExpression tree, Type target) Construct an attributed tree for a cast of expression to target type,
unless it already has precisely that type. | JCExpression | coerce(JCExpression tree, Type target) Construct an attributed tree to coerce an expression to some erased
target type, unless the expression is already assignable to that type. | public static TransTypes | instance(Context context) Get the instance for this context. | JCExpression | retype(JCExpression tree, Type erasedType, Type target) Given an erased reference type, assume this type as the tree's type.
Then, coerce to some given target type unless target type is null.
This operation is used in situations like the following:
class Cell { A value; }
...
Cell cell;
Integer x = cell.value;
Since the erasure of Cell.value is Object, but the type
of cell.value in the assignment is Integer, we need to
adjust the original type of cell.value to Object, and insert
a cast to Integer. | public T | translate(T tree, Type pt) Visitor method: perform a type translation on tree. | public List<T> | translate(List<T> trees, Type pt) Visitor method: perform a type translation on list of trees. | List<T> | translateArgs(List<T> _args, List<Type> parameters, Type varargsElement) Translate method argument list, casting each argument
to its corresponding type in a list of target types. | void | translateClass(ClassSymbol c) | public JCTree | translateTopLevelClass(JCTree cdef, TreeMaker make) Translate a toplevel class definition. | public void | visitAnnotation(JCAnnotation tree) | public void | visitApply(JCMethodInvocation tree) | public void | visitAssert(JCAssert tree) | public void | visitAssign(JCAssign tree) | public void | visitAssignop(JCAssignOp tree) | public void | visitBinary(JCBinary tree) | public void | visitCase(JCCase tree) | public void | visitClassDef(JCClassDecl tree) | public void | visitConditional(JCConditional tree) | public void | visitDoLoop(JCDoWhileLoop tree) | public void | visitExec(JCExpressionStatement tree) | public void | visitForLoop(JCForLoop tree) | public void | visitForeachLoop(JCEnhancedForLoop tree) | public void | visitIdent(JCIdent tree) | public void | visitIf(JCIf tree) | public void | visitIndexed(JCArrayAccess tree) | public void | visitMethodDef(JCMethodDecl tree) | public void | visitNewArray(JCNewArray tree) | public void | visitNewClass(JCNewClass tree) | public void | visitParens(JCParens tree) | public void | visitReturn(JCReturn tree) | public void | visitSelect(JCFieldAccess tree) | public void | visitSwitch(JCSwitch tree) | public void | visitSynchronized(JCSynchronized tree) | public void | visitThrow(JCThrow tree) | public void | visitTypeApply(JCTypeApply tree) Visitor method for parameterized types. | public void | visitTypeArray(JCArrayTypeTree tree) | public void | visitTypeCast(JCTypeCast tree) | public void | visitTypeTest(JCInstanceOf tree) | public void | visitUnary(JCUnary tree) | public void | visitVarDef(JCVariableDecl tree) | public void | visitWhileLoop(JCWhileLoop tree) |
currentMethod | JCMethodDecl currentMethod(Code) | | |
overridden | Map<MethodSymbol, MethodSymbol> overridden(Code) | | A hashtable mapping bridge methods to the methods they override after
type erasure.
|
addBridge | void addBridge(DiagnosticPosition pos, MethodSymbol meth, MethodSymbol impl, ClassSymbol origin, boolean hypothetical, ListBuffer<JCTree> bridges)(Code) | | Add a bridge definition and enter corresponding method symbol in
local scope of origin.
Parameters: pos - The source code position to be used for the definition. Parameters: meth - The method for which a bridge needs to be added Parameters: impl - That method's implementation (possibly the method itself) Parameters: origin - The class to which the bridge will be added Parameters: hypothetical - True if the bridge method is not strictly necessary in thebinary, but is represented in the symbol table to detecterasure clashes. Parameters: bridges - The list buffer to which the bridge will be added |
addBridgeIfNeeded | void addBridgeIfNeeded(DiagnosticPosition pos, Symbol sym, ClassSymbol origin, ListBuffer<JCTree> bridges)(Code) | | Add bridge if given symbol is a non-private, non-static member
of the given class, which is either defined in the class or non-final
inherited, and one of the two following conditions holds:
1. The method's type changes in the given class, as compared to the
class where the symbol was defined, (in this case
we have extended a parameterized class with non-trivial parameters).
2. The method has an implementation with a different erased return type.
(in this case we have used co-variant returns).
If a bridge already exists in some other class, no new bridge is added.
Instead, it is checked that the bridge symbol overrides the method symbol.
(Spec ???).
todo: what about bridges for privates???
Parameters: pos - The source code position to be used for the definition. Parameters: sym - The symbol for which a bridge might have to be added. Parameters: origin - The class in which the bridge would go. Parameters: bridges - The list buffer to which the bridge would be added. |
addBridges | void addBridges(DiagnosticPosition pos, TypeSymbol i, ClassSymbol origin, ListBuffer<JCTree> bridges)(Code) | | |
addBridges | void addBridges(DiagnosticPosition pos, ClassSymbol origin, ListBuffer<JCTree> bridges)(Code) | | Add all necessary bridges to some class appending them to list buffer.
Parameters: pos - The source code position to be used for the bridges. Parameters: origin - The class in which the bridges go. Parameters: bridges - The list buffer to which the bridges are added. |
cast | JCExpression cast(JCExpression tree, Type target)(Code) | | Construct an attributed tree for a cast of expression to target type,
unless it already has precisely that type.
Parameters: tree - The expression tree. Parameters: target - The target type. |
coerce | JCExpression coerce(JCExpression tree, Type target)(Code) | | Construct an attributed tree to coerce an expression to some erased
target type, unless the expression is already assignable to that type.
If target type is a constant type, use its base type instead.
Parameters: tree - The expression tree. Parameters: target - The target type. |
translate | public T translate(T tree, Type pt)(Code) | | Visitor method: perform a type translation on tree.
|
translate | public List<T> translate(List<T> trees, Type pt)(Code) | | Visitor method: perform a type translation on list of trees.
|
translateArgs | List<T> translateArgs(List<T> _args, List<Type> parameters, Type varargsElement)(Code) | | Translate method argument list, casting each argument
to its corresponding type in a list of target types.
Parameters: _args - The method argument list. Parameters: parameters - The list of target types. Parameters: varargsElement - The erasure of the varargs element type,or null if translating a non-varargs invocation |
translateClass | void translateClass(ClassSymbol c)(Code) | | |
translateTopLevelClass | public JCTree translateTopLevelClass(JCTree cdef, TreeMaker make)(Code) | | Translate a toplevel class definition.
Parameters: cdef - The definition to be translated. |
visitAnnotation | public void visitAnnotation(JCAnnotation tree)(Code) | | |
visitApply | public void visitApply(JCMethodInvocation tree)(Code) | | |
visitAssert | public void visitAssert(JCAssert tree)(Code) | | |
visitAssign | public void visitAssign(JCAssign tree)(Code) | | |
visitAssignop | public void visitAssignop(JCAssignOp tree)(Code) | | |
visitBinary | public void visitBinary(JCBinary tree)(Code) | | |
visitCase | public void visitCase(JCCase tree)(Code) | | |
visitClassDef | public void visitClassDef(JCClassDecl tree)(Code) | | |
visitConditional | public void visitConditional(JCConditional tree)(Code) | | |
visitDoLoop | public void visitDoLoop(JCDoWhileLoop tree)(Code) | | |
visitExec | public void visitExec(JCExpressionStatement tree)(Code) | | |
visitForLoop | public void visitForLoop(JCForLoop tree)(Code) | | |
visitForeachLoop | public void visitForeachLoop(JCEnhancedForLoop tree)(Code) | | |
visitIdent | public void visitIdent(JCIdent tree)(Code) | | |
visitIf | public void visitIf(JCIf tree)(Code) | | |
visitIndexed | public void visitIndexed(JCArrayAccess tree)(Code) | | |
visitMethodDef | public void visitMethodDef(JCMethodDecl tree)(Code) | | |
visitNewArray | public void visitNewArray(JCNewArray tree)(Code) | | |
visitNewClass | public void visitNewClass(JCNewClass tree)(Code) | | |
visitParens | public void visitParens(JCParens tree)(Code) | | |
visitReturn | public void visitReturn(JCReturn tree)(Code) | | |
visitSelect | public void visitSelect(JCFieldAccess tree)(Code) | | |
visitSwitch | public void visitSwitch(JCSwitch tree)(Code) | | |
visitSynchronized | public void visitSynchronized(JCSynchronized tree)(Code) | | |
visitThrow | public void visitThrow(JCThrow tree)(Code) | | |
visitTypeApply | public void visitTypeApply(JCTypeApply tree)(Code) | | Visitor method for parameterized types.
|
visitTypeArray | public void visitTypeArray(JCArrayTypeTree tree)(Code) | | |
visitTypeCast | public void visitTypeCast(JCTypeCast tree)(Code) | | |
visitTypeTest | public void visitTypeTest(JCInstanceOf tree)(Code) | | |
visitUnary | public void visitUnary(JCUnary tree)(Code) | | |
visitVarDef | public void visitVarDef(JCVariableDecl tree)(Code) | | |
visitWhileLoop | public void visitWhileLoop(JCWhileLoop tree)(Code) | | |
|
|