diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIndex.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIndex.java index 8c21417f2e51..ed2ae157cabe 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIndex.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/BytecodeAnalysisIndex.java @@ -53,7 +53,7 @@ public class BytecodeAnalysisIndex extends ScalarIndexExtension { private static final ID NAME = ID.create("bytecodeAnalysis"); private static final HKeyDescriptor KEY_DESCRIPTOR = new HKeyDescriptor(); private static final VirtualFileGist> ourGist = GistManager.getInstance().newVirtualFileGist( - "BytecodeAnalysisIndex", 4, new HEquationsExternalizer(), new ClassDataIndexer()); + "BytecodeAnalysisIndex", 5, new HEquationsExternalizer(), new ClassDataIndexer()); @NotNull @Override diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/PurityAnalysis.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/PurityAnalysis.java index c3976f856639..ea30ecf32557 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/PurityAnalysis.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/PurityAnalysis.java @@ -556,9 +556,6 @@ final class HardCodedPurity { // Maybe overloaded and be not pure, but this would be definitely bad code style // Used in Throwable(Throwable) ctor, so this helps to infer purity of many exception constructors new Method("java/lang/Throwable", "toString", "()Ljava/lang/String;"), - // Declared in final class StringBuilder - new Method("java/lang/StringBuilder", "toString", "()Ljava/lang/String;"), - new Method("java/lang/StringBuffer", "toString", "()Ljava/lang/String;"), // Native new Method("java/lang/Object", "getClass", "()Ljava/lang/Class;"), new Method("java/lang/Class", "getComponentType", "()Ljava/lang/Class;"), @@ -596,7 +593,8 @@ final class HardCodedPurity { } static boolean isPureMethod(Key key) { - return pureMethods.contains(key.method); + return key.method.methodName.equals("toString") && key.method.methodDesc.equals("()Ljava/lang/String;") || + pureMethods.contains(key.method); } static boolean isOwnedField(FieldInsnNode fieldInsn) { diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/annotations.xml index 1bae9b055f86..2bc36600c528 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/awt/annotations.xml @@ -209,6 +209,9 @@ + + + @@ -408,6 +411,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/io/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/io/annotations.xml index de1158a10e5d..34a6a4a6126d 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/io/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/io/annotations.xml @@ -131,6 +131,9 @@ + + + @@ -285,6 +288,11 @@ + + + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotation/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotation/annotations.xml index 02d9df5fb4c6..f18b2950350d 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotation/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotation/annotations.xml @@ -1,4 +1,9 @@ + + + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotations.xml index 3831854dcde1..1a3967d00d0f 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/annotations.xml @@ -141,6 +141,11 @@ + + + + + @@ -370,6 +375,9 @@ + + + @@ -385,6 +393,11 @@ + + + + + @@ -613,6 +626,9 @@ + + + @@ -817,6 +833,11 @@ + + + + + @@ -992,6 +1013,11 @@ + + + + + @@ -1212,6 +1238,9 @@ + + + @@ -1362,6 +1391,9 @@ + + + @@ -1558,6 +1590,9 @@ + + + @@ -1660,6 +1695,9 @@ + + + @@ -1758,6 +1796,11 @@ + + + + + @@ -1992,7 +2035,8 @@ - + + @@ -2437,6 +2481,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/invoke/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/invoke/annotations.xml index 3e654cf1d291..b262f24eb08a 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/invoke/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/lang/invoke/annotations.xml @@ -128,6 +128,9 @@ + + + @@ -348,6 +351,11 @@ + + + + + @@ -370,6 +378,9 @@ + + + @@ -528,6 +539,11 @@ + + + + + @@ -786,6 +802,11 @@ + + + + + @@ -988,6 +1009,11 @@ + + + + + @@ -1195,6 +1221,9 @@ + + + @@ -1220,6 +1249,11 @@ + + + + + @@ -1267,6 +1301,9 @@ + + + @@ -1395,6 +1432,11 @@ + + + + + @@ -1484,6 +1526,11 @@ + + + + + @@ -1548,9 +1595,19 @@ + + + + + + + + + + @@ -1917,6 +1974,11 @@ + + + + + @@ -2094,12 +2156,18 @@ + + + + + + @@ -2329,6 +2397,9 @@ + + + @@ -2378,6 +2449,11 @@ + + + + + @@ -2689,6 +2765,11 @@ + + + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/net/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/net/annotations.xml index 691c4e4d79f1..031f83ac9bd6 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/net/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/net/annotations.xml @@ -215,6 +215,9 @@ + + + @@ -267,6 +270,9 @@ + + + @@ -313,6 +319,9 @@ + + + @@ -542,6 +551,11 @@ + + + + + @@ -752,6 +766,11 @@ + + + + + @@ -875,6 +894,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/security/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/security/annotations.xml index 0b6551e5564c..4b128821635d 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/security/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/security/annotations.xml @@ -51,6 +51,11 @@ + + + + + @@ -231,6 +236,9 @@ + + + \ No newline at end of file diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/sql/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/sql/annotations.xml index 408b70b181e3..97ae30f6ebca 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/sql/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/sql/annotations.xml @@ -72,6 +72,9 @@ + + + @@ -178,6 +181,11 @@ + + + + + @@ -227,6 +235,9 @@ + + + @@ -275,6 +286,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/annotations.xml index abd9c8e7ad0a..3855ba366d51 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/annotations.xml @@ -29,6 +29,9 @@ + + + @@ -160,6 +163,9 @@ + + + @@ -635,6 +641,9 @@ + + + @@ -882,6 +891,9 @@ + + + @@ -1329,6 +1341,11 @@ + + + + + @@ -1349,6 +1366,11 @@ + + + + + @@ -1410,6 +1432,11 @@ + + + + + @@ -1464,6 +1491,11 @@ + + + + + @@ -1490,6 +1522,11 @@ + + + + + @@ -1894,6 +1931,11 @@ + + + + + @@ -1980,6 +2022,11 @@ + + + + + @@ -2018,6 +2065,11 @@ + + + + + @@ -2153,6 +2205,11 @@ + + + + + @@ -2242,6 +2299,11 @@ + + + + + @@ -2301,6 +2363,11 @@ + + + + + @@ -2398,6 +2465,11 @@ + + + + + @@ -2642,6 +2714,9 @@ + + + @@ -2712,6 +2787,9 @@ + + + @@ -2910,6 +2988,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/atomic/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/atomic/annotations.xml index 8407709fd419..4fdf22e7039e 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/atomic/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/atomic/annotations.xml @@ -70,6 +70,9 @@ + + + @@ -147,6 +150,9 @@ + + + @@ -224,6 +230,11 @@ + + + + + @@ -233,6 +244,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/locks/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/locks/annotations.xml index 2480b8fc210a..b1db74affa52 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/locks/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/java/util/concurrent/locks/annotations.xml @@ -97,6 +97,9 @@ + + + @@ -208,6 +211,9 @@ + + + @@ -246,6 +252,9 @@ + + + @@ -281,6 +290,9 @@ + + + @@ -325,6 +337,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/map/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/map/annotations.xml index 742796444109..1123ae1b43d3 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/map/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/collections/map/annotations.xml @@ -97,6 +97,9 @@ + + + @@ -199,6 +202,9 @@ + + + @@ -215,6 +221,9 @@ + + + @@ -359,6 +368,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/annotations.xml index 4fdb2447687a..f0e05764c0e5 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/annotations.xml @@ -1535,12 +1535,22 @@ + + + + + + + + + + @@ -2056,6 +2066,11 @@ + + + + + @@ -2064,7 +2079,8 @@ - + + @@ -2251,6 +2267,9 @@ + + + @@ -2366,12 +2385,18 @@ - + + + + + + + @@ -3133,7 +3158,8 @@ - + + @@ -3248,7 +3274,8 @@ - + + @@ -3257,7 +3284,8 @@ - + + @@ -3266,7 +3294,8 @@ - + + @@ -3275,7 +3304,8 @@ - + + @@ -3287,7 +3317,8 @@ - + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/builder/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/builder/annotations.xml index 5846f3416e9f..cab93126012f 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/builder/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/builder/annotations.xml @@ -478,6 +478,11 @@ + + + + + @@ -689,6 +694,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enum/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enum/annotations.xml index 83d5680f1aae..330f69daf4d6 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enum/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enum/annotations.xml @@ -26,6 +26,11 @@ + + + + + @@ -77,4 +82,9 @@ + + + + + \ No newline at end of file diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enums/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enums/annotations.xml index b207b37ee886..a84a84855f09 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enums/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/enums/annotations.xml @@ -26,6 +26,11 @@ + + + + + @@ -81,6 +86,11 @@ + + + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/math/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/math/annotations.xml index 0ab8cea11c11..1b93c472138b 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/math/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/math/annotations.xml @@ -80,6 +80,11 @@ + + + + + @@ -171,6 +176,11 @@ + + + + + @@ -259,6 +269,11 @@ + + + + + @@ -460,6 +475,11 @@ + + + + + @@ -576,6 +596,11 @@ + + + + + @@ -626,6 +651,11 @@ + + + + + @@ -940,6 +970,9 @@ + + + \ No newline at end of file diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/mutable/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/mutable/annotations.xml index 422edda09a1f..9a598e170290 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/mutable/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/mutable/annotations.xml @@ -121,6 +121,9 @@ + + + @@ -195,6 +198,11 @@ + + + + + @@ -267,6 +275,11 @@ + + + + + @@ -340,6 +353,9 @@ + + + @@ -415,6 +431,9 @@ + + + @@ -454,6 +473,11 @@ + + + + + @@ -513,6 +537,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/text/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/text/annotations.xml index 94954111bc3f..66fc052f5517 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/text/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/text/annotations.xml @@ -163,6 +163,9 @@ + + + @@ -454,6 +457,11 @@ + + + + + @@ -869,6 +877,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/time/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/time/annotations.xml index ed1abd4f27fc..bbe266062634 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/time/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/commons/lang/time/annotations.xml @@ -368,6 +368,9 @@ + + + @@ -676,6 +679,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/anakia/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/anakia/annotations.xml index 345c905ae802..449201c52a23 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/anakia/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/anakia/annotations.xml @@ -1,4 +1,9 @@ + + + + + @@ -80,6 +85,11 @@ + + + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/implement/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/implement/annotations.xml index c4c2a481bff4..41541edcbe9c 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/implement/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/event/implement/annotations.xml @@ -102,6 +102,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/tools/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/tools/annotations.xml index 6ab8a501a587..6b8aabbe537e 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/tools/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/app/tools/annotations.xml @@ -72,4 +72,9 @@ + + + + + \ No newline at end of file diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/directive/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/directive/annotations.xml index 0f0f96ebe7e4..be6e61b3943c 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/directive/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/directive/annotations.xml @@ -27,6 +27,9 @@ + + + @@ -537,6 +540,9 @@ + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/node/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/node/annotations.xml index b2bda30c66c1..44cc14731551 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/node/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/runtime/parser/node/annotations.xml @@ -131,6 +131,11 @@ + + + + + @@ -1224,7 +1229,15 @@ + + + + + + + + diff --git a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/introspection/annotations.xml b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/introspection/annotations.xml index fc4cb5de9668..f605d507b23a 100644 --- a/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/introspection/annotations.xml +++ b/java/java-tests/testData/codeInspection/bytecodeAnalysis/annotations/org/apache/velocity/util/introspection/annotations.xml @@ -56,6 +56,9 @@ + + + diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/BytecodeAnalysisTest.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/BytecodeAnalysisTest.java index 2ec9c33dc1fb..77a05b5ee666 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/BytecodeAnalysisTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/BytecodeAnalysisTest.java @@ -72,7 +72,7 @@ public class BytecodeAnalysisTest extends JavaCodeInsightFixtureTestCase { public void testInference() throws IOException { checkAnnotations(Test01.class); checkAnnotations(Test02.class); - checkAnnotations(Test03.class); + checkAnnotations(TestNonStable.class); } public void testConverter() throws IOException { diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/data/Test01.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/data/Test01.java index 3676dd19e180..52d907ee46d5 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/data/Test01.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/data/Test01.java @@ -40,7 +40,12 @@ public class Test01 { } static void t(@ExpectNotNull Object o) { - o.toString(); + use(o); + } + + private static String use(@ExpectNotNull Object o) { + System.out.println(o); + return o.toString(); } @ExpectContract(pure = true) @@ -50,12 +55,12 @@ public class Test01 { @ExpectContract("null->null") static String toString1(Object o) { - return o == null ? null : o.toString(); + return o == null ? null : use(o); } @ExpectContract("null->!null") static String toString2(Object o) { - return o == null ? "null" : o.toString(); + return o == null ? "null" : use(o); } @ExpectContract(pure = true) diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/data/Test03.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/data/TestNonStable.java similarity index 88% rename from java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/data/Test03.java rename to java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/data/TestNonStable.java index 2b9f22a4cd2c..f0677b4983f0 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/data/Test03.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/bytecodeAnalysis/data/TestNonStable.java @@ -21,16 +21,15 @@ import com.intellij.java.codeInspection.bytecodeAnalysis.ExpectNotNull; /** * @author lambdamix */ -public class Test03 { +public class TestNonStable { - public String toString1() { - return toString(); + public String asString1() { + return asString(); } @ExpectContract(pure = true) - @Override @ExpectNotNull - public String toString() { + public String asString() { return ""; } }