mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-133946 Don't highlight private constructor as unused if it is called by dependency injection engine
This commit is contained in:
@@ -315,7 +315,6 @@ public class UnusedSymbolUtil {
|
||||
|
||||
private static boolean isIntentionalPrivateConstructor(@NotNull PsiMethod method, PsiClass containingClass) {
|
||||
return method.isConstructor() &&
|
||||
method.getParameterList().getParametersCount() == 0 &&
|
||||
containingClass != null &&
|
||||
containingClass.getConstructors().length == 1;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,13 @@ class a extends Exception {
|
||||
private <warning descr="Private constructor 'a(java.lang.String)' is never used">a</warning>(String s) {
|
||||
super(s);
|
||||
}
|
||||
private <warning descr="Private constructor 'a()' is never used">a</warning>(){}
|
||||
}
|
||||
|
||||
class TheOnlyCtr extends Exception {
|
||||
private TheOnlyCtr(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
||||
class s extends Exception {
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import java.lang.Override;
|
||||
|
||||
class PrivateConstructor {
|
||||
private final int myA;
|
||||
|
||||
private PrivateConstructor(int a) {
|
||||
myA = a;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return myA;
|
||||
}
|
||||
}
|
||||
+2
@@ -2,4 +2,6 @@ package refactoring.changeSignatureGesture;
|
||||
class TestMeabracadabra {
|
||||
private TestMeabracadabra(<caret>){
|
||||
}
|
||||
private TestMeabracadabra(String f){
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,6 +36,8 @@ public class UnusedSymbolLocalTest extends DaemonAnalyzerTestCase {
|
||||
public void testInnerClass() throws Exception { doTest(); }
|
||||
public void testInnerUsesSelf() throws Exception { doTest(); }
|
||||
public void testLocalClass() throws Exception { doTest(); }
|
||||
public void testPrivateConstructor() throws Exception { doTest(); }
|
||||
|
||||
//@Bombed(day = 5, month = Calendar.SEPTEMBER, user = "anet")
|
||||
//public void testInjectedAnno() throws Exception { doTest(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user