public class JTypeOracle extends Object implements Serializable
Since its entire responsibility is to be an index of type related information it should not directly perform any optimizations.
Modifier and Type | Class and Description |
---|---|
static class |
JTypeOracle.ImmediateTypeRelations
All authorative information about the current program.
|
static class |
JTypeOracle.StandardTypes
A collection of types that are required to correctly run JTypeOracle.
|
Modifier and Type | Field and Description |
---|---|
static com.google.gwt.thirdparty.guava.common.base.Function<JType,String> |
TYPE_TO_NAME |
Constructor and Description |
---|
JTypeOracle(ArrayTypeCreator arrayTypeCreator,
MinimalRebuildCache minimalRebuildCache)
Constructs a new JTypeOracle.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canBeJavaScriptObject(JType type)
True if the type is a JSO or interface implemented by JSO or a JsType without
prototype.
|
boolean |
castFailsTrivially(JReferenceType fromType,
JReferenceType toType) |
boolean |
castSucceedsTrivially(JReferenceType fromType,
JReferenceType toType) |
boolean |
castSucceedsTrivially(JType fromType,
JType toType) |
void |
computeBeforeAST(JTypeOracle.StandardTypes standardTypes,
Collection<JDeclaredType> declaredTypes,
Collection<JDeclaredType> moduleDeclaredTypes,
Collection<String> deletedTypeNames) |
void |
computeBeforeAST(JTypeOracle.StandardTypes standardTypes,
Collection<JDeclaredType> declaredTypes,
List<JDeclaredType> moduleDeclaredTypes) |
JMethod |
findMostSpecificOverride(JClassType type,
JMethod baseMethod) |
Set<JReferenceType> |
getCastableDestinationTypes(JReferenceType type) |
JMethod |
getInstanceMethodBySignature(JClassType type,
String signature) |
JClassType |
getSingleJsoImpl(JReferenceType maybeSingleJsoIntf) |
Set<String> |
getSubClassNames(String typeName) |
Set<String> |
getSubInterfaceNames(String typeName) |
Iterable<String> |
getSubTypeNames(String typeName) |
String |
getSuperTypeName(String className) |
boolean |
isDualJsoInterface(JType maybeDualImpl) |
boolean |
isEffectivelyJavaScriptObject(JType type)
True if either a JSO, or is an interface that is ONLY implemented by a JSO.
|
boolean |
isInstantiatedType(JDeclaredType type)
Determine whether a type is instantiated.
|
boolean |
isInstantiatedType(JReferenceType type)
Determine whether a type is instantiated.
|
static boolean |
isNoOpCast(JType type) |
boolean |
isSingleJsoImpl(JType type) |
boolean |
isSubClass(JClassType type,
JClassType possibleSubType)
Returns true if possibleSubType is a subclass of type, directly or indirectly.
|
boolean |
isSubType(JDeclaredType type,
JDeclaredType possibleSubType) |
boolean |
isSuperClass(JReferenceType type,
JReferenceType possibleSuperClass)
Returns true if possibleSuperClass is a superclass of type, directly or indirectly.
|
boolean |
isSuperClassOrInterface(JReferenceType fromType,
JReferenceType toType) |
static boolean |
methodsDoMatch(JMethod method1,
JMethod method2)
Compare two methods based on name and original argument types
JMethod.getOriginalParamTypes() . |
void |
recomputeAfterOptimizations(Collection<JDeclaredType> declaredTypes)
This method should be called after altering the types that are live in the
associated JProgram.
|
void |
setInstantiatedTypes(Set<JReferenceType> instantiatedTypes) |
void |
setOptimize(boolean optimize) |
public JTypeOracle(ArrayTypeCreator arrayTypeCreator, MinimalRebuildCache minimalRebuildCache)
public void setOptimize(boolean optimize)
public static boolean methodsDoMatch(JMethod method1, JMethod method2)
JMethod.getOriginalParamTypes()
. Note that nothing special is done
here regarding methods with type parameters in their argument lists. The
caller must be careful that this level of matching is sufficient.public boolean canBeJavaScriptObject(JType type)
public static boolean isNoOpCast(JType type)
public boolean castFailsTrivially(JReferenceType fromType, JReferenceType toType)
public boolean castSucceedsTrivially(JReferenceType fromType, JReferenceType toType)
public void computeBeforeAST(JTypeOracle.StandardTypes standardTypes, Collection<JDeclaredType> declaredTypes, List<JDeclaredType> moduleDeclaredTypes)
public void computeBeforeAST(JTypeOracle.StandardTypes standardTypes, Collection<JDeclaredType> declaredTypes, Collection<JDeclaredType> moduleDeclaredTypes, Collection<String> deletedTypeNames)
public JMethod getInstanceMethodBySignature(JClassType type, String signature)
public JMethod findMostSpecificOverride(JClassType type, JMethod baseMethod)
public JClassType getSingleJsoImpl(JReferenceType maybeSingleJsoIntf)
public Set<JReferenceType> getCastableDestinationTypes(JReferenceType type)
public boolean isDualJsoInterface(JType maybeDualImpl)
public boolean isEffectivelyJavaScriptObject(JType type)
public boolean isInstantiatedType(JDeclaredType type)
public boolean isInstantiatedType(JReferenceType type)
public boolean isSingleJsoImpl(JType type)
public boolean isSubClass(JClassType type, JClassType possibleSubType)
public boolean isSubType(JDeclaredType type, JDeclaredType possibleSubType)
public boolean isSuperClass(JReferenceType type, JReferenceType possibleSuperClass)
public boolean isSuperClassOrInterface(JReferenceType fromType, JReferenceType toType)
public void recomputeAfterOptimizations(Collection<JDeclaredType> declaredTypes)
public void setInstantiatedTypes(Set<JReferenceType> instantiatedTypes)
Copyright © 2018. All rights reserved.