Skip to content

Commit 0f4407f

Browse files
committed
Treat raw method calls as ERASURE_MATCH w/ pattern has type params
1 parent 82d0277 commit 0f4407f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,9 @@ protected int resolveLevelForNodeWithMethodBinding(ASTNode messageSend,
670670
}
671671

672672
int invocOrDeclLevel = invocationLevel == IMPOSSIBLE_MATCH ? declarationLevel : invocationLevel;
673+
if (invocationBinding.isRawMethod() && (this.locator.pattern.hasTypeArguments() || this.locator.pattern.hasTypeParameters())) {
674+
invocOrDeclLevel = findWeakerLevel(invocOrDeclLevel, ERASURE_MATCH);
675+
}
673676
// receiver type
674677
if (this.pattern.declaringSimpleName == null && this.pattern.declaringQualification == null) {
675678
// since any declaring class will do
@@ -1110,7 +1113,7 @@ private IMethodBinding getMethodBindingFromPattern(AST context) {
11101113
public void reportSearchMatch(MatchLocator locator, ASTNode node, SearchMatch match) throws CoreException {
11111114
if( preferParamaterizedNode() ) {
11121115
if( node instanceof MethodInvocation iv) {
1113-
List l = iv.typeArguments();
1116+
List<?> l = iv.typeArguments();
11141117
if( l != null && l.size() > 0 ) {
11151118
int start = ((ASTNode)l.get(0)).getStartPosition();
11161119
if( start > 0 ) {

0 commit comments

Comments
 (0)