Package org.sonar.java.resolve
Class JavaSymbol
- java.lang.Object
-
- org.sonar.java.resolve.JavaSymbol
-
- All Implemented Interfaces:
Symbol
- Direct Known Subclasses:
JavaSymbol.JavaLabelSymbol
,JavaSymbol.MethodJavaSymbol
,JavaSymbol.PackageJavaSymbol
,JavaSymbol.TypeJavaSymbol
,JavaSymbol.VariableJavaSymbol
,Resolve.AccessErrorJavaSymbol
,Resolve.AmbiguityErrorJavaSymbol
,Resolve.JavaSymbolNotFound
public class JavaSymbol extends Object implements Symbol
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JavaSymbol.JavaLabelSymbol
static class
JavaSymbol.MethodJavaSymbol
Represents a method, constructor or initializer (static or instance).static class
JavaSymbol.PackageJavaSymbol
Represents package.static class
JavaSymbol.TypeJavaSymbol
Represents a class, interface, enum or annotation type.static class
JavaSymbol.TypeVariableJavaSymbol
Represents type variable of a parametrized type ie: T in class Foo{} static class
JavaSymbol.VariableJavaSymbol
Represents a field, enum constant, method or constructor parameter, local variable, resource variable or exception parameter.static class
JavaSymbol.WildcardSymbol
-
Nested classes/interfaces inherited from interface org.sonar.plugins.java.api.semantic.Symbol
Symbol.LabelSymbol, Symbol.MethodSymbol, Symbol.TypeSymbol, Symbol.VariableSymbol
-
-
Constructor Summary
Constructors Constructor Description JavaSymbol(int kind, int flags, String name, JavaSymbol owner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUsage(IdentifierTree tree)
void
callbackOnceComplete(Runnable callback)
void
complete()
Tree
declaration()
Declaration node of this symbol.JavaSymbol.TypeJavaSymbol
enclosingClass()
The closest enclosing class.int
flags()
String
getName()
JavaType
getType()
boolean
isAbstract()
boolean
isAnnotation()
boolean
isDefault()
boolean
isDeprecated()
boolean
isEnum()
boolean
isFinal()
protected boolean
isFlag(int flag)
boolean
isInterface()
boolean
isMethodSymbol()
boolean
isPackageSymbol()
boolean
isPackageVisibility()
boolean
isPrivate()
boolean
isProtected()
boolean
isPublic()
boolean
isStatic()
boolean
isTypeSymbol()
boolean
isUnknown()
boolean
isVariableSymbol()
boolean
isVolatile()
SymbolMetadataResolve
metadata()
Symbol metadata informations, annotations for instance.String
name()
Name of this symbol.JavaSymbol.TypeJavaSymbol
outermostClass()
The outermost class which indirectly owns this symbol.JavaSymbol
owner()
The owner of this symbol.JavaSymbol.PackageJavaSymbol
packge()
The package which indirectly owns this symbol.Type
type()
Type of symbol.List<IdentifierTree>
usages()
The identifier trees that reference this symbol.
-
-
-
Field Detail
-
PCK
public static final int PCK
- See Also:
- Constant Field Values
-
TYP
public static final int TYP
- See Also:
- Constant Field Values
-
VAR
public static final int VAR
- See Also:
- Constant Field Values
-
MTH
public static final int MTH
- See Also:
- Constant Field Values
-
ERRONEOUS
public static final int ERRONEOUS
- See Also:
- Constant Field Values
-
AMBIGUOUS
public static final int AMBIGUOUS
- See Also:
- Constant Field Values
-
ABSENT
public static final int ABSENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JavaSymbol
public JavaSymbol(int kind, int flags, @Nullable String name, @Nullable JavaSymbol owner)
-
-
Method Detail
-
flags
public int flags()
- See Also:
Flags
-
owner
public JavaSymbol owner()
Description copied from interface:Symbol
The owner of this symbol.
-
getName
public String getName()
-
metadata
public SymbolMetadataResolve metadata()
Description copied from interface:Symbol
Symbol metadata informations, annotations for instance.
-
complete
public void complete()
-
outermostClass
public JavaSymbol.TypeJavaSymbol outermostClass()
The outermost class which indirectly owns this symbol.
-
packge
public JavaSymbol.PackageJavaSymbol packge()
The package which indirectly owns this symbol.
-
enclosingClass
public JavaSymbol.TypeJavaSymbol enclosingClass()
The closest enclosing class.- Specified by:
enclosingClass
in interfaceSymbol
- Returns:
- null for package symbols, themselves for type symbol and enclosing class of methods or variables.
-
getType
public JavaType getType()
-
isVariableSymbol
public boolean isVariableSymbol()
- Specified by:
isVariableSymbol
in interfaceSymbol
-
isTypeSymbol
public boolean isTypeSymbol()
- Specified by:
isTypeSymbol
in interfaceSymbol
-
isMethodSymbol
public boolean isMethodSymbol()
- Specified by:
isMethodSymbol
in interfaceSymbol
-
isPackageSymbol
public boolean isPackageSymbol()
- Specified by:
isPackageSymbol
in interfaceSymbol
-
isInterface
public boolean isInterface()
- Specified by:
isInterface
in interfaceSymbol
-
isAnnotation
public boolean isAnnotation()
-
isAbstract
public boolean isAbstract()
- Specified by:
isAbstract
in interfaceSymbol
-
isProtected
public boolean isProtected()
- Specified by:
isProtected
in interfaceSymbol
-
isDeprecated
public boolean isDeprecated()
- Specified by:
isDeprecated
in interfaceSymbol
-
isVolatile
public boolean isVolatile()
- Specified by:
isVolatile
in interfaceSymbol
-
isDefault
public boolean isDefault()
-
isFlag
protected boolean isFlag(int flag)
-
isPackageVisibility
public boolean isPackageVisibility()
- Specified by:
isPackageVisibility
in interfaceSymbol
-
addUsage
public void addUsage(IdentifierTree tree)
-
usages
public List<IdentifierTree> usages()
Description copied from interface:Symbol
The identifier trees that reference this symbol.
-
declaration
@Nullable public Tree declaration()
Description copied from interface:Symbol
Declaration node of this symbol. Currently, only works for declaration within the same file.- Specified by:
declaration
in interfaceSymbol
- Returns:
- the Tree of the declaration of this symbol. Null if declaration does not occur in the currently analyzed file.
-
callbackOnceComplete
public void callbackOnceComplete(Runnable callback)
-
-