mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
java deprecation: don't highlight lambda if target functional interface is deprecated (IDEA-246336)
javac doesn't report such cases and most probably method with functional interface must be deprecated as well, so deprecation would be visible; otherwise too much code would be crossed out GitOrigin-RevId: b75feb5a4052d6da9355bda1f37374c66d964b29
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e3f4941ffe
commit
5fcbd6cb28
@@ -54,6 +54,7 @@ public final class DeprecatedApiUsageProcessor implements ApiUsageProcessor {
|
||||
|
||||
@Override
|
||||
public void processReference(@NotNull UElement sourceNode, @NotNull PsiModifierListOwner target, @Nullable UExpression qualifier) {
|
||||
if (sourceNode instanceof ULambdaExpression) return;
|
||||
checkTargetDeprecated(sourceNode, target);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
@Deprecated
|
||||
interface I {
|
||||
void m();
|
||||
}
|
||||
|
||||
class Util {
|
||||
@Deprecated
|
||||
static void foo(I i) {}
|
||||
}
|
||||
class MyTest {
|
||||
{
|
||||
Util.<warning descr="'foo(I)' is deprecated">foo</warning>(() -> {});
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ package com.intellij.java.codeInsight.daemon;
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.codeInspection.compiler.JavacQuirksInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.codeInspection.deprecation.DeprecationInspection;
|
||||
import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
@@ -54,4 +55,8 @@ public class LightAdvHighlightingJdk8Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testNoArraySuperType() { doTest(true, true);}
|
||||
public void testCaptureItself() { doTest(true, true); }
|
||||
public void testNestedConditionalWithOverloads() { doTest(true, true); }
|
||||
public void testDeprecatedFunctionalInterface() {
|
||||
enableInspectionTool(new DeprecationInspection());
|
||||
doTest(true, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user