mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not flag dead code if custom JUnit runner is used (IDEA-25444)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>2</line>
|
||||
<description>Constructor is never used</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
class B {
|
||||
A a=new A(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
A() {
|
||||
}
|
||||
A(int k) {
|
||||
System.out.println(k);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
class B extends A {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
abstract class A {
|
||||
A() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
@@ -0,0 +1,5 @@
|
||||
public class External {
|
||||
{
|
||||
new Test();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
public class Test implements java.io.Serializable {
|
||||
private void writeObject(java.io.ObjectOutputStream out) {}
|
||||
private void readObject(java.io.ObjectInputStream in) {}
|
||||
public Object writeReplace() { return null; }
|
||||
public Object readResolve() { return null; }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="p1.Form">
|
||||
<component id="566a6" class="javax.swing.JLabel" binding="myLabel">
|
||||
<constraints>
|
||||
<xy x="167" y="116" width="33" height="16"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Label"/>
|
||||
</properties>
|
||||
</component>
|
||||
</form>
|
||||
@@ -0,0 +1,8 @@
|
||||
package p1;
|
||||
|
||||
public class Form {
|
||||
private JLabel myLabel;
|
||||
|
||||
private void createUIComponents() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@Annotated
|
||||
public class Test {
|
||||
@Annotated
|
||||
public void foo(){}
|
||||
|
||||
@Annotated
|
||||
public int myPublicField;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
|
||||
public @interface Test {
|
||||
String value() default "";
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
public class A {
|
||||
public A() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class B implements I{
|
||||
public void projectOpened() {
|
||||
new A();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
public interface I {
|
||||
void projectOpened();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
public static void main(String[] args){
|
||||
I i = null;
|
||||
i.projectOpened();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<component>B</component>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
public class A {
|
||||
public static void main(String[] args) {
|
||||
new A();
|
||||
}
|
||||
|
||||
private void a(){
|
||||
}
|
||||
|
||||
private void b(){
|
||||
a();
|
||||
}
|
||||
|
||||
@java.lang.SuppressWarnings({"UnusedDeclaration"})
|
||||
private void c(){
|
||||
b();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
public class A {
|
||||
public A(int i) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class B {
|
||||
public static void main(String[] args){
|
||||
System.out.println(new A(1));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
public class Test {
|
||||
public static void main(String[] args){
|
||||
System.out.println(new A(1));
|
||||
}
|
||||
|
||||
private class A {
|
||||
public A(int i){}
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package test;
|
||||
|
||||
public class AMatcher implements Matcher{
|
||||
private static final BracePair [] PAIRS = new BracePair[]{new BracePair()};
|
||||
public BracePair[] getPairs() {
|
||||
return PAIRS;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package test;
|
||||
|
||||
public class BracePair {
|
||||
|
||||
public BracePair() {
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
|
||||
public interface Matcher {
|
||||
BracePair[] getPairs();
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package test;
|
||||
|
||||
public class Test {
|
||||
|
||||
public Test(Matcher m) {
|
||||
BracePair[] bracePairs = m.getPairs();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new Test(new AMatcher()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
public void Test1 {
|
||||
void foo() {
|
||||
if (Test.FIRST.invert() != Test.SECOND) {
|
||||
//assert
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public enum Test
|
||||
{
|
||||
FIRST, SECOND;
|
||||
|
||||
public Test invert() {
|
||||
return this == FIRST ? SECOND : FIRST;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>14</line>
|
||||
<entry_point TYPE="method" FQNAME="Test void notATest()"/>
|
||||
<description>Method is never used.</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>8</line>
|
||||
<entry_point TYPE="method" FQNAME="Test void testSmth()"/>
|
||||
<description>Method is never used.</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
public interface I {
|
||||
A create();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class IImpl extends I {
|
||||
public A create() {
|
||||
return new A();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
public class Test {
|
||||
public static junit.framework.Test suite() {
|
||||
I i = new IImpl();
|
||||
A a = i.create();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void testSmth() {}
|
||||
|
||||
public void setUp() {}
|
||||
|
||||
public void tearDown(){}
|
||||
|
||||
public void notATest(){}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems/>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
@org.junit.runner.RunWith(UnresolvedRunner.class)
|
||||
public class Test {
|
||||
public void testSmth() {}
|
||||
|
||||
public void setUp() {}
|
||||
|
||||
public void tearDown(){}
|
||||
|
||||
public void notATestButCanBeRunnedWithCustomRunner(){}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>2</line>
|
||||
<problem_class>unused declaration</problem_class>
|
||||
<description>Method has usage(s) but they all belong to recursive calls chain that has no members reachable from entry points.</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>5</line>
|
||||
<problem_class>unused declaration</problem_class>
|
||||
<description>Method has usage(s) but they all belong to recursive calls chain that has no members reachable from entry points.</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
public class A {
|
||||
private void a(){
|
||||
b();
|
||||
}
|
||||
private void b(){
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>2</line>
|
||||
<description>Field has no usages.</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<root>Test</root>
|
||||
@@ -0,0 +1,3 @@
|
||||
public class Test {
|
||||
public static final String LOG = Test.class.getName();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>3</line>
|
||||
<problem_class>unused declaration</problem_class>
|
||||
<description>Class is not instantiated.</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
}
|
||||
class B{
|
||||
private void b(){
|
||||
new B();
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
interface Interface {
|
||||
int[] getField();
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
public class Test implements Interface{
|
||||
public static int[] myField = new int[] {init()};
|
||||
|
||||
public static int init() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
Interface i = new Test();
|
||||
System.out.println(i.getField());
|
||||
}
|
||||
|
||||
public int[] getField() {
|
||||
return myField;
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
interface Interface {
|
||||
int getField();
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
public class Test implements Interface{
|
||||
public int myField = init();
|
||||
|
||||
public int init() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
Interface i = new Test();
|
||||
System.out.println(i.getField());
|
||||
}
|
||||
|
||||
public int getField() {
|
||||
return myField;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
public class A {
|
||||
public static void main(String[] args) {
|
||||
B.b();
|
||||
}
|
||||
private static class B{
|
||||
public static B b(){
|
||||
return new B();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
public class A {
|
||||
public A() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<component>A</component>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
public class Main {
|
||||
public static void main(String args[]) {
|
||||
Singleton.getInstance();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
pubic class Singleton {
|
||||
private static Singleton ourInstance = new Singleton();
|
||||
|
||||
public Singleton getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>3</line>
|
||||
<problem_class>unused declaration</problem_class>
|
||||
<description>Method is never used.</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
public class A {
|
||||
private A(){}
|
||||
public static A getInstance(){
|
||||
return new A();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
class B {
|
||||
A a=new A(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
@java.lang.SuppressWarnings({"UnusedDeclaration"})
|
||||
A() {
|
||||
}
|
||||
A(int k) {
|
||||
System.out.println(k);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
@java.lang.SuppressWarnings({"UnusedDeclaration"})
|
||||
A() {
|
||||
new B();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
class B {
|
||||
B(){}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
@java.lang.SuppressWarnings({"UnusedDeclaration"})
|
||||
A() {
|
||||
B bb = new B();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
class B {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInspection.deadCode.DeadCodeInspection;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class DeadCodeTest extends InspectionTestCase {
|
||||
private DeadCodeInspection myTool;
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath() + "/inspection";
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myTool = new DeadCodeInspection();
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_3);
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest("deadCode/" + getTestName(true), myTool);
|
||||
}
|
||||
|
||||
public void testSCR6067() throws Exception {
|
||||
boolean old = myTool.ADD_NONJAVA_TO_ENTRIES;
|
||||
myTool.ADD_NONJAVA_TO_ENTRIES = false;
|
||||
doTest();
|
||||
myTool.ADD_NONJAVA_TO_ENTRIES = old;
|
||||
}
|
||||
|
||||
public void testsingleton() throws Exception {
|
||||
boolean old = myTool.ADD_NONJAVA_TO_ENTRIES;
|
||||
myTool.ADD_NONJAVA_TO_ENTRIES = false;
|
||||
doTest();
|
||||
myTool.ADD_NONJAVA_TO_ENTRIES = old;
|
||||
}
|
||||
|
||||
public void testSCR9690() throws Exception {
|
||||
boolean old = myTool.ADD_NONJAVA_TO_ENTRIES;
|
||||
myTool.ADD_NONJAVA_TO_ENTRIES = false;
|
||||
doTest();
|
||||
myTool.ADD_NONJAVA_TO_ENTRIES = old;
|
||||
}
|
||||
|
||||
public void testUIFormUsage() throws Exception {
|
||||
boolean old = myTool.ADD_NONJAVA_TO_ENTRIES;
|
||||
myTool.ADD_NONJAVA_TO_ENTRIES = false;
|
||||
doTest();
|
||||
myTool.ADD_NONJAVA_TO_ENTRIES = old;
|
||||
}
|
||||
|
||||
public void testSerializable() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testpackageLocal() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testreachableFromMain() throws Exception{
|
||||
boolean old = myTool.ADD_MAINS_TO_ENTRIES;
|
||||
myTool.ADD_MAINS_TO_ENTRIES = true;
|
||||
doTest();
|
||||
myTool.ADD_MAINS_TO_ENTRIES = old;
|
||||
}
|
||||
|
||||
public void testmutableCalls() throws Exception{
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void teststaticMethods() throws Exception{
|
||||
doTest();
|
||||
}
|
||||
|
||||
//-------------- suppressed ----------------
|
||||
|
||||
private void doTest15() throws Exception {
|
||||
final JavaPsiFacade facade = getJavaFacade();
|
||||
final LanguageLevel effectiveLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
|
||||
LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
|
||||
doTest();
|
||||
LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(effectiveLanguageLevel);
|
||||
}
|
||||
|
||||
public void testsuppress() throws Exception{
|
||||
doTest15();
|
||||
}
|
||||
|
||||
public void testsuppress1() throws Exception {
|
||||
doTest15();
|
||||
}
|
||||
|
||||
public void testsuppress2() throws Exception {
|
||||
doTest15();
|
||||
}
|
||||
|
||||
public void testchainOfSuppressions() throws Exception{
|
||||
doTest15();
|
||||
}
|
||||
|
||||
public void testreachableFromXml() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testchainOfCalls() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testreachableFromFieldInitializer() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testreachableFromFieldArrayInitializer() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testconstructorReachableFromFieldInitializer() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testadditionalAnnotations() throws Exception {
|
||||
final String testAnnotation = "Annotated";
|
||||
myTool.ADDITIONAL_ANNOTATIONS.add(testAnnotation);
|
||||
try {
|
||||
doTest();
|
||||
}
|
||||
finally {
|
||||
myTool.ADDITIONAL_ANNOTATIONS.remove(testAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
public void testannotationInterface() throws Exception {
|
||||
doTest15();
|
||||
}
|
||||
|
||||
public void testjunitEntryPoint() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testjunitEntryPointCustomRunWith() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testconstructorCalls() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testconstructorCalls1() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testnonJavaReferences() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testenumInstantiation() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -62,16 +62,17 @@ public class JUnitUnusedCodeExtension extends UnusedCodeExtension {
|
||||
}
|
||||
else if (psiElement instanceof PsiMethod) {
|
||||
final PsiMethod psiMethod = (PsiMethod)psiElement;
|
||||
if (JUnitUtil.getTestMethod(psiElement) != null) return true;
|
||||
final String name = psiMethod.getName();
|
||||
if (psiMethod.hasModifierProperty(PsiModifier.PUBLIC) &&
|
||||
!psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
if (name.startsWith("test") || "suite".equals(name) || "setUp".equals(name) || "tearDown".equals(name)) {
|
||||
if ("suite".equals(name) || "setUp".equals(name) || "tearDown".equals(name)) {
|
||||
return true;
|
||||
}
|
||||
if (psiMethod.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
if (AnnotationUtil.isAnnotated(psiMethod, Arrays.asList(BeforeClass.class.getName(), AfterClass.class.getName(), Parameterized.Parameters.class.getName().replace('$', '.')))) return true;
|
||||
} else {
|
||||
if (AnnotationUtil.isAnnotated(psiMethod, Arrays.asList(Before.class.getName(), After.class.getName(), Test.class.getName()))) return true;
|
||||
if (AnnotationUtil.isAnnotated(psiMethod, Arrays.asList(Before.class.getName(), After.class.getName()))) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user