@Override public CharSequence extractReturnType(ExecutableElement executableElement) { if (executableElement instanceof ExecutableElementImpl) { Binding binding = ((ExecutableElementImpl) executableElement)._binding; if (binding instanceof MethodBinding) { MethodBinding methodBinding = (MethodBinding) binding; @Nullable AbstractMethodDeclaration sourceMethod = methodBinding.sourceMethod(); if (sourceMethod != null) { CharSequence rawType = getRawType(methodBinding); char[] content = sourceMethod.compilationResult.compilationUnit.getContents(); int sourceEnd = methodBinding.sourceStart();// intentionaly int sourceStart = scanForTheSourceStart(content, sourceEnd); char[] methodTest = Arrays.copyOfRange(content, sourceStart, sourceEnd); Entry<String, List<String>> extracted = SourceTypes.extract(String.valueOf(methodTest)); return SourceTypes.stringify( Maps.immutableEntry(rawType.toString(), extracted.getValue())); } } } return UNABLE_TO_EXTRACT; }
public void finalMethodCannotBeOverridden(MethodBinding currentMethod, MethodBinding inheritedMethod) { this.handle( // Cannot override the final method from %1 // 8.4.3.3 - Final methods cannot be overridden or hidden. IProblem.FinalMethodCannotBeOverridden, new String[] {new String(inheritedMethod.declaringClass.readableName())}, new String[] {new String(inheritedMethod.declaringClass.shortReadableName())}, currentMethod.sourceStart(), currentMethod.sourceEnd()); } public void finalVariableBound(TypeVariableBinding typeVariable, TypeReference typeRef) {
public void visibilityConflict(MethodBinding currentMethod, MethodBinding inheritedMethod) { this.handle( // Cannot reduce the visibility of the inherited method from %1 // 8.4.6.3 - The access modifier of an hiding method must provide at least as much access as the hidden method. // 8.4.6.3 - The access modifier of an overiding method must provide at least as much access as the overriden method. IProblem.MethodReducesVisibility, new String[] {new String(inheritedMethod.declaringClass.readableName())}, new String[] {new String(inheritedMethod.declaringClass.shortReadableName())}, currentMethod.sourceStart(), currentMethod.sourceEnd()); } public void wildcardAssignment(TypeBinding variableType, TypeBinding expressionType, ASTNode location) {
public void visibilityConflict(MethodBinding currentMethod, MethodBinding inheritedMethod) { this.handle( // Cannot reduce the visibility of the inherited method from %1 // 8.4.6.3 - The access modifier of an hiding method must provide at least as much access as the hidden method. // 8.4.6.3 - The access modifier of an overiding method must provide at least as much access as the overriden method. IProblem.MethodReducesVisibility, new String[] {new String(inheritedMethod.declaringClass.readableName())}, new String[] {new String(inheritedMethod.declaringClass.shortReadableName())}, currentMethod.sourceStart(), currentMethod.sourceEnd()); } public void wildcardAssignment(TypeBinding variableType, TypeBinding expressionType, ASTNode location) {
public void finalMethodCannotBeOverridden(MethodBinding currentMethod, MethodBinding inheritedMethod) { this.handle( // Cannot override the final method from %1 // 8.4.3.3 - Final methods cannot be overridden or hidden. IProblem.FinalMethodCannotBeOverridden, new String[] {new String(inheritedMethod.declaringClass.readableName())}, new String[] {new String(inheritedMethod.declaringClass.shortReadableName())}, currentMethod.sourceStart(), currentMethod.sourceEnd()); } public void finalVariableBound(TypeVariableBinding typeVariable, TypeReference typeRef) {
public void visibilityConflict(MethodBinding currentMethod, MethodBinding inheritedMethod) { this.handle( // Cannot reduce the visibility of the inherited method from %1 // 8.4.6.3 - The access modifier of an hiding method must provide at least as much access as the hidden method. // 8.4.6.3 - The access modifier of an overiding method must provide at least as much access as the overriden method. IProblem.MethodReducesVisibility, new String[] {new String(inheritedMethod.declaringClass.readableName())}, new String[] {new String(inheritedMethod.declaringClass.shortReadableName())}, currentMethod.sourceStart(), currentMethod.sourceEnd()); } public void wildcardAssignment(TypeBinding variableType, TypeBinding expressionType, ASTNode location) {
public void finalMethodCannotBeOverridden(MethodBinding currentMethod, MethodBinding inheritedMethod) { this.handle( // Cannot override the final method from %1 // 8.4.3.3 - Final methods cannot be overridden or hidden. IProblem.FinalMethodCannotBeOverridden, new String[] {new String(inheritedMethod.declaringClass.readableName())}, new String[] {new String(inheritedMethod.declaringClass.shortReadableName())}, currentMethod.sourceStart(), currentMethod.sourceEnd()); } public void finalVariableBound(TypeVariableBinding typeVariable, TypeReference typeRef) {
public void visibilityConflict(MethodBinding currentMethod, MethodBinding inheritedMethod) { this.handle( // Cannot reduce the visibility of the inherited method from %1 // 8.4.6.3 - The access modifier of an hiding method must provide at least as much access as the hidden method. // 8.4.6.3 - The access modifier of an overiding method must provide at least as much access as the overriden method. IProblem.MethodReducesVisibility, new String[] {new String(inheritedMethod.declaringClass.readableName())}, new String[] {new String(inheritedMethod.declaringClass.shortReadableName())}, currentMethod.sourceStart(), currentMethod.sourceEnd()); } public void wildcardAssignment(TypeBinding variableType, TypeBinding expressionType, ASTNode location) {
public void finalMethodCannotBeOverridden(MethodBinding currentMethod, MethodBinding inheritedMethod) { this.handle( // Cannot override the final method from %1 // 8.4.3.3 - Final methods cannot be overridden or hidden. IProblem.FinalMethodCannotBeOverridden, new String[] {new String(inheritedMethod.declaringClass.readableName())}, new String[] {new String(inheritedMethod.declaringClass.shortReadableName())}, currentMethod.sourceStart(), currentMethod.sourceEnd()); } public void finalVariableBound(TypeVariableBinding typeVariable, TypeReference typeRef) {
public void visibilityConflict(MethodBinding currentMethod, MethodBinding inheritedMethod) { this.handle( // Cannot reduce the visibility of the inherited method from %1 // 8.4.6.3 - The access modifier of an hiding method must provide at least as much access as the hidden method. // 8.4.6.3 - The access modifier of an overiding method must provide at least as much access as the overriden method. IProblem.MethodReducesVisibility, new String[] {new String(inheritedMethod.declaringClass.readableName())}, new String[] {new String(inheritedMethod.declaringClass.shortReadableName())}, currentMethod.sourceStart(), currentMethod.sourceEnd()); } public void wildcardAssignment(TypeBinding variableType, TypeBinding expressionType, ASTNode location) {
public void safeVarargsOnFixedArityMethod(MethodBinding method) { String [] arguments = new String[] { new String(method.isConstructor() ? method.declaringClass.shortReadableName() : method.selector)}; this.handle( IProblem.SafeVarargsOnFixedArityMethod, arguments, arguments, method.sourceStart(), method.sourceEnd()); } public void safeVarargsOnNonFinalInstanceMethod(MethodBinding method) {
public void safeVarargsOnNonFinalInstanceMethod(MethodBinding method) { String [] arguments = new String[] { new String(method.isConstructor() ? method.declaringClass.shortReadableName() : method.selector)}; this.handle( IProblem.SafeVarargsOnNonFinalInstanceMethod, arguments, arguments, method.sourceStart(), method.sourceEnd()); } public void possibleHeapPollutionFromVararg(AbstractVariableDeclaration vararg) {
public void safeVarargsOnFixedArityMethod(MethodBinding method) { String [] arguments = new String[] { new String(method.isConstructor() ? method.declaringClass.shortReadableName() : method.selector)}; this.handle( IProblem.SafeVarargsOnFixedArityMethod, arguments, arguments, method.sourceStart(), method.sourceEnd()); } public void safeVarargsOnNonFinalInstanceMethod(MethodBinding method) {
public void safeVarargsOnNonFinalInstanceMethod(MethodBinding method) { String [] arguments = new String[] { new String(method.isConstructor() ? method.declaringClass.shortReadableName() : method.selector)}; this.handle( IProblem.SafeVarargsOnNonFinalInstanceMethod, arguments, arguments, method.sourceStart(), method.sourceEnd()); } public void possibleHeapPollutionFromVararg(AbstractVariableDeclaration vararg) {
public void safeVarargsOnFixedArityMethod(MethodBinding method) { String [] arguments = new String[] { new String(method.isConstructor() ? method.declaringClass.shortReadableName() : method.selector)}; this.handle( IProblem.SafeVarargsOnFixedArityMethod, arguments, arguments, method.sourceStart(), method.sourceEnd()); } public void safeVarargsOnNonFinalInstanceMethod(MethodBinding method) {
public void safeVarargsOnNonFinalInstanceMethod(MethodBinding method) { String [] arguments = new String[] { new String(method.isConstructor() ? method.declaringClass.shortReadableName() : method.selector)}; this.handle( IProblem.SafeVarargsOnNonFinalInstanceMethod, arguments, arguments, method.sourceStart(), method.sourceEnd()); } public void possibleHeapPollutionFromVararg(AbstractVariableDeclaration vararg) {
public void safeVarargsOnNonFinalInstanceMethod(MethodBinding method) { String [] arguments = new String[] { new String(method.isConstructor() ? method.declaringClass.shortReadableName() : method.selector)}; this.handle( IProblem.SafeVarargsOnNonFinalInstanceMethod, arguments, arguments, method.sourceStart(), method.sourceEnd()); } public void possibleHeapPollutionFromVararg(AbstractVariableDeclaration vararg) {
public void safeVarargsOnNonFinalInstanceMethod(MethodBinding method) { String [] arguments = new String[] { new String(method.isConstructor() ? method.declaringClass.shortReadableName() : method.selector)}; this.handle( IProblem.SafeVarargsOnNonFinalInstanceMethod, arguments, arguments, method.sourceStart(), method.sourceEnd()); } public void possibleHeapPollutionFromVararg(AbstractVariableDeclaration vararg) {
public void safeVarargsOnFixedArityMethod(MethodBinding method) { String [] arguments = new String[] { new String(method.isConstructor() ? method.declaringClass.shortReadableName() : method.selector)}; this.handle( IProblem.SafeVarargsOnFixedArityMethod, arguments, arguments, method.sourceStart(), method.sourceEnd()); } public void safeVarargsOnNonFinalInstanceMethod(MethodBinding method) {
public void safeVarargsOnNonFinalInstanceMethod(MethodBinding method) { String [] arguments = new String[] { new String(method.isConstructor() ? method.declaringClass.shortReadableName() : method.selector)}; this.handle( IProblem.SafeVarargsOnNonFinalInstanceMethod, arguments, arguments, method.sourceStart(), method.sourceEnd()); } public void possibleHeapPollutionFromVararg(AbstractVariableDeclaration vararg) {