diff --git a/java/java-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java b/java/java-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java index 1bfadfd2420b..ab940b08e54e 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java @@ -241,6 +241,10 @@ public class DeprecationInspection extends BaseJavaLocalInspectionTool { } } + if (PsiTreeUtil.getParentOfType(elementToHighlight, PsiImportStatementBase.class) != null) { + return; + } + String description = JavaErrorMessages.message("deprecated.symbol", HighlightMessageUtil.getSymbolName(refElement, PsiSubstitutor.EMPTY)); diff --git a/java/java-tests/testData/inspection/deprecation/deprecatedInImport/expected.xml b/java/java-tests/testData/inspection/deprecation/deprecatedInImport/expected.xml new file mode 100644 index 000000000000..4704d91e891d --- /dev/null +++ b/java/java-tests/testData/inspection/deprecation/deprecatedInImport/expected.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/java/java-tests/testData/inspection/deprecation/deprecatedInImport/src/Test.java b/java/java-tests/testData/inspection/deprecation/deprecatedInImport/src/Test.java new file mode 100644 index 000000000000..36192223395a --- /dev/null +++ b/java/java-tests/testData/inspection/deprecation/deprecatedInImport/src/Test.java @@ -0,0 +1,3 @@ +import a.A; +public class Test { +} \ No newline at end of file diff --git a/java/java-tests/testData/inspection/deprecation/deprecatedInImport/src/a/A.java b/java/java-tests/testData/inspection/deprecation/deprecatedInImport/src/a/A.java new file mode 100644 index 000000000000..c2cd9f4f3dc4 --- /dev/null +++ b/java/java-tests/testData/inspection/deprecation/deprecatedInImport/src/a/A.java @@ -0,0 +1,3 @@ +package a; +@Deprecated +public class A {} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DeprecationInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DeprecationInspectionTest.java index b53c7ed57418..41a802df93cf 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/DeprecationInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/DeprecationInspectionTest.java @@ -25,6 +25,10 @@ public class DeprecationInspectionTest extends InspectionTestCase { doTest(); } + public void testDeprecatedInImport() throws Exception{ + doTest(); + } + public void testDeprecatedInner() throws Exception { doTest(); }