From 2c7d491f4b3be9742c663397651a0e1635a138d1 Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 14 Mar 2012 14:20:25 +0100 Subject: [PATCH] incorrect default deprecation is used (IDEA-82721) --- .../deprecation/DeprecationInspection.java | 4 ++++ .../advHighlighting/Deprecated.java | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) 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 4387f86e35e0..c22621cfccba 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java @@ -176,6 +176,10 @@ public class DeprecationInspection extends BaseJavaLocalInspectionTool { final PsiClass superClass = aClass.getSuperClass(); if (hasDefaultDeprecatedConstructor(superClass)) { final boolean isAnonymous = aClass instanceof PsiAnonymousClass; + if (isAnonymous) { + final PsiExpressionList argumentList = ((PsiAnonymousClass)aClass).getArgumentList(); + if (argumentList != null && argumentList.getExpressions().length > 0) return; + } registerDefaultConstructorProblem(superClass, isAnonymous ? ((PsiAnonymousClass)aClass).getBaseClassReference() : aClass.getNameIdentifier(), isAnonymous); } } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Deprecated.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Deprecated.java index ef2978975183..fdc5e36d6aae 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Deprecated.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Deprecated.java @@ -59,4 +59,19 @@ abstract class ac1 { class ci1 extends ac1 implements i1 { // no chance not to implement it public void f() {} -} \ No newline at end of file +} + +class Aaa { + public Aaa(String s) { + System.out.println(s); + } + + /** + * @deprecated + */ + public Aaa() {} + + public void foo() { + new Aaa("asdasdad") {}; + } +}