Package org.sonar.java.resolve
Class JavaSymbol.MethodJavaSymbol
- java.lang.Object
-
- org.sonar.java.resolve.JavaSymbol
-
- org.sonar.java.resolve.JavaSymbol.MethodJavaSymbol
-
- All Implemented Interfaces:
Symbol
,Symbol.MethodSymbol
- Enclosing class:
- JavaSymbol
public static class JavaSymbol.MethodJavaSymbol extends JavaSymbol implements Symbol.MethodSymbol
Represents a method, constructor or initializer (static or instance).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.sonar.java.resolve.JavaSymbol
JavaSymbol.JavaLabelSymbol, JavaSymbol.MethodJavaSymbol, JavaSymbol.PackageJavaSymbol, JavaSymbol.TypeJavaSymbol, JavaSymbol.TypeVariableJavaSymbol, JavaSymbol.VariableJavaSymbol, 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 MethodJavaSymbol(int flags, String name, JavaSymbol owner)
MethodJavaSymbol(int flags, String name, JavaType type, JavaSymbol owner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTypeParameter(TypeVariableJavaType typeVariableType)
Boolean
checkOverridingParameters(JavaSymbol.MethodJavaSymbol overridee, ClassJavaType classType)
MethodTree
declaration()
Declaration node of this symbol.Object
defaultValue()
Scope
getParameters()
JavaSymbol.TypeJavaSymbol
getReturnType()
boolean
isConstructor()
boolean
isOverridable()
boolean
isParametrized()
boolean
isVarArgs()
JavaSymbol.MethodJavaSymbol
overriddenSymbol()
Retrieve the overridden symbol, which may may not be able to determine (returning 'unknown' symbol).List<Type>
parameterTypes()
Type of parameters declared by this method.Symbol.TypeSymbol
returnType()
void
setMethodType(MethodJavaType methodType)
String
signature()
Compute the signature as identified from bytecode point of view.List<Type>
thrownTypes()
List of the exceptions that can be thrown by the method.String
toString()
Scope
typeParameters()
-
Methods inherited from class org.sonar.java.resolve.JavaSymbol
addUsage, callbackOnceComplete, complete, enclosingClass, flags, getName, getType, isAbstract, isAnnotation, isDefault, isDeprecated, isEnum, isFinal, isFlag, isInterface, isMethodSymbol, isPackageSymbol, isPackageVisibility, isPrivate, isProtected, isPublic, isStatic, isTypeSymbol, isUnknown, isVariableSymbol, isVolatile, metadata, name, outermostClass, owner, packge, type, usages
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.sonar.plugins.java.api.semantic.Symbol
enclosingClass, isAbstract, isDeprecated, isEnum, isFinal, isInterface, isMethodSymbol, isPackageSymbol, isPackageVisibility, isPrivate, isProtected, isPublic, isStatic, isTypeSymbol, isUnknown, isVariableSymbol, isVolatile, metadata, name, owner, type, usages
-
-
-
-
Constructor Detail
-
MethodJavaSymbol
public MethodJavaSymbol(int flags, String name, JavaType type, JavaSymbol owner)
-
MethodJavaSymbol
public MethodJavaSymbol(int flags, String name, JavaSymbol owner)
-
-
Method Detail
-
signature
public String signature()
Description copied from interface:Symbol.MethodSymbol
Compute the signature as identified from bytecode point of view. Will be unique for each method.- Specified by:
signature
in interfaceSymbol.MethodSymbol
- Returns:
- the signature of the method, as String
-
getReturnType
public JavaSymbol.TypeJavaSymbol getReturnType()
-
getParameters
public Scope getParameters()
-
typeParameters
public Scope typeParameters()
-
setMethodType
public void setMethodType(MethodJavaType methodType)
-
overriddenSymbol
@Nullable public JavaSymbol.MethodJavaSymbol overriddenSymbol()
Description copied from interface:Symbol.MethodSymbol
Retrieve the overridden symbol, which may may not be able to determine (returning 'unknown' symbol). Note that if the method returns null, the method is not overriding any method for sure.- Specified by:
overriddenSymbol
in interfaceSymbol.MethodSymbol
- Returns:
- the overridden symbol, unknown if overriding can not be determined (incomplete semantic), or null if the method is not overriding any method
-
checkOverridingParameters
@CheckForNull public Boolean checkOverridingParameters(JavaSymbol.MethodJavaSymbol overridee, ClassJavaType classType)
-
isVarArgs
public boolean isVarArgs()
-
isConstructor
public boolean isConstructor()
-
addTypeParameter
public void addTypeParameter(TypeVariableJavaType typeVariableType)
-
parameterTypes
public List<Type> parameterTypes()
Description copied from interface:Symbol.MethodSymbol
Type of parameters declared by this method.- Specified by:
parameterTypes
in interfaceSymbol.MethodSymbol
- Returns:
- empty list if method has a zero arity.
-
returnType
public Symbol.TypeSymbol returnType()
- Specified by:
returnType
in interfaceSymbol.MethodSymbol
-
thrownTypes
public List<Type> thrownTypes()
Description copied from interface:Symbol.MethodSymbol
List of the exceptions that can be thrown by the method.- Specified by:
thrownTypes
in interfaceSymbol.MethodSymbol
- Returns:
- empty list if no exception are declared in the throw clause of the method.
-
declaration
public MethodTree 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
- Specified by:
declaration
in interfaceSymbol.MethodSymbol
- Overrides:
declaration
in classJavaSymbol
- Returns:
- the Tree of the declaration of this symbol. Null if declaration does not occur in the currently analyzed file.
-
isOverridable
public boolean isOverridable()
-
isParametrized
public boolean isParametrized()
-
defaultValue
@CheckForNull public Object defaultValue()
-
-