Skip to content

Commit 281a558

Browse files
committed
fix testStringParameterizedMultipleArguments01
Signed-off-by: Rob Stryker <[email protected]>
1 parent ba15e28 commit 281a558

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/core/search/matching/DOMTypeReferenceLocator.java

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,8 @@ private int resolveLevelForTypeBindingWithTypeArguments(ITypeBinding typeBinding
861861
ITypeBinding[] bindingArgs = typeBinding.getTypeArguments();
862862
ITypeBinding[] bindingParams = typeBinding.getTypeParameters();
863863
int bindingTypeArgsLength = bindingArgs == null ? -1 : bindingArgs.length;
864-
// Compare arguments lengths
864+
int bindingTypeParamsLength = bindingParams == null ? -1 : bindingParams.length;
865+
// First try with args if it's parameterized
865866
if (patternTypeArgsLength == bindingTypeArgsLength) {
866867
Type t = node instanceof Type ? (Type)node : null;
867868
if( t != null ) {
@@ -886,26 +887,32 @@ private int resolveLevelForTypeBindingWithTypeArguments(ITypeBinding typeBinding
886887
return ERASURE_MATCH;
887888
}
888889
return ACCURATE_MATCH;
889-
} else {
890-
if (patternTypeArgsLength==0) {
891-
return ACCURATE_MATCH;
892-
} else if (bindingTypeArgsLength==0) {
893-
// If this is an import, we have to treat it differently
890+
}
894891

895-
// pattern looking for args but binding has none.
896-
// ITypeBinding decl = typeBinding.getTypeDeclaration();
897-
// ITypeBinding[] declArgs = decl.getTypeArguments();
898-
// ITypeBinding[] declParams = decl.getTypeParameters();
899-
// raw binding is always compatible
900-
if( patternIsEquivMatch && bindingIsRaw) {
901-
return ACCURATE_MATCH;
902-
}
903-
if( !bindingIsRaw && !(patternIsEquivMatch || patternIsErasureMatch)) {
904-
return IMPOSSIBLE_MATCH;
905-
}
906-
if( !patternIsEquivMatch || bindingIsRaw)
907-
return ACCURATE_MATCH;
892+
if (patternTypeArgsLength != 0 && bindingIsGeneric && patternTypeArgsLength != bindingTypeParamsLength) {
893+
return IMPOSSIBLE_MATCH;
894+
}
895+
896+
if (patternTypeArgsLength==0) {
897+
return ACCURATE_MATCH;
898+
}
899+
900+
if (bindingTypeArgsLength==0) {
901+
// If this is an import, we have to treat it differently
902+
903+
// pattern looking for args but binding has none.
904+
// ITypeBinding decl = typeBinding.getTypeDeclaration();
905+
// ITypeBinding[] declArgs = decl.getTypeArguments();
906+
// ITypeBinding[] declParams = decl.getTypeParameters();
907+
// raw binding is always compatible
908+
if( patternIsEquivMatch && bindingIsRaw) {
909+
return ACCURATE_MATCH;
908910
}
911+
if( !bindingIsRaw && !(patternIsEquivMatch || patternIsErasureMatch)) {
912+
return IMPOSSIBLE_MATCH;
913+
}
914+
if( !patternIsEquivMatch || bindingIsRaw)
915+
return ACCURATE_MATCH;
909916
}
910917
return IMPOSSIBLE_MATCH;
911918
}

0 commit comments

Comments
 (0)