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.CompilationUnitTreeprotected IJavaClassConstructor[]protected JavaSourceTypeprivate Object[]protected IJavaClassField[]private ISourceFileHandleprotected Stringprotected IJavaClassType[]protected IJavaClassTypeprotected IModuleprotected IJavaClassInfo[]protected IJavaClassInfo[]private ITypeprivate IJavaMethodDescriptor[]protected IJavaClassMethod[]protected JavaSourceModifierListprotected Stringprivate IJavaPropertyDescriptor[]protected Stringprivate com.sun.source.util.SourcePositionsprivate IJavaClassInfoprivate com.sun.source.tree.ClassTreeprotected IJavaClassTypeVariable[]private static final Objectstatic final intstatic final intstatic final intFields inherited from interface gw.lang.reflect.java.IJavaClassInfo
LOCKFields inherited from interface gw.lang.reflect.java.IJavaClassType
EMPTY_ARRAY, ERROR_TYPE, NULL_TYPE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJavaSourceType(com.sun.source.tree.ClassTree typeDecl, JavaSourceType enclosingClass) For inner classes.protectedJavaSourceType(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 JavaSourceTypecreateInner(com.sun.source.tree.ClassTree typeDecl, JavaSourceType containingClass) static IJavaClassInfocreateTopLevel(ISourceFileHandle fileHandle, IModule gosuModule) static IJavaClassInfocreateTopLevel(ISourceFileHandle fileHandle, IModule gosuModule, DiagnosticCollector<JavaFileObject> errorHandler) static IJavaClassTypecreateType(ITypeInfoResolver typeResolver, com.sun.source.tree.Tree tree) static IJavaClassTypecreateType(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 ObjectgetCachedDetectCyclicType(String relativeName) private IJavaClassInfogetClassInfo(String fqn) com.sun.source.tree.CompilationUnitTreegetConstructor(IJavaClassInfo... paramTypes) Returns all annotations that are directly present on this element.getDeclaredMethod(String methodName, IJavaClassInfo... paramTypes) getDeepestClassAtOffset(int offset) intObject[]getInnerClass(String relativeName) private StringgetMethod(String methodName, IJavaClassInfo... paramTypes) intgetName()com.sun.source.util.SourcePositionsintprivate static com.sun.source.tree.ClassTreegetTopLevelDefinition(List<com.sun.source.tree.CompilationUnitTree> trees, String relativeName) com.sun.source.tree.ClassTreegetTree()static StringgetTypeName(com.sun.source.tree.Tree tree) booleanprivate booleanhasCyclicInheritance(IJavaClassInfo superClass) voidbooleanbooleanisAnnotationPresent(Class<? extends Annotation> annotationClass) Returns true if an annotation for the specified type is present on this element, else false.booleanisArray()booleanisClass()booleanbooleanisEnum()booleanbooleanbooleanbooleanbooleanbooleanbooleanisPublic()booleanisVisibleViaFeatureDescriptor(IScriptabilityModifier constraint) protected voidmakeImportList(List<? extends com.sun.source.tree.ImportTree> imports) private IJavaClassInfoprivate static booleanparseJavaFile(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 IJavaClassTyperesolveClassInSamePackage(String relativeName) resolveImport(String relativeName) private static IJavaClassTyperesolveParameterizedArrayType(ITypeInfoResolver typeResolver, com.sun.source.tree.Tree tree, String typeName) private static IJavaClassTyperesolveParameterizedType(ITypeInfoResolver typeResolver, com.sun.source.tree.Tree typeNode, String typeName) private IJavaClassTyperesolveQualifiedOrSemiQualifiedType(String typeName, IJavaClassInfo whosAskin, int iDot, int ignoreFlags) private IJavaClassTyperesolveRootQualifiedType(String qname) private IJavaClassTyperesolveTrailingInnerClass(IJavaClassType rootType, String fullNameIncludingRoot, IJavaClassInfo whosAskin) resolveType(String relativeName, int ignoreFlags) resolveType(String relativeName, IJavaClassInfo whosAskin, int ignoreFlags) voidsetJavaType(IJavaType javaType) toString()Methods inherited from class gw.lang.reflect.java.AbstractJavaClassInfo
equals, equals, hashCode, hashCode, isAssignableFrom, isAssignableFromMethods inherited from class gw.lang.reflect.java.JavaSourceElement
findInnerSourceType, getLocationInfoMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface gw.lang.reflect.java.IJavaAnnotatedElement
getLocationInfoMethods inherited from interface gw.lang.reflect.java.IJavaClassInfo
getDeclaredField, getFieldMethods 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:
getModulein interfaceIJavaClassType- Specified by:
getModulein interfaceITypeInfoResolver
-
getNameSignature
- Specified by:
getNameSignaturein interfaceIJavaClassInfo
-
getRelativeName
- Specified by:
getRelativeNamein interfaceIJavaClassInfo
-
getDisplayName
- Specified by:
getDisplayNamein interfaceIJavaClassInfo
-
getSimpleName
- Specified by:
getSimpleNamein interfaceIJavaClassType
-
isArray
public boolean isArray()- Specified by:
isArrayin interfaceIJavaClassInfo- Specified by:
isArrayin interfaceIJavaClassType
-
getName
- Specified by:
getNamein interfaceIJavaClassType
-
getInterfaces
- Specified by:
getInterfacesin interfaceIJavaClassInfo
-
getTypeName
-
getGenericInterfaces
- Specified by:
getGenericInterfacesin interfaceIJavaClassInfo
-
getSuperclass
- Specified by:
getSuperclassin interfaceIJavaClassInfo
-
hasCyclicInheritance
-
getGenericSuperclass
- Specified by:
getGenericSuperclassin interfaceIJavaClassInfo
-
initMethodsAndConstructors
public void initMethodsAndConstructors() -
getDeclaredMethods
- Specified by:
getDeclaredMethodsin interfaceIJavaClassInfo
-
getDeclaredConstructors
- Specified by:
getDeclaredConstructorsin interfaceIJavaClassInfo
-
getConstructor
public IJavaClassConstructor getConstructor(IJavaClassInfo... paramTypes) throws NoSuchMethodException - Specified by:
getConstructorin interfaceIJavaClassInfo- Throws:
NoSuchMethodException
-
getDeclaredFields
- Specified by:
getDeclaredFieldsin interfaceIJavaClassInfo
-
getFields
- Specified by:
getFieldsin interfaceIJavaClassInfo
-
getEnumConstants
- Specified by:
getEnumConstantsin interfaceIJavaClassInfo
-
getPropertyDescriptors
- Specified by:
getPropertyDescriptorsin interfaceIJavaClassInfo
-
getJavaType
- Specified by:
getJavaTypein interfaceIJavaClassInfo
-
setJavaType
-
getTypeParameters
- Specified by:
getTypeParametersin interfaceIJavaClassInfo
-
createClassDocNode
- Specified by:
createClassDocNodein interfaceIJavaClassInfo
-
hasCustomBeanInfo
public boolean hasCustomBeanInfo()- Specified by:
hasCustomBeanInfoin interfaceIJavaClassInfo
-
isVisibleViaFeatureDescriptor
- Specified by:
isVisibleViaFeatureDescriptorin interfaceIJavaClassInfo
-
isHiddenViaFeatureDescriptor
public boolean isHiddenViaFeatureDescriptor()- Specified by:
isHiddenViaFeatureDescriptorin interfaceIJavaClassInfo
-
getComponentType
- Specified by:
getComponentTypein interfaceIJavaClassInfo- Specified by:
getComponentTypein interfaceIJavaClassType
-
getModifiers
public int getModifiers()- Specified by:
getModifiersin interfaceIJavaClassInfo
-
getModifierList
-
getEnclosingType
- Specified by:
getEnclosingTypein interfaceIJavaClassInfo
-
getNamespace
- Specified by:
getNamespacein interfaceIJavaClassType
-
getArrayType
- Specified by:
getArrayTypein interfaceIJavaClassInfo
-
getDeclaredClasses
- Specified by:
getDeclaredClassesin interfaceIJavaClassInfo
-
getBackingClass
- Specified by:
getBackingClassin interfaceIJavaClassInfo
-
getJavaName
-
getInnerClass
-
getActualType
- Specified by:
getActualTypein interfaceIJavaClassType
-
getActualType
- Specified by:
getActualTypein interfaceIJavaClassType
-
getConcreteType
- Specified by:
getConcreteTypein interfaceIJavaClassType
-
isClass
public boolean isClass() -
isInterface
public boolean isInterface()- Specified by:
isInterfacein interfaceIJavaClassInfo
-
newInstance
- Specified by:
newInstancein interfaceIJavaClassInfo- Throws:
InstantiationExceptionIllegalAccessException
-
getMethod
public IJavaClassMethod getMethod(String methodName, IJavaClassInfo... paramTypes) throws NoSuchMethodException - Specified by:
getMethodin interfaceIJavaClassInfo- Throws:
NoSuchMethodException
-
getDeclaredMethod
public IJavaClassMethod getDeclaredMethod(String methodName, IJavaClassInfo... paramTypes) throws NoSuchMethodException - Specified by:
getDeclaredMethodin interfaceIJavaClassInfo- Throws:
NoSuchMethodException
-
getMethodDescriptors
- Specified by:
getMethodDescriptorsin interfaceIJavaClassInfo
-
isEnum
public boolean isEnum()- Specified by:
isEnumin interfaceIJavaClassInfo
-
isPrimitive
public boolean isPrimitive()- Specified by:
isPrimitivein interfaceIJavaClassInfo
-
isAnnotation
public boolean isAnnotation()- Specified by:
isAnnotationin interfaceIJavaClassInfo
-
isPublic
public boolean isPublic()- Specified by:
isPublicin interfaceIJavaClassInfo
-
isProtected
public boolean isProtected()- Specified by:
isProtectedin interfaceIJavaClassInfo
-
isPrivate
public boolean isPrivate()- Specified by:
isPrivatein interfaceIJavaClassInfo
-
isInternal
public boolean isInternal()- Specified by:
isInternalin interfaceIJavaClassInfo
-
resolveType
- Specified by:
resolveTypein interfaceITypeInfoResolver
-
resolveType
- Specified by:
resolveTypein 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:
resolveImportin interfaceITypeInfoResolver
-
getEnclosingClass
- Specified by:
getEnclosingClassin interfaceIJavaAnnotatedElement- Specified by:
getEnclosingClassin classJavaSourceElement
-
getDeclaringClass
- Overrides:
getDeclaringClassin classJavaSourceElement
-
getDeepestClassAtOffset
- Specified by:
getDeepestClassAtOffsetin interfaceIJavaClassInfo
-
toString
-
isAnnotationPresent
Description copied from interface:IJavaAnnotatedElementReturns 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:
isAnnotationPresentin 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:IJavaAnnotatedElementReturns this element's annotation for the specified type if such an annotation is present, else null.- Specified by:
getAnnotationin 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:IJavaAnnotatedElementReturns 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:
getDeclaredAnnotationsin interfaceIJavaAnnotatedElement- Returns:
- All annotations directly present on this element
-
getTypeUsesMap
-
getImportList
-
getStaticImports
-
getSourceFileHandle
- Specified by:
getSourceFileHandlein interfaceIJavaClassInfo
-
isCompilable
public boolean isCompilable()- Specified by:
isCompilablein interfaceIJavaClassInfo
-
compile
public byte[] compile()- Specified by:
compilein interfaceIJavaClassInfo
-
getTree
public com.sun.source.tree.ClassTree getTree()- Specified by:
getTreein classJavaSourceElement
-
getCompilationUnitTree
public com.sun.source.tree.CompilationUnitTree getCompilationUnitTree()- Overrides:
getCompilationUnitTreein classJavaSourceElement
-
getSourcePositions
public com.sun.source.util.SourcePositions getSourcePositions()- Overrides:
getSourcePositionsin classJavaSourceElement
-
getStartPosition
public int getStartPosition()- Overrides:
getStartPositionin classJavaSourceElement
-
getEndPosition
public int getEndPosition()- Overrides:
getEndPositionin classJavaSourceElement
-