Skip to content

Commit 313812d

Browse files
committed
Fix testMethodReferencesElementPatternMultipleTypeParameter01 in JavaSearchGenericMethodEquivalentTests
Signed-off-by: Rob Stryker <[email protected]> Fix regressions Signed-off-by: Rob Stryker <[email protected]> Fix regressions Signed-off-by: Rob Stryker <[email protected]>
1 parent b94bc73 commit 313812d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/core/search/DOMASTNodeUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,11 @@ public static IJavaElement[] getLocalOrOtherJavaElements(ASTNode node, boolean l
189189
}
190190
}
191191

192-
if (!local && node.getLocationInParent() == FieldDeclaration.TYPE_PROPERTY && node.getParent() instanceof FieldDeclaration stmt && stmt.fragments().size() > 1) {
192+
if (!local
193+
&& (node.getLocationInParent() == FieldDeclaration.TYPE_PROPERTY
194+
|| node.getLocationInParent() == FieldDeclaration.MODIFIERS_PROPERTY
195+
|| node.getLocationInParent() == FieldDeclaration.MODIFIERS2_PROPERTY)
196+
&& node.getParent() instanceof FieldDeclaration stmt && stmt.fragments().size() > 1) {
193197
return ((List<VariableDeclarationFragment>)stmt.fragments())
194198
.stream()
195199
.map(VariableDeclarationFragment::resolveBinding)

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,15 +828,19 @@ protected int resolveLevelForNodeWithMethodBinding(ASTNode messageSend,
828828
}
829829
int invocationLevel = matchMethod(messageSend, invocationBinding, skipVerif, isDecl);
830830
int declarationLevel = IMPOSSIBLE_MATCH;
831+
int invocOrDeclLevel = invocationLevel;
831832
if (invocationLevel == IMPOSSIBLE_MATCH && !isDecl) {
832833
declarationBinding = invocationBinding.getMethodDeclaration();
833834
declarationLevel = matchMethod(messageSend, declarationBinding, skipVerif, true);
834835
if (declarationLevel == IMPOSSIBLE_MATCH)
835836
return IMPOSSIBLE_MATCH;
836837
invocationOrDeclarationBinding = declarationBinding;
838+
invocOrDeclLevel = invocationLevel == IMPOSSIBLE_MATCH ? declarationLevel : invocationLevel;
839+
if( !invocationBinding.isRawMethod() && this.locator.pattern.hasTypeParameters()) {
840+
invocOrDeclLevel = findWeakerLevel(invocOrDeclLevel, ERASURE_MATCH);
841+
}
837842
}
838843

839-
int invocOrDeclLevel = invocationLevel == IMPOSSIBLE_MATCH ? declarationLevel : invocationLevel;
840844
if (invocationBinding.isRawMethod() && (this.locator.pattern.hasTypeArguments() || this.locator.pattern.hasTypeParameters())) {
841845
invocOrDeclLevel = findWeakerLevel(invocOrDeclLevel, ERASURE_MATCH);
842846
}

0 commit comments

Comments
 (0)