mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 17:20:55 +07:00
[jvm] IJ-CR-7495 TestOnly inspection improvements
Now uses TestOnlyApiUsageProcessor and correctly finds top level parents. GitOrigin-RevId: 41789e2279fc4d4c885050f7ee475a6e8ab81e48
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4c01afd417
commit
89000cc20d
@@ -24,11 +24,20 @@ public class TestOnlyTest {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestOnlyTest foo = <warning descr="Test-only class is referenced in production code">new TestOnlyTest()</warning>;
|
||||
TestOnlyTest foo = new <warning descr="Test-only class is referenced in production code">TestOnlyTest</warning>();
|
||||
Bar bar = new Bar();
|
||||
int aField = <warning descr="Test-only field is referenced in production code">bar.aField</warning>;
|
||||
<warning descr="Test-only method is called in production code">bar.aMethod()</warning>;
|
||||
Function<String, String> methodRef = <warning descr="Test-only method is called in production code">TestOnlyTest::someString</warning>;
|
||||
int aField = bar.<warning descr="Test-only field is referenced in production code">aField</warning>;
|
||||
bar.<warning descr="Test-only method is called in production code">aMethod</warning>();
|
||||
Function<String, String> methodRef = TestOnlyTest::<warning descr="Test-only method is called in production code">someString</warning>;
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static void testOnly() {
|
||||
TestOnlyTest foo = new TestOnlyTest();
|
||||
Bar bar = new Bar();
|
||||
int aField = bar.aField;
|
||||
bar.aMethod();
|
||||
Function<String, String> methodRef = TestOnlyTest::someString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ public class VisibleForTestingTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(fooBar);
|
||||
System.out.println(<warning descr="Test-only field is referenced in production code">VisibleForTestingTestApi.foo</warning>);
|
||||
<warning descr="Test-only method is called in production code">VisibleForTestingTestApi.bar()</warning>;
|
||||
System.out.println(VisibleForTestingTestApi.<warning descr="Test-only field is referenced in production code">foo</warning>);
|
||||
VisibleForTestingTestApi.<warning descr="Test-only method is called in production code">bar</warning>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user