From dbbbe2136ba05bdb0f5102f7c426af3ddd055ac2 Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Fri, 11 Oct 2024 15:56:59 -0400 Subject: [PATCH] Fix test0080 - generics vs raw vs parameterized Signed-off-by: Rob Stryker --- .../javac/dom/JavacMethodBinding.java | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacMethodBinding.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacMethodBinding.java index 784fbf42dc4..40011a0a37d 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacMethodBinding.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacMethodBinding.java @@ -521,16 +521,32 @@ public boolean isAnnotationMember() { @Override public boolean isGenericMethod() { - return (isConstructor() && getDeclaringClass().isGenericType()) + if( methodHasGenerics() ) { + return true; + } + // instead of the methodType, get a less typed Type and check if it is a ForAll + if( this.methodSymbol.type instanceof ForAll) { + return !methodMatchesParameterized(); + } + return false; + } + + private boolean methodHasGenerics() { + boolean b1 = (isConstructor() && getDeclaringClass().isGenericType()) || (!this.methodSymbol.getTypeParameters().isEmpty() && isDeclaration); - // TODO instead of the methodType, get a less typed Type and check if it is a ForAll + return b1; } + @Override public boolean isParameterizedMethod() { - return !isGenericMethod() && - ((isConstructor() && getDeclaringClass().isParameterizedType()) - || (!this.methodSymbol.getTypeParameters().isEmpty() && !isDeclaration)); + return !methodHasGenerics() && methodMatchesParameterized(); + } + + private boolean methodMatchesParameterized() { + return ((isConstructor() && getDeclaringClass().isParameterizedType()) + || (!this.methodSymbol.getTypeParameters().isEmpty() && !isDeclaration)); } + @Override public boolean isRawMethod() { if (isConstructor()) {