Package sc.lang.java
Class JavaTypeDeclaration
- java.lang.Object
-
- sc.lang.SemanticNode
-
- sc.lang.java.JavaTypeDeclaration
-
- All Implemented Interfaces:
ISemanticNode
,ITypeDeclaration
,ILifecycle
public abstract class JavaTypeDeclaration extends SemanticNode implements ITypeDeclaration
This is a hook point for external implementations of the Java type system - like CFClass - a wrapper around the class format and IntelliJs PsiClass
-
-
Field Summary
Fields Modifier and Type Field Description LayeredSystem
system
-
Fields inherited from class sc.lang.SemanticNode
debugDiffTrace, initialized, PARENT_NODE_PROPERTY, parentNode, PARSE_NODE_PROPERTY, parseletId, parseNode, parseNodeInvalid, processed, started, transformed, validated
-
Fields inherited from interface sc.lang.ISemanticNode
CopyAll, CopyIndependent, CopyInitLevels, CopyNormal, CopyParseNode, CopyReplace, CopyState, CopyTransformed, SkipParseNode
-
-
Constructor Summary
Constructors Constructor Description JavaTypeDeclaration(LayeredSystem sys)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
clearDynFields(java.lang.Object inst, ExecutionContext ctx, boolean initExt)
java.lang.Object
declaresConstructor(java.util.List<?> parametersOrExpressions, ITypeParamContext ctx)
java.lang.Object
definesMember(java.lang.String name, java.util.EnumSet<JavaSemanticNode.MemberType> mtype, java.lang.Object refType, TypeContext ctx)
java.lang.Object
definesMethod(java.lang.String name, java.util.List<?> parametersOrExpressions, ITypeParamContext ctx, java.lang.Object refType, boolean isTransformed, boolean staticOnly, java.lang.Object inferredType, java.util.List<JavaType> methodTypeArgs)
java.lang.Object[]
getAllImplementsTypeDeclarations()
java.util.ArrayList<java.lang.Object>
getAllInheritedAnnotations(java.lang.String annotationName, boolean skipCompiled, Layer refLayer, boolean layerResolve)
Returns all occurrences of the specified annotation on the types in the type hierarchy ordered so the first type encountered during the traversal is first.java.lang.Object
getClass(java.lang.String className, boolean useImports, boolean compiledOnly)
java.lang.Class
getCompiledClass()
java.lang.String
getCompiledClassName()
java.util.List<JavaType>
getCompiledTypeArgs(java.util.List<JavaType> typeArgs)
Maps the supplied type arguments to those in the actual compiled class.java.lang.String
getCompiledTypeName()
java.lang.Object
getConstructorFromSignature(java.lang.String sig, boolean includeHidden)
BaseTypeDescriptor
getDBTypeDescriptor()
DeclarationType
getDeclarationType()
java.lang.Object
getDerivedTypeDeclaration()
Used to retrieve the type which either a class or modify type is derived from.java.lang.Object
getEnumConstant(java.lang.String nextName)
abstract java.lang.String
getExtendsTypeName()
java.lang.String
getFullTypeName(boolean includeDims, boolean includeTypeParams)
abstract java.util.List<java.lang.Object>
getImplementsList()
java.lang.Object
getInheritedAnnotation(java.lang.String annotationName, boolean skipCompiled, Layer refLayer, boolean layerResolve)
Returns the first occurrence of the specified annotation on the types in the type hierarchyabstract java.lang.String
getInterfaceName(int ix)
JavaModel
getJavaModel()
Layer
getLayer()
LayeredSystem
getLayeredSystem()
java.lang.Object
getMethodFromSignature(java.lang.String methodName, java.lang.String signature, boolean resolveLayer)
DynType
getPropertyCache()
java.lang.Object
getRuntimeType()
java.lang.Object
getTypeDeclaration(java.lang.String name, boolean compiledOnly)
java.lang.String
getTypeName()
boolean
implementsType(java.lang.String otherName, boolean assignment, boolean allowUnbound)
void
initDynStatements(java.lang.Object inst, ExecutionContext ctx, TypeDeclaration.InitStatementMode mode, boolean initExt)
boolean
isAssignableFrom(ITypeDeclaration other, boolean assignmentSemantics)
boolean
isAssignableFromClass(java.lang.Class other)
boolean
isAssignableTo(ITypeDeclaration other)
boolean
isCompiledProperty(java.lang.String name, boolean fieldMode, boolean interfaceMode)
boolean
isComponentType()
boolean
isDynamicNew()
boolean
isDynamicStub(boolean includeExtends)
boolean
isDynamicType()
abstract boolean
isEnum()
boolean
isEnumeratedType()
abstract boolean
isInterface()
boolean
isLayerComponent()
Returns true if this is a component defined as part of a layer definitionboolean
isLayerType()
Returns true if this is the root type for a layer definitionboolean
isRealType()
Return false for any types, such as lambda expressions, or intermediate template fragments which are not included in the type hierarchy (name and enclosing type)boolean
isTransformedType()
boolean
isValidated()
boolean
needsOwnClass(boolean checkComponents)
Returns false for object types whichITypeDeclaration
resolve(boolean modified)
This method is used to be sure the ITypeDeclaration we are referring to is the latest one.void
setAccessTime(long time)
Mark the lastAccessTime for all of the models that define this type only (not the code inside of the type like the ForRefs version)void
setAccessTimeForRefs(long time)
For source representations of a type, mark any references contains in this type as 'in use' with the specified access time so only unused types in the cache are removedvoid
staticInit()
void
stop()
boolean
useDefaultModifier()
Does this type use the layer level modifiervoid
validate()
-
Methods inherited from class sc.lang.SemanticNode
changeLanguage, clearInitialized, clearParseNode, clearStarted, computeNearString, containsChild, deepCopy, deepEquals, diffNode, ensureValidated, equals, formatLeftParenDelegateToParent, formatSpaceBeforeAngleBracket, getAnyChildParseNode, getChildAtIndex, getChildNestingDepth, getDependencyDisabledText, getEnclosingSrcStatement, getLanguageModel, getNestingDepth, getNodeCount, getNodeErrorRange, getNodeErrorText, getNodeWarningText, getNotFoundError, getParentNode, getParseErrorNode, getParseletId, getParseNode, getRootNode, getStartIndex, getStopSemanticProps, getTransformed, getUserVisibleName, hasErrors, hashCode, indexOfChild, init, isInitialized, isParseNodeValid, isProcessed, isSemanticChildValue, isSemanticProperty, isSemanticProperty, isStarted, isTrailingSrcStatement, needsTransform, process, refreshNode, regenerate, regenerateIfTracking, removeChild, replaceChild, restoreParseNode, restoreParseNode, sameSrcLocation, serialize, setParentNode, setParseErrorNode, setParselet, setParseletId, setParseNode, setParseNodeValid, setProperty, setProperty, spaceAfterParen, start, styleNode, styleNode, toDeclarationString, toDefinitionString, toDefinitionString, toDefinitionString, toHeaderString, toLanguageString, toLanguageString, toLocationString, toLocationString, toLocationString, toModelString, toModelString, toSafeLanguageString, transform, validateParseNode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface sc.lang.java.ITypeDeclaration
definesConstructor, definesMember, findTypeDeclaration, getAllFields, getAllInnerTypes, getAllMethods, getAllProperties, getArrayComponentType, getClassTypeParameters, getConstructors, getDeclaredProperties, getExtendsType, getExtendsTypeDeclaration, getFullBaseTypeName, getFullTypeName, getImplementsTypeDeclarations, getImplementsTypes, getInnerType, getInnerTypeName, getJavaFullTypeName, getMethods
-
-
-
-
Field Detail
-
system
public LayeredSystem system
-
-
Constructor Detail
-
JavaTypeDeclaration
public JavaTypeDeclaration(LayeredSystem sys)
-
-
Method Detail
-
getJavaModel
public JavaModel getJavaModel()
- Specified by:
getJavaModel
in interfaceITypeDeclaration
-
isLayerType
public boolean isLayerType()
Description copied from interface:ITypeDeclaration
Returns true if this is the root type for a layer definition- Specified by:
isLayerType
in interfaceITypeDeclaration
-
isLayerComponent
public boolean isLayerComponent()
Description copied from interface:ITypeDeclaration
Returns true if this is a component defined as part of a layer definition- Specified by:
isLayerComponent
in interfaceITypeDeclaration
-
getLayer
public Layer getLayer()
- Specified by:
getLayer
in interfaceITypeDeclaration
-
getLayeredSystem
public LayeredSystem getLayeredSystem()
- Specified by:
getLayeredSystem
in interfaceITypeDeclaration
-
isAssignableFromClass
public boolean isAssignableFromClass(java.lang.Class other)
- Specified by:
isAssignableFromClass
in interfaceITypeDeclaration
-
getTypeName
public java.lang.String getTypeName()
- Specified by:
getTypeName
in interfaceITypeDeclaration
-
getFullTypeName
public java.lang.String getFullTypeName(boolean includeDims, boolean includeTypeParams)
- Specified by:
getFullTypeName
in interfaceITypeDeclaration
-
getCompiledClass
public java.lang.Class getCompiledClass()
- Specified by:
getCompiledClass
in interfaceITypeDeclaration
-
getCompiledClassName
public java.lang.String getCompiledClassName()
- Specified by:
getCompiledClassName
in interfaceITypeDeclaration
-
getCompiledTypeName
public java.lang.String getCompiledTypeName()
- Specified by:
getCompiledTypeName
in interfaceITypeDeclaration
-
getRuntimeType
public java.lang.Object getRuntimeType()
- Specified by:
getRuntimeType
in interfaceITypeDeclaration
-
isDynamicType
public boolean isDynamicType()
- Specified by:
isDynamicType
in interfaceITypeDeclaration
-
isDynamicStub
public boolean isDynamicStub(boolean includeExtends)
- Specified by:
isDynamicStub
in interfaceITypeDeclaration
-
declaresConstructor
public java.lang.Object declaresConstructor(java.util.List<?> parametersOrExpressions, ITypeParamContext ctx)
- Specified by:
declaresConstructor
in interfaceITypeDeclaration
-
definesMember
public java.lang.Object definesMember(java.lang.String name, java.util.EnumSet<JavaSemanticNode.MemberType> mtype, java.lang.Object refType, TypeContext ctx)
- Specified by:
definesMember
in interfaceITypeDeclaration
-
isInterface
public abstract boolean isInterface()
-
isEnum
public abstract boolean isEnum()
-
getDeclarationType
public DeclarationType getDeclarationType()
- Specified by:
getDeclarationType
in interfaceITypeDeclaration
-
isRealType
public boolean isRealType()
Description copied from interface:ITypeDeclaration
Return false for any types, such as lambda expressions, or intermediate template fragments which are not included in the type hierarchy (name and enclosing type)- Specified by:
isRealType
in interfaceITypeDeclaration
-
staticInit
public void staticInit()
- Specified by:
staticInit
in interfaceITypeDeclaration
-
isTransformedType
public boolean isTransformedType()
- Specified by:
isTransformedType
in interfaceITypeDeclaration
-
resolve
public ITypeDeclaration resolve(boolean modified)
Description copied from interface:ITypeDeclaration
This method is used to be sure the ITypeDeclaration we are referring to is the latest one. If not, a replacement value is returned. There are two modes it's used. When you pass in 'modified=true' it returns the modifying type of this type. When you pass in modified=false it just returns a new type if the old one has been replaced in the current type system. Perhaps a dependent type has been updated or changed on the file system and refreshed.- Specified by:
resolve
in interfaceITypeDeclaration
-
useDefaultModifier
public boolean useDefaultModifier()
Description copied from interface:ITypeDeclaration
Does this type use the layer level modifier- Specified by:
useDefaultModifier
in interfaceITypeDeclaration
-
setAccessTimeForRefs
public void setAccessTimeForRefs(long time)
Description copied from interface:ITypeDeclaration
For source representations of a type, mark any references contains in this type as 'in use' with the specified access time so only unused types in the cache are removed- Specified by:
setAccessTimeForRefs
in interfaceITypeDeclaration
-
setAccessTime
public void setAccessTime(long time)
Description copied from interface:ITypeDeclaration
Mark the lastAccessTime for all of the models that define this type only (not the code inside of the type like the ForRefs version)- Specified by:
setAccessTime
in interfaceITypeDeclaration
-
getDBTypeDescriptor
public BaseTypeDescriptor getDBTypeDescriptor()
- Specified by:
getDBTypeDescriptor
in interfaceITypeDeclaration
-
getCompiledTypeArgs
public java.util.List<JavaType> getCompiledTypeArgs(java.util.List<JavaType> typeArgs)
Description copied from interface:ITypeDeclaration
Maps the supplied type arguments to those in the actual compiled class. Used to propagate type params across in the dynamic/compiled stub- Specified by:
getCompiledTypeArgs
in interfaceITypeDeclaration
-
needsOwnClass
public boolean needsOwnClass(boolean checkComponents)
Description copied from interface:ITypeDeclaration
Returns false for object types which- Specified by:
needsOwnClass
in interfaceITypeDeclaration
-
isDynamicNew
public boolean isDynamicNew()
- Specified by:
isDynamicNew
in interfaceITypeDeclaration
-
initDynStatements
public void initDynStatements(java.lang.Object inst, ExecutionContext ctx, TypeDeclaration.InitStatementMode mode, boolean initExt)
- Specified by:
initDynStatements
in interfaceITypeDeclaration
-
clearDynFields
public void clearDynFields(java.lang.Object inst, ExecutionContext ctx, boolean initExt)
- Specified by:
clearDynFields
in interfaceITypeDeclaration
-
getAllImplementsTypeDeclarations
public java.lang.Object[] getAllImplementsTypeDeclarations()
- Specified by:
getAllImplementsTypeDeclarations
in interfaceITypeDeclaration
-
isComponentType
public boolean isComponentType()
- Specified by:
isComponentType
in interfaceITypeDeclaration
-
getPropertyCache
public DynType getPropertyCache()
- Specified by:
getPropertyCache
in interfaceITypeDeclaration
-
validate
public void validate()
- Specified by:
validate
in interfaceILifecycle
- Overrides:
validate
in classSemanticNode
-
isValidated
public boolean isValidated()
- Specified by:
isValidated
in interfaceILifecycle
- Specified by:
isValidated
in interfaceISemanticNode
- Overrides:
isValidated
in classSemanticNode
-
stop
public void stop()
- Specified by:
stop
in interfaceILifecycle
- Overrides:
stop
in classSemanticNode
-
isAssignableFrom
public boolean isAssignableFrom(ITypeDeclaration other, boolean assignmentSemantics)
- Specified by:
isAssignableFrom
in interfaceITypeDeclaration
-
getDerivedTypeDeclaration
public java.lang.Object getDerivedTypeDeclaration()
Description copied from interface:ITypeDeclaration
Used to retrieve the type which either a class or modify type is derived from. For a class it's the extends type. For a modify type, it's the modified type- Specified by:
getDerivedTypeDeclaration
in interfaceITypeDeclaration
-
getImplementsList
public abstract java.util.List<java.lang.Object> getImplementsList()
-
getInterfaceName
public abstract java.lang.String getInterfaceName(int ix)
-
getExtendsTypeName
public abstract java.lang.String getExtendsTypeName()
-
isEnumeratedType
public boolean isEnumeratedType()
- Specified by:
isEnumeratedType
in interfaceITypeDeclaration
-
getEnumConstant
public java.lang.Object getEnumConstant(java.lang.String nextName)
- Specified by:
getEnumConstant
in interfaceITypeDeclaration
-
isCompiledProperty
public boolean isCompiledProperty(java.lang.String name, boolean fieldMode, boolean interfaceMode)
- Specified by:
isCompiledProperty
in interfaceITypeDeclaration
-
isAssignableTo
public boolean isAssignableTo(ITypeDeclaration other)
- Specified by:
isAssignableTo
in interfaceITypeDeclaration
-
definesMethod
public java.lang.Object definesMethod(java.lang.String name, java.util.List<?> parametersOrExpressions, ITypeParamContext ctx, java.lang.Object refType, boolean isTransformed, boolean staticOnly, java.lang.Object inferredType, java.util.List<JavaType> methodTypeArgs)
- Specified by:
definesMethod
in interfaceITypeDeclaration
-
implementsType
public boolean implementsType(java.lang.String otherName, boolean assignment, boolean allowUnbound)
- Specified by:
implementsType
in interfaceITypeDeclaration
-
getInheritedAnnotation
public java.lang.Object getInheritedAnnotation(java.lang.String annotationName, boolean skipCompiled, Layer refLayer, boolean layerResolve)
Description copied from interface:ITypeDeclaration
Returns the first occurrence of the specified annotation on the types in the type hierarchy- Specified by:
getInheritedAnnotation
in interfaceITypeDeclaration
-
getAllInheritedAnnotations
public java.util.ArrayList<java.lang.Object> getAllInheritedAnnotations(java.lang.String annotationName, boolean skipCompiled, Layer refLayer, boolean layerResolve)
Description copied from interface:ITypeDeclaration
Returns all occurrences of the specified annotation on the types in the type hierarchy ordered so the first type encountered during the traversal is first.- Specified by:
getAllInheritedAnnotations
in interfaceITypeDeclaration
-
getConstructorFromSignature
public java.lang.Object getConstructorFromSignature(java.lang.String sig, boolean includeHidden)
- Specified by:
getConstructorFromSignature
in interfaceITypeDeclaration
-
getMethodFromSignature
public java.lang.Object getMethodFromSignature(java.lang.String methodName, java.lang.String signature, boolean resolveLayer)
- Specified by:
getMethodFromSignature
in interfaceITypeDeclaration
-
getTypeDeclaration
public java.lang.Object getTypeDeclaration(java.lang.String name, boolean compiledOnly)
-
getClass
public java.lang.Object getClass(java.lang.String className, boolean useImports, boolean compiledOnly)
- Specified by:
getClass
in interfaceITypeDeclaration
-
-