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 voidaddTypeParameter(TypeVariableJavaType typeVariableType)BooleancheckOverridingParameters(JavaSymbol.MethodJavaSymbol overridee, ClassJavaType classType)MethodTreedeclaration()Declaration node of this symbol.ObjectdefaultValue()ScopegetParameters()JavaSymbol.TypeJavaSymbolgetReturnType()booleanisConstructor()booleanisOverridable()booleanisParametrized()booleanisVarArgs()JavaSymbol.MethodJavaSymboloverriddenSymbol()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.TypeSymbolreturnType()voidsetMethodType(MethodJavaType methodType)Stringsignature()Compute the signature as identified from bytecode point of view.List<Type>thrownTypes()List of the exceptions that can be thrown by the method.StringtoString()ScopetypeParameters()-
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.MethodSymbolCompute the signature as identified from bytecode point of view. Will be unique for each method.- Specified by:
signaturein 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.MethodSymbolRetrieve 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:
overriddenSymbolin 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.MethodSymbolType of parameters declared by this method.- Specified by:
parameterTypesin interfaceSymbol.MethodSymbol- Returns:
- empty list if method has a zero arity.
-
returnType
public Symbol.TypeSymbol returnType()
- Specified by:
returnTypein interfaceSymbol.MethodSymbol
-
thrownTypes
public List<Type> thrownTypes()
Description copied from interface:Symbol.MethodSymbolList of the exceptions that can be thrown by the method.- Specified by:
thrownTypesin 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:SymbolDeclaration node of this symbol. Currently, only works for declaration within the same file.- Specified by:
declarationin interfaceSymbol- Specified by:
declarationin interfaceSymbol.MethodSymbol- Overrides:
declarationin 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()
-
-