mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Allow to use @TestOnly symbols inside @TestOnly fields (IDEA-148905)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>14</line>
|
||||
<module>testInsideField</module>
|
||||
<package><default></package>
|
||||
<entry_point TYPE="method" FQNAME="A$2 void run()"/>
|
||||
<description>Test-only method is called in production code</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
public class A {
|
||||
@org.jetbrains.annotations.TestOnly
|
||||
public static final String MY_FIELD = "VALUE";
|
||||
|
||||
@org.jetbrains.annotations.TestOnly
|
||||
public static final Runnable MY_TEST_ONLY_RUNNABLE = new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(MY_FIELD);
|
||||
}
|
||||
};
|
||||
|
||||
public static final Runnable MY_PRODUCTION_RUNNABLE = new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(MY_FIELD);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
public class C {
|
||||
@org.junit.Test
|
||||
public void foo() {
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(A.MY_FIELD);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
public class D {
|
||||
public static final Runnable MY_RUNNABLE = new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(A.MY_FIELD);
|
||||
}
|
||||
};
|
||||
|
||||
public void test() {
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(A.MY_FIELD);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user