[java] [highlighting] don't report inferred wildcards (IDEA-294000)

GitOrigin-RevId: a17933972fc5cb31e03e3b7a145f5d721e356d25
This commit is contained in:
Anna Kozlova
2022-05-13 21:32:58 +00:00
committed by intellij-monorepo-bot
parent 62ce7483bd
commit cf6ef89010
3 changed files with 11 additions and 2 deletions
@@ -775,7 +775,7 @@ public final class GenericsHighlightUtil {
}
}
}
else {
else if (!typeElement.isInferredType()){
String description = JavaErrorBundle.message("generics.wildcards.may.be.used.only.as.reference.parameters");
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(typeElement).descriptionAndTooltip(description).create();
}
@@ -0,0 +1,7 @@
class MyTest {
static <T extends Iterable<?>> void print(T collection) {
for (var item : collection) {
System.out.println(item);
}
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.codeInsight.daemon;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
@@ -61,6 +61,8 @@ public class LightAdvLVTIHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testWildcardInference() { doTest(); }
public void testGotoDeclarationOnVar() {
configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
final int offset = getEditor().getCaretModel().getOffset();