diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java index ea8ec3ec345..843123d93e5 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java @@ -181,9 +181,6 @@ ITypeBinding resolveType(EnumDeclaration enumDecl) { return null; } - /** - * TODO: we should avoid using this if possible - */ public IBinding getBinding(final Symbol owner, final com.sun.tools.javac.code.Type type) { if (owner instanceof final PackageSymbol other) { return new JavacPackageBinding(other, this); diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacMemberValuePairBinding.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacMemberValuePairBinding.java index f92cb5f6be0..e4ecc54c170 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacMemberValuePairBinding.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacMemberValuePairBinding.java @@ -29,7 +29,6 @@ public class JavacMemberValuePairBinding implements IMemberValuePairBinding { private final JavacBindingResolver resolver; public JavacMemberValuePairBinding(MethodSymbol key, Attribute value, JavacBindingResolver resolver) { - // FIXME this.method = new JavacMethodBinding(key.type.asMethodType(), key, resolver); this.value = value; this.resolver = resolver; 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 37c5023f4b3..a59363ca1d1 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 @@ -137,7 +137,7 @@ static void getKey(StringBuilder builder, MethodSymbol methodSymbol, JavacBindin ownerSymbol = ownerSymbol.owner; } if (ownerSymbol instanceof TypeSymbol ownerTypeSymbol) { - JavacTypeBinding.getKey(builder, ownerTypeSymbol.type, false, true); + JavacTypeBinding.getKey(builder, resolver.getTypes().erasure(ownerTypeSymbol.type), false); } else { throw new IllegalArgumentException("Method has no owning class"); } diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacTypeBinding.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacTypeBinding.java index f81c53abf53..a7879c98fd9 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacTypeBinding.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/dom/JavacTypeBinding.java @@ -10,9 +10,7 @@ *******************************************************************************/ package org.eclipse.jdt.internal.javac.dom; -import java.util.List; import java.util.Objects; -import java.util.stream.Collectors; import java.util.stream.StreamSupport; import javax.lang.model.type.NullType; @@ -40,7 +38,6 @@ import com.sun.tools.javac.code.Symbol.TypeVariableSymbol; import com.sun.tools.javac.code.Symbol.VarSymbol; import com.sun.tools.javac.code.Type; -import javax.lang.model.type.TypeKind; import com.sun.tools.javac.code.Type.ArrayType; import com.sun.tools.javac.code.Type.ClassType; import com.sun.tools.javac.code.Type.TypeVar; @@ -120,7 +117,7 @@ public String getKey(Type t) { return builder.toString(); } - static void getKey(StringBuilder builder, Type typeToBuild, boolean isLeaf, boolean erased) { + static void getKey(StringBuilder builder, Type typeToBuild, boolean isLeaf) { if (typeToBuild instanceof Type.JCNoType) { return; } @@ -150,7 +147,7 @@ static void getKey(StringBuilder builder, Type typeToBuild, boolean isLeaf, bool } } builder.append(typeToBuild.asElement().getQualifiedName().toString().replace('.', '/')); - if (typeToBuild.isParameterized() && !erased) { + if (typeToBuild.isParameterized()) { builder.append('<'); for (var typeArgument : typeToBuild.getTypeArguments()) { getKey(builder, typeArgument, false); @@ -182,10 +179,6 @@ static void getKey(StringBuilder builder, Type typeToBuild, boolean isLeaf, bool throw new UnsupportedOperationException("Unimplemented method 'getKey'"); } - static void getKey(StringBuilder builder, Type typeToBuild, boolean isLeaf) { - getKey(builder, typeToBuild, isLeaf, false); - } - @Override public boolean isEqualTo(final IBinding binding) { return binding instanceof final JavacTypeBinding other && // @@ -348,10 +341,9 @@ public IMethodBinding getFunctionalInterfaceMethod() { @Override public ITypeBinding[] getInterfaces() { - if (this.typeSymbol instanceof final TypeVariableSymbol typeVarSymb && this.type instanceof TypeVar tv) { - List bounds = typeVarSymb.getBounds(); + if (this.typeSymbol instanceof TypeVariableSymbol && this.type instanceof TypeVar tv) { Type t = tv.getUpperBound(); - if( t.tsym instanceof ClassSymbol cs) { + if (t.tsym instanceof ClassSymbol) { JavacTypeBinding jtb = new JavacTypeBinding(t, this.resolver); if( jtb.isInterface()) { return new ITypeBinding[] {jtb};