Skip to content

Commit 08a7cb0

Browse files
mickaelistriarobstryker
authored andcommitted
Fix JavacMethodBinding,getMethodDeclaration()
1 parent c7f61c4 commit 08a7cb0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacMethodBinding.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ public JavacMethodBinding(MethodType methodType, MethodSymbol methodSymbol, Type
9191
}
9292

9393
public JavacMethodBinding(MethodType methodType, MethodSymbol methodSymbol, Type parentType, JavacBindingResolver resolver, boolean explicitSynthetic, boolean isDeclaration, List<Type> resolvedTypeArgs) {
94-
MethodSymbol sym = methodSymbol != null && methodSymbol.baseSymbol() instanceof MethodSymbol base && base.isVarArgs() ? base : methodSymbol;
95-
this.methodType = sym != null && sym.isVarArgs() && sym.type instanceof MethodType mt ? mt : methodType;
96-
this.methodSymbol = methodSymbol != null && methodSymbol.isVarArgs() ? (MethodSymbol)methodSymbol.baseSymbol() : methodSymbol;
94+
this.methodType = methodType != null ? methodType : (methodSymbol != null ? methodSymbol.type.asMethodType() : null);
95+
this.methodSymbol = methodSymbol;
9796
this.parentType = parentType == null && methodSymbol != null && methodSymbol.owner instanceof ClassSymbol classSymbol && JavacBindingResolver.isTypeOfType(classSymbol.type) ?
9897
classSymbol.type : parentType;
9998
this.isDeclaration = isParameterized(methodSymbol) && isDeclaration;
@@ -730,8 +729,8 @@ public IMethodBinding getMethodDeclaration() {
730729
// This method intentionally converts the type to its generic type,
731730
// i.e. drops the type arguments
732731
// i.e. <code>this.<String>getValue(12);</code> will be converted back to <code><T> T getValue(int i) {</code>
733-
MethodType mt = (this.methodSymbol == null ? this.methodType : this.methodSymbol.type.asMethodType());
734-
return this.resolver.bindings.getMethodBinding(mt, methodSymbol, null, true, null);
732+
MethodType mt = (this.methodSymbol == null ? this.methodType : this.methodSymbol.baseSymbol().type.asMethodType());
733+
return this.resolver.bindings.getMethodBinding(mt, methodSymbol != null && methodSymbol.baseSymbol() instanceof MethodSymbol base ? base : methodSymbol, null, true, null);
735734
}
736735

737736
@Override

0 commit comments

Comments
 (0)