mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
java inference: setup initial constraints with respect of unchecked warning rules (IDEA-259701)
GitOrigin-RevId: e922b0cdfdecf6dfc3a50a334aa21e084aa1dd97
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d8b0b80a26
commit
ad18c7f009
@@ -159,6 +159,9 @@ public class InferenceSession {
|
||||
|
||||
if (args[i] != null && isPertinentToApplicability(args[i], method)) {
|
||||
PsiType parameterType = getParameterType(parameters, i, mySiteSubstitutor, varargs);
|
||||
if (method != null && PsiUtil.isRawSubstitutor(method, mySiteSubstitutor)) {
|
||||
parameterType = TypeConversionUtil.erasure(parameterType);
|
||||
}
|
||||
LOG.assertTrue(parameterType != null);
|
||||
if (!ignoreLambdaConstraintTree(args[i])) {
|
||||
addConstraint(new ExpressionCompatibilityConstraint(args[i], substituteWithInferenceVariables(parameterType)));
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import java.util.function.Consumer;
|
||||
|
||||
class MyTest {
|
||||
void m(Provider provider) {
|
||||
provider.provide(new <error descr="Class 'Anonymous class derived from Consumer' must either be declared abstract or implement abstract method 'accept(T)' in 'Consumer'">Consumer<></error>() {
|
||||
<error descr="Method does not override method from its superclass">@Override</error>
|
||||
public void accept(String s) { }
|
||||
});
|
||||
}
|
||||
static class Provider<T> {
|
||||
void provide(Consumer<String> consumer){}
|
||||
}
|
||||
}
|
||||
@@ -113,6 +113,8 @@ public class Diamond8HighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
|
||||
public void testNestedDiamondsAnonymousCase() { doTest();}
|
||||
|
||||
public void testDiamondsUncheckedWarning() { doTest();}
|
||||
|
||||
private void doTest() {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user