APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.javac.comp

public Class TransTypes

extends TreeTranslator
Class Inheritance
Imports
com.sun.source.tree.MemberReferenceTree.ReferenceMode, com.sun.tools.javac.code.*, .Attribute.TypeCompound, com.sun.tools.javac.code.Symbol.*, .Type.TypeVar, com.sun.tools.javac.jvm.Target, com.sun.tools.javac.tree.*, com.sun.tools.javac.tree.JCTree.*, .JCTree.JCMemberReference.ReferenceKind, .JCTree.JCBreak, com.sun.tools.javac.util.*, .JCDiagnostic.DiagnosticPosition, .List

This pass translates Generic Java to conventional Java.

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
private class
TransTypes.MemberReferenceToLambda

Converts a method reference which cannot be used directly into a lambda

Field Summary

Modifier and TypeField and Description
private Annotate
private Attr
private final CompileStates
private Enter
private Env<AttrContext>
private Type
explicitCastTP

we use this type to indicate that "upstream" there is an explicit cast to this type, this way we can avoid generating redundant type casts.

private Log
private TreeMaker
private Names
private Type
pt

Visitor argument: proto-type.

private final Resolve
pack-priv Type
private static final String
private Symtab
private final Target
protected static final Context.Key<TransTypes>
transTypesKey

The context key for the TransTypes phase.

private Types
Inherited from com.sun.tools.javac.tree.TreeTranslator:
result

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addBridge(JCDiagnostic.DiagnosticPosition
The source code position to be used for the definition.
pos
,
Symbol.MethodSymbol
The method for which a bridge needs to be added
meth
,
Symbol.MethodSymbol
That method's implementation (possibly the method itself)
impl
,
Symbol.ClassSymbol
The class to which the bridge will be added
origin
,
ListBuffer<JCTree>
The list buffer to which the bridge will be added
bridges
)

Add a bridge definition and enter corresponding method symbol in local scope of origin.

pack-priv void
addBridgeIfNeeded(JCDiagnostic.DiagnosticPosition
The source code position to be used for the definition.
pos
,
Symbol
The symbol for which a bridge might have to be added.
sym
,
Symbol.ClassSymbol
The class in which the bridge would go.
origin
,
ListBuffer<JCTree>
The list buffer to which the bridge would be added.
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.

pack-priv void
pack-priv void
addBridges(JCDiagnostic.DiagnosticPosition
The source code position to be used for the bridges.
pos
,
Symbol.ClassSymbol
The class in which the bridges go.
origin
,
ListBuffer<JCTree>
The list buffer to which the bridges are added.
bridges
)

Add all necessary bridges to some class appending them to list buffer.

pack-priv JCTree.JCExpression
cast(JCTree.JCExpression
The expression tree.
tree
,
Type
The target type.
target
)

Construct an attributed tree for a cast of expression to target type, unless it already has precisely that type.

public JCTree.JCExpression
coerce(Env<AttrContext> env, JCTree.JCExpression
The expression tree.
tree
,
Type
The target type.
target
)

Construct an attributed tree to coerce an expression to some erased target type, unless the expression is already assignable to that type.

pack-priv JCTree.JCExpression
private List<Symbol.VarSymbol>
private Type
public static TransTypes
instance(Context context)

Get the instance for this context.

pack-priv boolean
interfaceParameterIsIntersectionOrUnionType(JCTree.JCMemberReference tree)

Erasure destroys the implementation parameter subtype relationship for intersection types.

pack-priv boolean
isArrayOp(JCTree.JCMemberReference tree)

Returns: Is this an array operation like clone()

private boolean
isBridgeNeeded(Symbol.MethodSymbol
The symbol for which a bridge might have to be added
method
,
Symbol.MethodSymbol
The implementation of method
impl
,
Type
The type in which the bridge would go
dest
)

pack-priv boolean
pack-priv boolean
isPrivateInOtherClass(JCTree.JCMemberReference tree)

This method should be called only when target release <= 14 where LambdaMetaFactory does not spin nestmate classes.

private boolean
private boolean
isSameMemberWhenErased(Type
the class where to look for the method
type
,
Symbol.MethodSymbol
the method to look for in class
method
,
Type
the erasure of method
erasure
)

Lookup the method as a member of the type.

pack-priv boolean
needsConversionToLambda(JCTree.JCMemberReference tree)

Does this reference need to be converted to a lambda (i.e. var args need to be expanded or "super" is used)

pack-priv boolean
pack-priv boolean
pack-priv JCTree.JCExpression
retype(JCTree.JCExpression
The expression tree whose type might need adjustment.
tree
,
Type
The expression's type after erasure.
erasedType
,
Type
The target type, which is usually the erasure of the expression's original type.
target
)

Given an erased reference type, assume this type as the tree's type.

public <T extends JCTree> T
translate(T tree, Type pt)

Visitor method: perform a type translation on tree.

public <T extends JCTree> T
translate(T tree, Type pt, Type castTP)

public <T extends JCTree> List<T>
translate(List<T> trees, Type pt)

Visitor method: perform a type translation on list of trees.

pack-priv <T extends JCTree> List<T>
translateArgs(List<T>
The method argument list.
_args
,
List<Type>
The list of target types.
parameters
,
Type
The erasure of the varargs element type, or null if translating a non-varargs invocation
varargsElement
)

Translate method argument list, casting each argument to its corresponding type in a list of target types.

public <T extends JCTree> List<T>
translateArgs(List<T> _args, List<Type> parameters, Type varargsElement, Env<AttrContext> localEnv)

pack-priv void
public JCTree
translateTopLevelClass(JCTree
The definition to be translated.
cdef
,
TreeMaker make)

Translate a toplevel class definition.

public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
visitTypeApply(JCTree.JCTypeApply tree)

Overrides com.sun.tools.javac.tree.TreeTranslator.visitTypeApply.

Visitor method for parameterized types.

public void
public void
public void
public void
public void
public void
public void
public void
Inherited from com.sun.tools.javac.tree.TreeTranslator:
translatetranslatetranslateAnnotationstranslateCasestranslateCatcherstranslateTypeParamstranslateVarDefsvisitBlockvisitCatchvisitContinuevisitDefaultCaseLabelvisitErroneousvisitImportvisitLabelledvisitLetExprvisitLiteralvisitModifiersvisitModuleImportvisitPackageDefvisitSkipvisitTopLevelvisitTreevisitTypeBoundKindvisitTypeIdentvisitTypeParametervisitTypeUnionvisitVarTypevisitWildcard