public class JProgram extends JNode implements ArrayTypeCreator
Modifier and Type | Class and Description |
---|---|
static class |
JProgram.DispatchType
Encapsulates all information necessary to deal with native represented types in an
generic fashion used throughout GWT.
|
Modifier and Type | Field and Description |
---|---|
static String |
CLASS_LITERAL_HOLDER |
static Set<String> |
CODEGEN_TYPES_SET |
List<JClassType> |
codeGenTypes |
static Set<String> |
IMMORTAL_CODEGEN_TYPES_SET |
List<JClassType> |
immortalCodeGenTypes |
static String |
JAVASCRIPTOBJECT |
static Set<String> |
SYNTHETIC_TYPE_NAMES
Types whose entire implementation is synthesized at compile time.
|
JTypeOracle |
typeOracle |
Constructor and Description |
---|
JProgram(MinimalRebuildCache minimalRebuildCache) |
getSourceInfo, setSourceInfo, toSource, toString
public static final String JAVASCRIPTOBJECT
public static final String CLASS_LITERAL_HOLDER
public static final Set<String> SYNTHETIC_TYPE_NAMES
public final List<JClassType> codeGenTypes
public final List<JClassType> immortalCodeGenTypes
public final JTypeOracle typeOracle
public JProgram(MinimalRebuildCache minimalRebuildCache)
public static JExpressionStatement createAssignmentStmt(SourceInfo info, JExpression lhs, JExpression rhs)
public static JBinaryOperation createAssignment(SourceInfo info, JExpression lhs, JExpression rhs)
public static JLocal createLocal(SourceInfo info, String name, JType type, boolean isFinal, JMethodBody enclosingMethodBody)
public static List<JDeclaredType> deserializeTypes(ObjectInputStream stream) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static boolean isClinit(JMethod method)
public static boolean isInit(JMethod method)
public static void serializeTypes(List<JDeclaredType> types, ObjectOutputStream stream) throws IOException
IOException
public void addPinnedMethod(JMethod method)
public void addEntryMethod(JMethod entryPoint)
public void addIndexedTypeName(String typeName)
public void addReferenceOnlyType(JDeclaredType type)
public void addType(JDeclaredType type)
public static boolean isRepresentedAsNative(String className)
public boolean isRepresentedAsNativeJsPrimitive(JType type)
public Set<JClassType> getRepresentedAsNativeTypes()
public Map<JClassType,JProgram.DispatchType> getRepresentedAsNativeTypesDispatchMap()
public EnumSet<JProgram.DispatchType> getDispatchType(JReferenceType type)
public JReferenceType strengthenType(JReferenceType thisType, JReferenceType thatType)
thisType
.public JReferenceType generalizeTypes(Iterable<JReferenceType> types)
NOTE: Ideally we would like to return the least upper bound but it does not exit as the Java type hierarchy is not really a lattice.
Hence, this function depends on the collection order. E.g.
I O
|\ / \
| A B
\ /
\ /
C
where I is an interface an {O,A,B,C} are classes.
generalizeTypes({A,C}) could either be I or O.
In particular generalizeTypes({I,A,C}) = I and generalizeTypes({A,C,I}) = O.
public List<JArrayType> getAllArrayTypes()
public JExpression createArrayClassLiteralExpression(SourceInfo sourceInfo, JClassLiteral leafTypeClassLiteral, int dimensions)
Note: This version can only be called after ImplementClassLiteralsAsFields
has been run.
public Map<JReferenceType,JCastMap> getCastMap()
public JCastMap getCastMap(JReferenceType referenceType)
public List<JDeclaredType> getDeclaredTypes()
public int getFragmentCount()
public FragmentPartitioningResult getFragmentPartitioningResult()
public JDeclaredType getFromTypeMap(String qualifiedBinaryOrSourceName)
public JDeclaredType getIndexedType(String string)
public Collection<JDeclaredType> getIndexedTypes()
public LinkedHashSet<JRunAsync> getInitialAsyncSequence()
public JClassType getJavaScriptObject()
public JLiteral getLiteral(SourceInfo info, Object value)
public JBooleanLiteral getLiteralBoolean(boolean value)
public JCharLiteral getLiteralChar(char value)
public JDoubleLiteral getLiteralDouble(double d)
public JFloatLiteral getLiteralFloat(double f)
public JIntLiteral getLiteralInt(int value)
public JLongLiteral getLiteralLong(long value)
public JNullLiteral getLiteralNull()
public JStringLiteral getStringLiteral(SourceInfo sourceInfo, String s)
public List<JDeclaredType> getModuleDeclaredTypes()
public int getNodeCount()
public JField getNullField()
public JMethod getNullMethod()
public int getCommonAncestorFragmentId(int thisFragmentId, int thatFragmentId)
public Collection<JType> getSubclasses(JType type)
public JArrayType getTypeArray(JType elementType)
public JArrayType getOrCreateArrayType(JType leafType, int dimensions)
getOrCreateArrayType
in interface ArrayTypeCreator
public JClassType getTypeClassLiteralHolder()
public JType getTypeFromJsniRef(String className)
public JClassType getTypeJavaLangClass()
public JClassType getTypeJavaLangObject()
public JArrayType getTypeJavaLangObjectArray()
public JClassType getTypeJavaLangString()
public JPrimitiveType getTypePrimitiveBoolean()
public JPrimitiveType getTypePrimitiveByte()
public JPrimitiveType getTypePrimitiveChar()
public JPrimitiveType getTypePrimitiveDouble()
public JPrimitiveType getTypePrimitiveFloat()
public JPrimitiveType getTypePrimitiveInt()
public JPrimitiveType getTypePrimitiveLong()
public JPrimitiveType getTypePrimitiveShort()
public JPrimitiveType getTypeVoid()
public void initTypeInfo(Map<JReferenceType,JCastMap> castMapForType)
public boolean isUntypedArrayType(JType type)
public boolean isJavaLangString(JType type)
public boolean isJavaLangObject(JType type)
public boolean isReferenceOnly(JDeclaredType type)
public boolean isStaticImpl(JMethod method)
public JType normalizeJsoType(JType type)
type
.public void putIntoTypeMap(String qualifiedBinaryName, JDeclaredType type)
public void removeStaticImplMapping(JMethod staticImpl)
public void removeReferenceOnlyType(JDeclaredType type)
public void setFragmentPartitioningResult(FragmentPartitioningResult result)
public void setInitialFragmentIdSequence(List<Integer> initialFragmentIdSequence)
public void setInitialAsyncSequence(LinkedHashSet<JRunAsync> initialAsyncSequence)
public JMethod instanceMethodForStaticImpl(JMethod method)
method
is a static impl method, returns the instance method
that method
is the implementation of. Otherwise, returnsnull
.public void traverse(JVisitor visitor, Context ctx)
JNode
public void visitAllTypes(JVisitor visitor)
public void visitModuleTypes(JVisitor visitor)
Copyright © 2018. All rights reserved.