Class JavaSourceType
java.lang.Object
gw.lang.reflect.java.JavaSourceElement
gw.lang.reflect.java.AbstractJavaClassInfo
gw.internal.gosu.parser.java.classinfo.JavaSourceType
- All Implemented Interfaces:
IJavaAnnotatedElement
,IJavaClassInfo
,IJavaClassType
,ITypeInfoResolver
,Serializable
- Direct Known Subclasses:
JavaSourceAnnotation
,JavaSourceClass
,JavaSourceEnum
,JavaSourceInterface
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface gw.lang.reflect.java.IJavaClassInfo
IJavaClassInfo.Util
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate IJavaClassField[]
private com.sun.source.tree.CompilationUnitTree
protected IJavaClassConstructor[]
protected JavaSourceType
private Object[]
protected IJavaClassField[]
private ISourceFileHandle
protected String
protected IJavaClassType[]
protected IJavaClassType
protected IModule
protected IJavaClassInfo[]
protected IJavaClassInfo[]
private IType
private IJavaMethodDescriptor[]
protected IJavaClassMethod[]
protected JavaSourceModifierList
protected String
private IJavaPropertyDescriptor[]
protected String
private com.sun.source.util.SourcePositions
private IJavaClassInfo
private com.sun.source.tree.ClassTree
protected IJavaClassTypeVariable[]
private static final Object
static final int
static final int
static final int
Fields inherited from interface gw.lang.reflect.java.IJavaClassInfo
LOCK
Fields inherited from interface gw.lang.reflect.java.IJavaClassType
EMPTY_ARRAY, ERROR_TYPE, NULL_TYPE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
JavaSourceType
(com.sun.source.tree.ClassTree typeDecl, JavaSourceType enclosingClass) For inner classes.protected
JavaSourceType
(ISourceFileHandle fileHandle, com.sun.source.tree.CompilationUnitTree compilationUnitTree, com.sun.source.tree.ClassTree typeDecl, List<? extends com.sun.source.tree.ImportTree> imports, com.sun.source.util.SourcePositions sourcePositions, IModule gosuModule) For top level classes. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
compile()
private static JavaSourceType
createInner
(com.sun.source.tree.ClassTree typeDecl, JavaSourceType containingClass) static IJavaClassInfo
createTopLevel
(ISourceFileHandle fileHandle, IModule gosuModule) static IJavaClassInfo
createTopLevel
(ISourceFileHandle fileHandle, IModule gosuModule, DiagnosticCollector<JavaFileObject> errorHandler) static IJavaClassType
createType
(ITypeInfoResolver typeResolver, com.sun.source.tree.Tree tree) static IJavaClassType
createType
(ITypeInfoResolver typeResolver, String typeName, int ignoreFlags) getActualType
(TypeVarToTypeMap typeMap) getActualType
(TypeVarToTypeMap typeMap, boolean bKeepTypeVars) getAnnotation
(Class annotationClass) Returns this element's annotation for the specified type if such an annotation is present, else null.private Object
getCachedDetectCyclicType
(String relativeName) private IJavaClassInfo
getClassInfo
(String fqn) com.sun.source.tree.CompilationUnitTree
getConstructor
(IJavaClassInfo... paramTypes) Returns all annotations that are directly present on this element.getDeclaredMethod
(String methodName, IJavaClassInfo... paramTypes) getDeepestClassAtOffset
(int offset) int
Object[]
getInnerClass
(String relativeName) private String
getMethod
(String methodName, IJavaClassInfo... paramTypes) int
getName()
com.sun.source.util.SourcePositions
int
private static com.sun.source.tree.ClassTree
getTopLevelDefinition
(List<com.sun.source.tree.CompilationUnitTree> trees, String relativeName) com.sun.source.tree.ClassTree
getTree()
static String
getTypeName
(com.sun.source.tree.Tree tree) boolean
private boolean
hasCyclicInheritance
(IJavaClassInfo superClass) void
boolean
boolean
isAnnotationPresent
(Class<? extends Annotation> annotationClass) Returns true if an annotation for the specified type is present on this element, else false.boolean
isArray()
boolean
isClass()
boolean
boolean
isEnum()
boolean
boolean
boolean
boolean
boolean
boolean
boolean
isPublic()
boolean
isVisibleViaFeatureDescriptor
(IScriptabilityModifier constraint) protected void
makeImportList
(List<? extends com.sun.source.tree.ImportTree> imports) private IJavaClassInfo
private static boolean
parseJavaFile
(ISourceFileHandle src, List<com.sun.source.tree.CompilationUnitTree> trees, com.sun.source.util.SourcePositions[] sourcePositions, DiagnosticCollector<JavaFileObject> errorHandler, com.sun.source.util.DocTrees[] docTrees) private IJavaClassType
resolveClassInSamePackage
(String relativeName) resolveImport
(String relativeName) private static IJavaClassType
resolveParameterizedArrayType
(ITypeInfoResolver typeResolver, com.sun.source.tree.Tree tree, String typeName) private static IJavaClassType
resolveParameterizedType
(ITypeInfoResolver typeResolver, com.sun.source.tree.Tree typeNode, String typeName) private IJavaClassType
resolveQualifiedOrSemiQualifiedType
(String typeName, IJavaClassInfo whosAskin, int iDot, int ignoreFlags) private IJavaClassType
resolveRootQualifiedType
(String qname) private IJavaClassType
resolveTrailingInnerClass
(IJavaClassType rootType, String fullNameIncludingRoot, IJavaClassInfo whosAskin) resolveType
(String relativeName, int ignoreFlags) resolveType
(String relativeName, IJavaClassInfo whosAskin, int ignoreFlags) void
setJavaType
(IJavaType javaType) toString()
Methods inherited from class gw.lang.reflect.java.AbstractJavaClassInfo
equals, equals, hashCode, hashCode, isAssignableFrom, isAssignableFrom
Methods inherited from class gw.lang.reflect.java.JavaSourceElement
findInnerSourceType, getLocationInfo
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface gw.lang.reflect.java.IJavaAnnotatedElement
getLocationInfo
Methods inherited from interface gw.lang.reflect.java.IJavaClassInfo
getDeclaredField, getField
Methods inherited from interface gw.lang.reflect.java.IJavaClassType
isAssignableFrom
-
Field Details
-
IGNORE_NONE
public static final int IGNORE_NONE- See Also:
-
IGNORE_INTERFACES
public static final int IGNORE_INTERFACES- See Also:
-
IGNORE_SUPERCLASS
public static final int IGNORE_SUPERCLASS- See Also:
-
PRIMITIVES
-
CACHE_MISS
-
_gosuModule
-
_fullyQualifiedName
-
_namespace
-
_simpleName
-
_importList
-
_enclosingClass
-
_fields
-
_methods
-
_modifiersList
-
_innerClasses
-
_constructors
-
_interfaces
-
_genericSuperClass
-
_typeParameters
-
_genericInterfaces
-
_allFields
-
_enumConstants
-
_propertyDescriptors
-
_superClass
-
_methodDescriptors
-
_cache
-
_fileHandle
-
_staticImportList
-
_compilationUnitTree
private com.sun.source.tree.CompilationUnitTree _compilationUnitTree -
_sourcePositions
private com.sun.source.util.SourcePositions _sourcePositions -
_typeDecl
private com.sun.source.tree.ClassTree _typeDecl -
_javaType
-
-
Constructor Details
-
JavaSourceType
protected JavaSourceType(ISourceFileHandle fileHandle, com.sun.source.tree.CompilationUnitTree compilationUnitTree, com.sun.source.tree.ClassTree typeDecl, List<? extends com.sun.source.tree.ImportTree> imports, com.sun.source.util.SourcePositions sourcePositions, IModule gosuModule) For top level classes. -
JavaSourceType
For inner classes.
-
-
Method Details
-
createTopLevel
-
createTopLevel
public static IJavaClassInfo createTopLevel(ISourceFileHandle fileHandle, IModule gosuModule, DiagnosticCollector<JavaFileObject> errorHandler) -
getTopLevelDefinition
-
parseJavaFile
private static boolean parseJavaFile(ISourceFileHandle src, List<com.sun.source.tree.CompilationUnitTree> trees, com.sun.source.util.SourcePositions[] sourcePositions, DiagnosticCollector<JavaFileObject> errorHandler, com.sun.source.util.DocTrees[] docTrees) -
createInner
private static JavaSourceType createInner(com.sun.source.tree.ClassTree typeDecl, JavaSourceType containingClass) -
resolveParameterizedArrayType
private static IJavaClassType resolveParameterizedArrayType(ITypeInfoResolver typeResolver, com.sun.source.tree.Tree tree, String typeName) -
createType
public static IJavaClassType createType(ITypeInfoResolver typeResolver, com.sun.source.tree.Tree tree) -
resolveParameterizedType
private static IJavaClassType resolveParameterizedType(ITypeInfoResolver typeResolver, com.sun.source.tree.Tree typeNode, String typeName) -
createType
public static IJavaClassType createType(ITypeInfoResolver typeResolver, String typeName, int ignoreFlags) -
makeImportList
-
getModule
- Specified by:
getModule
in interfaceIJavaClassType
- Specified by:
getModule
in interfaceITypeInfoResolver
-
getNameSignature
- Specified by:
getNameSignature
in interfaceIJavaClassInfo
-
getRelativeName
- Specified by:
getRelativeName
in interfaceIJavaClassInfo
-
getDisplayName
- Specified by:
getDisplayName
in interfaceIJavaClassInfo
-
getSimpleName
- Specified by:
getSimpleName
in interfaceIJavaClassType
-
isArray
public boolean isArray()- Specified by:
isArray
in interfaceIJavaClassInfo
- Specified by:
isArray
in interfaceIJavaClassType
-
getName
- Specified by:
getName
in interfaceIJavaClassType
-
getInterfaces
- Specified by:
getInterfaces
in interfaceIJavaClassInfo
-
getTypeName
-
getGenericInterfaces
- Specified by:
getGenericInterfaces
in interfaceIJavaClassInfo
-
getSuperclass
- Specified by:
getSuperclass
in interfaceIJavaClassInfo
-
hasCyclicInheritance
-
getGenericSuperclass
- Specified by:
getGenericSuperclass
in interfaceIJavaClassInfo
-
initMethodsAndConstructors
public void initMethodsAndConstructors() -
getDeclaredMethods
- Specified by:
getDeclaredMethods
in interfaceIJavaClassInfo
-
getDeclaredConstructors
- Specified by:
getDeclaredConstructors
in interfaceIJavaClassInfo
-
getConstructor
public IJavaClassConstructor getConstructor(IJavaClassInfo... paramTypes) throws NoSuchMethodException - Specified by:
getConstructor
in interfaceIJavaClassInfo
- Throws:
NoSuchMethodException
-
getDeclaredFields
- Specified by:
getDeclaredFields
in interfaceIJavaClassInfo
-
getFields
- Specified by:
getFields
in interfaceIJavaClassInfo
-
getEnumConstants
- Specified by:
getEnumConstants
in interfaceIJavaClassInfo
-
getPropertyDescriptors
- Specified by:
getPropertyDescriptors
in interfaceIJavaClassInfo
-
getJavaType
- Specified by:
getJavaType
in interfaceIJavaClassInfo
-
setJavaType
-
getTypeParameters
- Specified by:
getTypeParameters
in interfaceIJavaClassInfo
-
createClassDocNode
- Specified by:
createClassDocNode
in interfaceIJavaClassInfo
-
hasCustomBeanInfo
public boolean hasCustomBeanInfo()- Specified by:
hasCustomBeanInfo
in interfaceIJavaClassInfo
-
isVisibleViaFeatureDescriptor
- Specified by:
isVisibleViaFeatureDescriptor
in interfaceIJavaClassInfo
-
isHiddenViaFeatureDescriptor
public boolean isHiddenViaFeatureDescriptor()- Specified by:
isHiddenViaFeatureDescriptor
in interfaceIJavaClassInfo
-
getComponentType
- Specified by:
getComponentType
in interfaceIJavaClassInfo
- Specified by:
getComponentType
in interfaceIJavaClassType
-
getModifiers
public int getModifiers()- Specified by:
getModifiers
in interfaceIJavaClassInfo
-
getModifierList
-
getEnclosingType
- Specified by:
getEnclosingType
in interfaceIJavaClassInfo
-
getNamespace
- Specified by:
getNamespace
in interfaceIJavaClassType
-
getArrayType
- Specified by:
getArrayType
in interfaceIJavaClassInfo
-
getDeclaredClasses
- Specified by:
getDeclaredClasses
in interfaceIJavaClassInfo
-
getBackingClass
- Specified by:
getBackingClass
in interfaceIJavaClassInfo
-
getJavaName
-
getInnerClass
-
getActualType
- Specified by:
getActualType
in interfaceIJavaClassType
-
getActualType
- Specified by:
getActualType
in interfaceIJavaClassType
-
getConcreteType
- Specified by:
getConcreteType
in interfaceIJavaClassType
-
isClass
public boolean isClass() -
isInterface
public boolean isInterface()- Specified by:
isInterface
in interfaceIJavaClassInfo
-
newInstance
- Specified by:
newInstance
in interfaceIJavaClassInfo
- Throws:
InstantiationException
IllegalAccessException
-
getMethod
public IJavaClassMethod getMethod(String methodName, IJavaClassInfo... paramTypes) throws NoSuchMethodException - Specified by:
getMethod
in interfaceIJavaClassInfo
- Throws:
NoSuchMethodException
-
getDeclaredMethod
public IJavaClassMethod getDeclaredMethod(String methodName, IJavaClassInfo... paramTypes) throws NoSuchMethodException - Specified by:
getDeclaredMethod
in interfaceIJavaClassInfo
- Throws:
NoSuchMethodException
-
getMethodDescriptors
- Specified by:
getMethodDescriptors
in interfaceIJavaClassInfo
-
isEnum
public boolean isEnum()- Specified by:
isEnum
in interfaceIJavaClassInfo
-
isPrimitive
public boolean isPrimitive()- Specified by:
isPrimitive
in interfaceIJavaClassInfo
-
isAnnotation
public boolean isAnnotation()- Specified by:
isAnnotation
in interfaceIJavaClassInfo
-
isPublic
public boolean isPublic()- Specified by:
isPublic
in interfaceIJavaClassInfo
-
isProtected
public boolean isProtected()- Specified by:
isProtected
in interfaceIJavaClassInfo
-
isPrivate
public boolean isPrivate()- Specified by:
isPrivate
in interfaceIJavaClassInfo
-
isInternal
public boolean isInternal()- Specified by:
isInternal
in interfaceIJavaClassInfo
-
resolveType
- Specified by:
resolveType
in interfaceITypeInfoResolver
-
resolveType
- Specified by:
resolveType
in interfaceITypeInfoResolver
-
getCachedDetectCyclicType
-
resolveQualifiedOrSemiQualifiedType
private IJavaClassType resolveQualifiedOrSemiQualifiedType(String typeName, IJavaClassInfo whosAskin, int iDot, int ignoreFlags) -
resolveRootQualifiedType
-
getClassInfo
-
maybeLoadJavaStubIfGosuType
-
resolveTrailingInnerClass
private IJavaClassType resolveTrailingInnerClass(IJavaClassType rootType, String fullNameIncludingRoot, IJavaClassInfo whosAskin) -
resolveClassInSamePackage
-
resolveImport
- Specified by:
resolveImport
in interfaceITypeInfoResolver
-
getEnclosingClass
- Specified by:
getEnclosingClass
in interfaceIJavaAnnotatedElement
- Specified by:
getEnclosingClass
in classJavaSourceElement
-
getDeclaringClass
- Overrides:
getDeclaringClass
in classJavaSourceElement
-
getDeepestClassAtOffset
- Specified by:
getDeepestClassAtOffset
in interfaceIJavaClassInfo
-
toString
-
isAnnotationPresent
Description copied from interface:IJavaAnnotatedElement
Returns true if an annotation for the specified type is present on this element, else false. This method is designed primarily for convenient access to marker annotations.- Specified by:
isAnnotationPresent
in interfaceIJavaAnnotatedElement
- Parameters:
annotationClass
- the Class object corresponding to the annotation type- Returns:
- true if an annotation for the specified annotation type is present on this element, else false
-
getAnnotation
Description copied from interface:IJavaAnnotatedElement
Returns this element's annotation for the specified type if such an annotation is present, else null.- Specified by:
getAnnotation
in interfaceIJavaAnnotatedElement
- Parameters:
annotationClass
- the Class object corresponding to the annotation type- Returns:
- this element's annotation for the specified annotation type if present on this element, else null
-
getDeclaredAnnotations
Description copied from interface:IJavaAnnotatedElement
Returns all annotations that are directly present on this element. Unlike the other methods in this interface, this method ignores inherited annotations. (Returns an array of length zero if no annotations are directly present on this element.) The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.- Specified by:
getDeclaredAnnotations
in interfaceIJavaAnnotatedElement
- Returns:
- All annotations directly present on this element
-
getTypeUsesMap
-
getImportList
-
getStaticImports
-
getSourceFileHandle
- Specified by:
getSourceFileHandle
in interfaceIJavaClassInfo
-
isCompilable
public boolean isCompilable()- Specified by:
isCompilable
in interfaceIJavaClassInfo
-
compile
public byte[] compile()- Specified by:
compile
in interfaceIJavaClassInfo
-
getTree
public com.sun.source.tree.ClassTree getTree()- Specified by:
getTree
in classJavaSourceElement
-
getCompilationUnitTree
public com.sun.source.tree.CompilationUnitTree getCompilationUnitTree()- Overrides:
getCompilationUnitTree
in classJavaSourceElement
-
getSourcePositions
public com.sun.source.util.SourcePositions getSourcePositions()- Overrides:
getSourcePositions
in classJavaSourceElement
-
getStartPosition
public int getStartPosition()- Overrides:
getStartPosition
in classJavaSourceElement
-
getEndPosition
public int getEndPosition()- Overrides:
getEndPosition
in classJavaSourceElement
-