author | goetz |
Wed, 10 Apr 2019 08:26:23 +0200 | |
branch | JEP-8220715-NPE_messages |
changeset 57319 | aa400d41ebd6 |
parent 57272 | 472db1657c6d |
permissions | -rw-r--r-- |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1 |
/* |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
3 |
* Copyright (c) 2019 SAP SE. All rights reserved. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
5 |
* |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
9 |
* |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
14 |
* accompanied this code). |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
15 |
* |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License version |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
19 |
* |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
21 |
* or visit www.oracle.com if you need additional information or have any |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
22 |
* questions. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
23 |
*/ |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
24 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
25 |
/** |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
26 |
* @test |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
27 |
* @summary Test extended NullPointerException message for class |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
28 |
* files generated without debugging information. The message lists |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
29 |
* detailed information about the entity that is null. |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
30 |
* @modules java.base/java.lang:open |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
31 |
* java.base/jdk.internal.org.objectweb.asm |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
32 |
* @library /test/lib |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
33 |
* @compile NullPointerExceptionTest.java |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
34 |
* @run main NullPointerExceptionTest |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
35 |
*/ |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
36 |
/** |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
37 |
* @test |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
38 |
* @summary Test extended NullPointerException message for |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
39 |
* classfiles generated with debug information. In this case the name |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
40 |
* of the variable containing the array is printed. |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
41 |
* @modules java.base/java.lang:open |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
42 |
* java.base/jdk.internal.org.objectweb.asm |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
43 |
* @library /test/lib |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
44 |
* @compile -g NullPointerExceptionTest.java |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
45 |
* @run main/othervm -XX:+WizardMode NullPointerExceptionTest hasDebugInfo |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
46 |
*/ |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
47 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
48 |
import java.io.ByteArrayInputStream; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
49 |
import java.io.ByteArrayOutputStream; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
50 |
import java.io.ObjectInputStream; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
51 |
import java.io.ObjectOutputStream; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
52 |
import java.util.ArrayList; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
53 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
54 |
import jdk.test.lib.Asserts; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
55 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
56 |
import java.lang.reflect.*; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
57 |
import java.lang.invoke.MethodHandles.Lookup; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
58 |
import static java.lang.invoke.MethodHandles.*; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
59 |
import static java.lang.invoke.MethodHandles.Lookup.*; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
60 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
61 |
import jdk.internal.org.objectweb.asm.ClassWriter; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
62 |
import jdk.internal.org.objectweb.asm.MethodVisitor; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
63 |
import jdk.internal.org.objectweb.asm.Type; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
64 |
import jdk.internal.org.objectweb.asm.Label; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
65 |
import static jdk.internal.org.objectweb.asm.Opcodes.*; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
66 |
|
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
67 |
/** |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
68 |
* Tests NullPointerExceptions |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
69 |
*/ |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
70 |
public class NullPointerExceptionTest { |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
71 |
|
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
72 |
// Some fields used in the test. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
73 |
static Object nullStaticField; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
74 |
NullPointerExceptionTest nullInstanceField; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
75 |
static int[][][][] staticArray; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
76 |
static long[][] staticLongArray = new long[1000][]; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
77 |
DoubleArrayGen dag; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
78 |
ArrayList<String> names = new ArrayList<>(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
79 |
ArrayList<String> curr; |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
80 |
static boolean hasDebugInfo = false; |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
81 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
82 |
static { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
83 |
staticArray = new int[1][][][]; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
84 |
staticArray[0] = new int[1][][]; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
85 |
staticArray[0][0] = new int[1][]; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
86 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
87 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
88 |
public static void checkMessage(String expression, |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
89 |
String obtainedMsg, String expectedMsg) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
90 |
System.out.println(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
91 |
System.out.println(" source code: " + expression); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
92 |
System.out.println(" thrown msg: " + obtainedMsg); |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
93 |
if (obtainedMsg.equals(expectedMsg)) return; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
94 |
System.out.println("expected msg: " + expectedMsg); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
95 |
Asserts.assertEquals(obtainedMsg, expectedMsg); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
96 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
97 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
98 |
public static void main(String[] args) throws Exception { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
99 |
NullPointerExceptionTest t = new NullPointerExceptionTest(); |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
100 |
if (args.length > 0) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
101 |
hasDebugInfo = true; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
102 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
103 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
104 |
// Test the message printed for the failed action. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
105 |
t.testFailedAction(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
106 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
107 |
// Test the method printed for the null entity. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
108 |
t.testNullEntity(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
109 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
110 |
// Test that no message is printed for exceptions |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
111 |
// allocated explicitly. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
112 |
t.testCreation(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
113 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
114 |
// Test that no message is printed for exceptions |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
115 |
// thrown in native methods. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
116 |
t.testNative(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
117 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
118 |
// Test that two calls to getMessage() return the same |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
119 |
// message. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
120 |
// It is a design decision that it returns two different |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
121 |
// String objects. |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
122 |
t.testSameMessage(); |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
123 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
124 |
// Test serialization. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
125 |
// It is a design decision that after serialization the |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
126 |
// the message is lost. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
127 |
t.testSerialization(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
128 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
129 |
// Test that messages are printed for code generated |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
130 |
// on-the-fly. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
131 |
t.testGeneratedCode(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
132 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
133 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
134 |
// Some more interesting complex messages. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
135 |
t.testComplexMessages(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
136 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
137 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
138 |
// Helper method to cause test case. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
139 |
private double callWithTypes(String[][] dummy1, int[][][] dummy2, float dummy3, long dummy4, short dummy5, |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
140 |
boolean dummy6, byte dummy7, double dummy8, char dummy9) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
141 |
return 0.0; |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
142 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
143 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
144 |
public void testFailedAction() { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
145 |
int[] ia1 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
146 |
float[] fa1 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
147 |
Object[] oa1 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
148 |
boolean[] za1 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
149 |
byte[] ba1 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
150 |
char[] ca1 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
151 |
short[] sa1 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
152 |
long[] la1 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
153 |
double[] da1 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
154 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
155 |
// iaload |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
156 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
157 |
System.out.println(ia1[0]); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
158 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
159 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
160 |
checkMessage("ia1[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
161 |
(hasDebugInfo ? "'ia1'" : "'<local1>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
162 |
"Can not load from null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
163 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
164 |
// faload |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
165 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
166 |
System.out.println(fa1[0]); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
167 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
168 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
169 |
checkMessage("fa1[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
170 |
(hasDebugInfo ? "'fa1'" : "'<local2>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
171 |
"Can not load from null float array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
172 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
173 |
// aaload |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
174 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
175 |
System.out.println(oa1[0]); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
176 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
177 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
178 |
checkMessage("oa1[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
179 |
(hasDebugInfo ? "'oa1'" : "'<local3>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
180 |
"Can not load from null object array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
181 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
182 |
// baload (boolean) |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
183 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
184 |
System.out.println(za1[0]); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
185 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
186 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
187 |
checkMessage("za1[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
188 |
(hasDebugInfo ? "'za1'" : "'<local4>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
189 |
"Can not load from null byte/boolean array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
190 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
191 |
// baload (byte) |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
192 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
193 |
System.out.println(ba1[0]); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
194 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
195 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
196 |
checkMessage("ba1[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
197 |
(hasDebugInfo ? "'ba1'" : "'<local5>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
198 |
"Can not load from null byte/boolean array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
199 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
200 |
// caload |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
201 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
202 |
System.out.println(ca1[0]); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
203 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
204 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
205 |
checkMessage("ca1[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
206 |
(hasDebugInfo ? "'ca1'" : "'<local6>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
207 |
"Can not load from null char array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
208 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
209 |
// saload |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
210 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
211 |
System.out.println(sa1[0]); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
212 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
213 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
214 |
checkMessage("sa1[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
215 |
(hasDebugInfo ? "'sa1'" : "'<local7>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
216 |
"Can not load from null short array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
217 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
218 |
// laload |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
219 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
220 |
System.out.println(la1[0]); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
221 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
222 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
223 |
checkMessage("la1[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
224 |
(hasDebugInfo ? "'la1'" : "'<local8>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
225 |
"Can not load from null long array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
226 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
227 |
// daload |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
228 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
229 |
System.out.println(da1[0]); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
230 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
231 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
232 |
checkMessage("da1[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
233 |
(hasDebugInfo ? "'da1'" : "'<local9>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
234 |
"Can not load from null double array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
235 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
236 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
237 |
// iastore |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
238 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
239 |
System.out.println(ia1[0] = 0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
240 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
241 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
242 |
checkMessage("ia1[0] = 0", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
243 |
(hasDebugInfo ? "'ia1'" : "'<local1>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
244 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
245 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
246 |
// fastore |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
247 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
248 |
System.out.println(fa1[0] = 0.7f); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
249 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
250 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
251 |
checkMessage("fa1[0] = false", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
252 |
(hasDebugInfo ? "'fa1'" : "'<local2>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
253 |
"Can not store to null float array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
254 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
255 |
// aastore |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
256 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
257 |
System.out.println(oa1[0] = null); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
258 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
259 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
260 |
checkMessage("oa1[0] = null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
261 |
(hasDebugInfo ? "'oa1'" : "'<local3>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
262 |
"Can not store to null object array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
263 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
264 |
// bastore (boolean) |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
265 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
266 |
System.out.println(za1[0] = false); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
267 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
268 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
269 |
checkMessage("za1[0] = false", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
270 |
(hasDebugInfo ? "'za1'" : "'<local4>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
271 |
"Can not store to null byte/boolean array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
272 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
273 |
// bastore (byte) |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
274 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
275 |
System.out.println(ba1[0] = 0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
276 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
277 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
278 |
checkMessage("ba1[0] = 0", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
279 |
(hasDebugInfo ? "'ba1'" : "'<local5>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
280 |
"Can not store to null byte/boolean array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
281 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
282 |
// castore |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
283 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
284 |
System.out.println(ca1[0] = 0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
285 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
286 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
287 |
checkMessage("ca1[0] = 0", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
288 |
(hasDebugInfo ? "'ca1'" : "'<local6>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
289 |
"Can not store to null char array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
290 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
291 |
// sastore |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
292 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
293 |
System.out.println(sa1[0] = 0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
294 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
295 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
296 |
checkMessage("sa1[0] = 0", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
297 |
(hasDebugInfo ? "'sa1'" : "'<local7>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
298 |
"Can not store to null short array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
299 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
300 |
// lastore |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
301 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
302 |
System.out.println(la1[0] = 0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
303 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
304 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
305 |
checkMessage("la1[0] = 0", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
306 |
(hasDebugInfo ? "'la1'" : "'<local8>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
307 |
"Can not store to null long array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
308 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
309 |
// dastore |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
310 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
311 |
System.out.println(da1[0] = 0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
312 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
313 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
314 |
checkMessage("da1[0] = 0", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
315 |
(hasDebugInfo ? "'da1'" : "'<local9>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
316 |
"Can not store to null double array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
317 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
318 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
319 |
// arraylength |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
320 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
321 |
System.out.println(za1.length); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
322 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
323 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
324 |
checkMessage("za1.length", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
325 |
(hasDebugInfo ? "'za1'" : "'<local4>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
326 |
"Can not read the array length."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
327 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
328 |
// athrow |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
329 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
330 |
throw null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
331 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
332 |
checkMessage("throw null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
333 |
"'null' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
334 |
"Can not throw a null exception object."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
335 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
336 |
// monitorenter |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
337 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
338 |
synchronized (nullInstanceField) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
339 |
// desired |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
340 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
341 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
342 |
checkMessage("synchronized (nullInstanceField)", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
343 |
"'this.nullInstanceField' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
344 |
"Can not enter a null monitor."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
345 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
346 |
// monitorexit |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
347 |
// No test available |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
348 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
349 |
// getfield |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
350 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
351 |
System.out.println(nullInstanceField.nullInstanceField); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
352 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
353 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
354 |
checkMessage("nullInstanceField.nullInstanceField", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
355 |
"'this.nullInstanceField' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
356 |
"Can not read field 'nullInstanceField'."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
357 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
358 |
// putfield |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
359 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
360 |
System.out.println(nullInstanceField.nullInstanceField = null); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
361 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
362 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
363 |
checkMessage("nullInstanceField.nullInstanceField = null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
364 |
"'this.nullInstanceField' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
365 |
"Can not write field 'nullInstanceField'."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
366 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
367 |
// invoke |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
368 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
369 |
nullInstanceField.toString(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
370 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
371 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
372 |
checkMessage("nullInstanceField.toString()", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
373 |
"'this.nullInstanceField' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
374 |
"Can not invoke method 'java.lang.String java.lang.Object.toString()'."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
375 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
376 |
// Test parameter and return types |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
377 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
378 |
Asserts.assertTrue(nullInstanceField.callWithTypes(null, null, 0.0f, 0L, (short)0, false, (byte)0, 0.0, 'x') == 0.0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
379 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
380 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
381 |
checkMessage("nullInstanceField.callWithTypes(null, null, 0.0f, 0L, (short)0, false, (byte)0, 0.0, 'x')", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
382 |
"'this.nullInstanceField' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
383 |
"Can not invoke method 'double NullPointerExceptionTest.callWithTypes(java.lang.String[][], int[][][], float, long, short, boolean, byte, double, char)'."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
384 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
385 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
386 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
387 |
static void test_iload() { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
388 |
int i0 = 0; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
389 |
int i1 = 1; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
390 |
int i2 = 2; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
391 |
int i3 = 3; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
392 |
int i4 = 4; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
393 |
int i5 = 5; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
394 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
395 |
int[][] a = new int[6][]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
396 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
397 |
// iload_0 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
398 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
399 |
a[i0][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
400 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
401 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
402 |
checkMessage("a[i0][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
403 |
(hasDebugInfo ? "'a[i0]'" : "'<local6>[<local0>]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
404 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
405 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
406 |
// iload_1 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
407 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
408 |
a[i1][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
409 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
410 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
411 |
checkMessage("a[i1][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
412 |
(hasDebugInfo ? "'a[i1]'" : "'<local6>[<local1>]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
413 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
414 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
415 |
// iload_2 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
416 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
417 |
a[i2][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
418 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
419 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
420 |
checkMessage("a[i2][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
421 |
(hasDebugInfo ? "'a[i2]'" : "'<local6>[<local2>]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
422 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
423 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
424 |
// iload_3 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
425 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
426 |
a[i3][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
427 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
428 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
429 |
checkMessage("a[i3][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
430 |
(hasDebugInfo ? "'a[i3]'" : "'<local6>[<local3>]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
431 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
432 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
433 |
// iload |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
434 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
435 |
a[i5][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
436 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
437 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
438 |
checkMessage("a[i5][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
439 |
(hasDebugInfo ? "'a[i5]'" : "'<local6>[<local5>]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
440 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
441 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
442 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
443 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
444 |
// Other datatyes than int are not needed. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
445 |
// If we implement l2d and similar bytecodes, we can print |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
446 |
// long expressions as array indexes. Then these here could |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
447 |
// be used. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
448 |
static void test_lload() { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
449 |
long l0 = 0L; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
450 |
long l1 = 1L; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
451 |
long l2 = 2L; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
452 |
long l3 = 3L; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
453 |
long l4 = 4L; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
454 |
long l5 = 5L; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
455 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
456 |
int[][] a = new int[6][]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
457 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
458 |
// lload_0 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
459 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
460 |
a[(int)l0][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
461 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
462 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
463 |
checkMessage("a[(int)l0][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
464 |
(hasDebugInfo ? "'a[...]'" : "'<local12>[...]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
465 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
466 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
467 |
// lload_1 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
468 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
469 |
a[(int)l1][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
470 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
471 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
472 |
checkMessage("a[(int)l1][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
473 |
(hasDebugInfo ? "'a[...]'" : "'<local12>[...]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
474 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
475 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
476 |
// lload_2 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
477 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
478 |
a[(int)l2][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
479 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
480 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
481 |
checkMessage("a[(int)l2][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
482 |
(hasDebugInfo ? "'a[...]'" : "'<local12>[...]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
483 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
484 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
485 |
// lload_3 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
486 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
487 |
a[(int)l3][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
488 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
489 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
490 |
checkMessage("a[(int)l3][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
491 |
(hasDebugInfo ? "'a[...]'" : "'<local12>[...]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
492 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
493 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
494 |
// lload |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
495 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
496 |
a[(int)l5][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
497 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
498 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
499 |
checkMessage("a[(int)l5][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
500 |
(hasDebugInfo ? "'a[...]'" : "'<local12>[...]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
501 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
502 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
503 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
504 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
505 |
static void test_fload() { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
506 |
float f0 = 0.0f; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
507 |
float f1 = 1.0f; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
508 |
float f2 = 2.0f; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
509 |
float f3 = 3.0f; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
510 |
float f4 = 4.0f; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
511 |
float f5 = 5.0f; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
512 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
513 |
int[][] a = new int[6][]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
514 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
515 |
// fload_0 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
516 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
517 |
a[(int)f0][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
518 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
519 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
520 |
checkMessage("a[(int)f0][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
521 |
(hasDebugInfo ? "'a[...]'" : "'<local6>[...]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
522 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
523 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
524 |
// fload_1 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
525 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
526 |
a[(int)f1][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
527 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
528 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
529 |
checkMessage("a[(int)f1][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
530 |
(hasDebugInfo ? "'a[...]'" : "'<local6>[...]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
531 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
532 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
533 |
// fload_2 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
534 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
535 |
a[(int)f2][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
536 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
537 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
538 |
checkMessage("a[(int)f2][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
539 |
(hasDebugInfo ? "'a[...]'" : "'<local6>[...]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
540 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
541 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
542 |
// fload_3 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
543 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
544 |
a[(int)f3][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
545 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
546 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
547 |
checkMessage("a[(int)f3][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
548 |
(hasDebugInfo ? "'a[...]'" : "'<local6>[...]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
549 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
550 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
551 |
// fload |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
552 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
553 |
a[(int)f5][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
554 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
555 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
556 |
checkMessage("a[(int)f5][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
557 |
(hasDebugInfo ? "'a[...]'" : "'<local6>[...]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
558 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
559 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
560 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
561 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
562 |
static void test_aload() { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
563 |
F f0 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
564 |
F f1 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
565 |
F f2 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
566 |
F f3 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
567 |
F f4 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
568 |
F f5 = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
569 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
570 |
// aload_0 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
571 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
572 |
f0.i = 33; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
573 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
574 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
575 |
checkMessage("f0.i", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
576 |
(hasDebugInfo ? "'f0'" : "'<local0>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
577 |
"Can not write field 'i'."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
578 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
579 |
// aload_1 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
580 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
581 |
f1.i = 33; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
582 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
583 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
584 |
checkMessage("f1.i", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
585 |
(hasDebugInfo ? "'f1'" : "'<local1>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
586 |
"Can not write field 'i'."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
587 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
588 |
// aload_2 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
589 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
590 |
f2.i = 33; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
591 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
592 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
593 |
checkMessage("f2.i", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
594 |
(hasDebugInfo ? "'f2'" : "'<local2>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
595 |
"Can not write field 'i'."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
596 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
597 |
// aload_3 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
598 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
599 |
f3.i = 33; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
600 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
601 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
602 |
checkMessage("f3.i", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
603 |
(hasDebugInfo ? "'f3'" : "'<local3>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
604 |
"Can not write field 'i'."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
605 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
606 |
// aload |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
607 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
608 |
f5.i = 33; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
609 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
610 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
611 |
checkMessage("f5.i", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
612 |
(hasDebugInfo ? "'f5'" : "'<local5>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
613 |
"Can not write field 'i'."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
614 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
615 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
616 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
617 |
// Helper class for test cases. |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
618 |
class A { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
619 |
public B to_b; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
620 |
public B getB() { return to_b; } |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
621 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
622 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
623 |
// Helper class for test cases. |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
624 |
class B { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
625 |
public C to_c; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
626 |
public B to_b; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
627 |
public C getC() { return to_c; } |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
628 |
public B getBfromB() { return to_b; } |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
629 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
630 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
631 |
// Helper class for test cases. |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
632 |
class C { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
633 |
public D to_d; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
634 |
public D getD() { return to_d; } |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
635 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
636 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
637 |
// Helper class for test cases. |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
638 |
class D { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
639 |
public int num; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
640 |
public int[][] ar; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
641 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
642 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
643 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
644 |
public void testArrayChasing() { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
645 |
int[][][][][][] a = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
646 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
647 |
a[0][0][0][0][0][0] = 99; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
648 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
649 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
650 |
checkMessage("int[0][0][0][0][0] = 99 // a is null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
651 |
(hasDebugInfo ? "'a'" : "'<local1>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
652 |
"Can not load from null object array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
653 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
654 |
a = new int[1][][][][][]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
655 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
656 |
a[0][0][0][0][0][0] = 99; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
657 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
658 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
659 |
checkMessage("int[0][0][0][0][0] = 99 // a[0] is null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
660 |
(hasDebugInfo ? "'a[0]'" : "'<local1>[0]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
661 |
"Can not load from null object array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
662 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
663 |
a[0] = new int[1][][][][]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
664 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
665 |
a[0][0][0][0][0][0] = 99; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
666 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
667 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
668 |
checkMessage("int[0][0][0][0][0] = 99 // a[0][0] is null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
669 |
(hasDebugInfo ? "'a[0][0]'" : "'<local1>[0][0]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
670 |
"Can not load from null object array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
671 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
672 |
a[0][0] = new int[1][][][]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
673 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
674 |
a[0][0][0][0][0][0] = 99; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
675 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
676 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
677 |
checkMessage("int[0][0][0][0][0] = 99 // a[0][0][0] is null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
678 |
(hasDebugInfo ? "'a[0][0][0]'" : "'<local1>[0][0][0]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
679 |
"Can not load from null object array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
680 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
681 |
a[0][0][0] = new int[1][][]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
682 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
683 |
a[0][0][0][0][0][0] = 99; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
684 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
685 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
686 |
checkMessage("int[0][0][0][0][0] = 99 // a[0][0][0][0] is null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
687 |
(hasDebugInfo ? "'a[0][0][0][0]'" : "'<local1>[0][0][0][0]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
688 |
"Can not load from null object array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
689 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
690 |
a[0][0][0][0] = new int[1][]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
691 |
// Reaching max recursion depth. Prints <array>. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
692 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
693 |
a[0][0][0][0][0][0] = 99; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
694 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
695 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
696 |
checkMessage("int[0][0][0][0][0] = 99 // a[0][0][0][0][0] is null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
697 |
"'<array>[0][0][0][0][0]' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
698 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
699 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
700 |
a[0][0][0][0][0] = new int[1]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
701 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
702 |
a[0][0][0][0][0][0] = 99; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
703 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
704 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
705 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
706 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
707 |
|
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
708 |
public void testPointerChasing() { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
709 |
A a = null; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
710 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
711 |
a.to_b.to_c.to_d.num = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
712 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
713 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
714 |
checkMessage("a.to_b.to_c.to_d.num = 99 // a is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
715 |
(hasDebugInfo ? "'a'" : "'<local1>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
716 |
"Can not read field 'to_b'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
717 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
718 |
a = new A(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
719 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
720 |
a.to_b.to_c.to_d.num = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
721 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
722 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
723 |
checkMessage("a.to_b.to_c.to_d.num = 99 // a.to_b is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
724 |
(hasDebugInfo ? "'a.to_b'" : "'<local1>.to_b'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
725 |
"Can not read field 'to_c'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
726 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
727 |
a.to_b = new B(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
728 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
729 |
a.to_b.to_c.to_d.num = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
730 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
731 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
732 |
checkMessage("a.to_b.to_c.to_d.num = 99 // a.to_b.to_c is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
733 |
(hasDebugInfo ? "'a.to_b.to_c'" : "'<local1>.to_b.to_c'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
734 |
"Can not read field 'to_d'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
735 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
736 |
a.to_b.to_c = new C(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
737 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
738 |
a.to_b.to_c.to_d.num = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
739 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
740 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
741 |
checkMessage("a.to_b.to_c.to_d.num = 99 // a.to_b.to_c.to_d is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
742 |
(hasDebugInfo ? "'a.to_b.to_c.to_d'" : "'<local1>.to_b.to_c.to_d'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
743 |
"Can not write field 'num'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
744 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
745 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
746 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
747 |
public void testMethodChasing() { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
748 |
A a = null; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
749 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
750 |
a.getB().getBfromB().getC().getD().num = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
751 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
752 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
753 |
checkMessage("a.getB().getBfromB().getC().getD().num = 99 // a is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
754 |
(hasDebugInfo ? "'a" : "'<local1>") + "' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
755 |
"Can not invoke method 'NullPointerExceptionTest$B NullPointerExceptionTest$A.getB()'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
756 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
757 |
a = new A(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
758 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
759 |
a.getB().getBfromB().getC().getD().num = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
760 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
761 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
762 |
checkMessage("a.getB().getBfromB().getC().getD().num = 99 // a.getB() is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
763 |
"The return value of 'NullPointerExceptionTest$B NullPointerExceptionTest$A.getB()' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
764 |
"Can not invoke method 'NullPointerExceptionTest$B NullPointerExceptionTest$B.getBfromB()'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
765 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
766 |
a.to_b = new B(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
767 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
768 |
a.getB().getBfromB().getC().getD().num = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
769 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
770 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
771 |
checkMessage("a.getB().getBfromB().getC().getD().num = 99 // a.getB().getBfromB() is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
772 |
"The return value of 'NullPointerExceptionTest$B NullPointerExceptionTest$B.getBfromB()' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
773 |
"Can not invoke method 'NullPointerExceptionTest$C NullPointerExceptionTest$B.getC()'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
774 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
775 |
a.to_b.to_b = new B(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
776 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
777 |
a.getB().getBfromB().getC().getD().num = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
778 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
779 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
780 |
checkMessage("a.getB().getBfromB().getC().getD().num = 99 // a.getB().getBfromB().getC() is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
781 |
"The return value of 'NullPointerExceptionTest$C NullPointerExceptionTest$B.getC()' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
782 |
"Can not invoke method 'NullPointerExceptionTest$D NullPointerExceptionTest$C.getD()'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
783 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
784 |
a.to_b.to_b.to_c = new C(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
785 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
786 |
a.getB().getBfromB().getC().getD().num = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
787 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
788 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
789 |
checkMessage("a.getB().getBfromB().getC().getD().num = 99 // a.getB().getBfromB().getC().getD() is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
790 |
"The return value of 'NullPointerExceptionTest$D NullPointerExceptionTest$C.getD()' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
791 |
"Can not write field 'num'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
792 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
793 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
794 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
795 |
public void testMixedChasing() { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
796 |
A a = null; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
797 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
798 |
a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
799 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
800 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
801 |
checkMessage("a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
802 |
(hasDebugInfo ? "'a'" : "'<local1>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
803 |
"Can not invoke method 'NullPointerExceptionTest$B NullPointerExceptionTest$A.getB()'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
804 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
805 |
a = new A(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
806 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
807 |
a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
808 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
809 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
810 |
checkMessage("a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB() is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
811 |
"The return value of 'NullPointerExceptionTest$B NullPointerExceptionTest$A.getB()' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
812 |
"Can not invoke method 'NullPointerExceptionTest$B NullPointerExceptionTest$B.getBfromB()'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
813 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
814 |
a.to_b = new B(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
815 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
816 |
a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
817 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
818 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
819 |
checkMessage("a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB().getBfromB() is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
820 |
"The return value of 'NullPointerExceptionTest$B NullPointerExceptionTest$B.getBfromB()' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
821 |
"Can not read field 'to_c'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
822 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
823 |
a.to_b.to_b = new B(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
824 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
825 |
a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
826 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
827 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
828 |
checkMessage("a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB().getBfromB().to_c is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
829 |
"'NullPointerExceptionTest$B NullPointerExceptionTest$B.getBfromB().to_c' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
830 |
"Can not read field 'to_d'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
831 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
832 |
a.to_b.to_b.to_c = new C(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
833 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
834 |
a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
835 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
836 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
837 |
checkMessage("a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB().getBfromB().to_c.to_d is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
838 |
"'NullPointerExceptionTest$B NullPointerExceptionTest$B.getBfromB().to_c.to_d' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
839 |
"Can not read field 'ar'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
840 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
841 |
a.to_b.to_b.to_c.to_d = new D(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
842 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
843 |
a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
844 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
845 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
846 |
checkMessage("a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB().getBfromB().to_c.to_d.ar is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
847 |
"'NullPointerExceptionTest$B NullPointerExceptionTest$B.getBfromB().to_c.to_d.ar' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
848 |
"Can not load from null object array."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
849 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
850 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
851 |
a.getB().getBfromB().getC().getD().ar[0][0] = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
852 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
853 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
854 |
checkMessage("a.getB().getBfromB().getC().getD().ar[0][0] = 99; // a.getB().getBfromB().getC().getD().ar is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
855 |
"'NullPointerExceptionTest$D NullPointerExceptionTest$C.getD().ar' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
856 |
"Can not load from null object array."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
857 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
858 |
a.to_b.to_b.to_c.to_d.ar = new int[1][]; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
859 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
860 |
a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
861 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
862 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
863 |
checkMessage("a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB().getBfromB().to_c.to_d.ar[0] is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
864 |
"'NullPointerExceptionTest$B NullPointerExceptionTest$B.getBfromB().to_c.to_d.ar[0]' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
865 |
"Can not store to null int array."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
866 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
867 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
868 |
a.getB().getBfromB().getC().getD().ar[0][0] = 99; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
869 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
870 |
} catch (NullPointerException e) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
871 |
checkMessage("a.getB().getBfromB().getC().getD().ar[0][0] = 99; // a.getB().getBfromB().getC().getD().ar[0] is null", e.getMessage(), |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
872 |
"'NullPointerExceptionTest$D NullPointerExceptionTest$C.getD().ar[0]' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
873 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
874 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
875 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
876 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
877 |
// Helper method to cause test case. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
878 |
private Object returnNull(String[][] dummy1, int[][][] dummy2, float dummy3) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
879 |
return null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
880 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
881 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
882 |
// Helper method to cause test case. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
883 |
private NullPointerExceptionTest returnMeAsNull(Throwable dummy1, int dummy2, char dummy3) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
884 |
return null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
885 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
886 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
887 |
// Helper interface for test cases. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
888 |
static interface DoubleArrayGen { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
889 |
public double[] getArray(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
890 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
891 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
892 |
// Helper class for test cases. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
893 |
static class DoubleArrayGenImpl implements DoubleArrayGen { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
894 |
@Override |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
895 |
public double[] getArray() { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
896 |
return null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
897 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
898 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
899 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
900 |
// Helper class for test cases. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
901 |
static class NullPointerGenerator { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
902 |
public static Object nullReturner(boolean dummy1) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
903 |
return null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
904 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
905 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
906 |
public Object returnMyNull(double dummy1, long dummy2, short dummy3) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
907 |
return null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
908 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
909 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
910 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
911 |
// Helper method to cause test case. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
912 |
public void ImplTestLoadedFromMethod(DoubleArrayGen gen) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
913 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
914 |
(gen.getArray())[0] = 1.0; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
915 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
916 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
917 |
checkMessage("(gen.getArray())[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
918 |
"The return value of 'double[] NullPointerExceptionTest$DoubleArrayGen.getArray()' is null. Can not store to null double array."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
919 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
920 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
921 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
922 |
public void testNullEntity() { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
923 |
int[][] a = new int[820][]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
924 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
925 |
test_iload(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
926 |
test_lload(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
927 |
test_fload(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
928 |
// test_dload(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
929 |
test_aload(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
930 |
// aload_0: 'this' |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
931 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
932 |
this.nullInstanceField.nullInstanceField = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
933 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
934 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
935 |
checkMessage("this.nullInstanceField.nullInstanceField = null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
936 |
"'this.nullInstanceField' is null. Can not write field 'nullInstanceField'."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
937 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
938 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
939 |
// aconst_null |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
940 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
941 |
throw null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
942 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
943 |
checkMessage("throw null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
944 |
"'null' is null. Can not throw a null exception object."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
945 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
946 |
// iconst_0 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
947 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
948 |
a[0][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
949 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
950 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
951 |
checkMessage("a[0][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
952 |
(hasDebugInfo ? "'a[0]'" : "'<local1>[0]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
953 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
954 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
955 |
// iconst_1 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
956 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
957 |
a[1][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
958 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
959 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
960 |
checkMessage("a[1][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
961 |
(hasDebugInfo ? "'a[1]'" : "'<local1>[1]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
962 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
963 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
964 |
// iconst_2 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
965 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
966 |
a[2][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
967 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
968 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
969 |
checkMessage("a[2][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
970 |
(hasDebugInfo ? "'a[2]'" : "'<local1>[2]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
971 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
972 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
973 |
// iconst_3 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
974 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
975 |
a[3][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
976 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
977 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
978 |
checkMessage("a[3][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
979 |
(hasDebugInfo ? "'a[3]'" : "'<local1>[3]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
980 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
981 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
982 |
// iconst_4 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
983 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
984 |
a[4][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
985 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
986 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
987 |
checkMessage("a[4][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
988 |
(hasDebugInfo ? "'a[4]'" : "'<local1>[4]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
989 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
990 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
991 |
// iconst_5 |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
992 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
993 |
a[5][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
994 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
995 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
996 |
checkMessage("a[5][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
997 |
(hasDebugInfo ? "'a[5]'" : "'<local1>[5]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
998 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
999 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1000 |
// long --> iconst |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1001 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1002 |
a[(int)0L][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1003 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1004 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1005 |
checkMessage("a[(int)0L][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1006 |
(hasDebugInfo ? "'a[0]'" : "'<local1>[0]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1007 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1008 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1009 |
// bipush |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1010 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1011 |
a[139 /*0x77*/][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1012 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1013 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1014 |
checkMessage("a[139][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1015 |
(hasDebugInfo ? "'a[139]'" : "'<local1>[139]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1016 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1017 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1018 |
// sipush |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1019 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1020 |
a[819 /*0x333*/][0] = 77; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1021 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1022 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1023 |
checkMessage("a[819][0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1024 |
(hasDebugInfo ? "'a[819]'" : "'<local1>[819]'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1025 |
"Can not store to null int array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1026 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1027 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1028 |
// aaload, with recursive descend. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1029 |
testArrayChasing(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1030 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1031 |
// getstatic |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1032 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1033 |
Asserts.assertTrue(((float[]) nullStaticField)[0] == 1.0f); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1034 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1035 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1036 |
checkMessage("((float[]) nullStaticField)[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1037 |
"'static NullPointerExceptionTest.nullStaticField' is null. Can not load from null float array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1038 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1039 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1040 |
// getfield, with recursive descend. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1041 |
testPointerChasing(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1042 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1043 |
// invokestatic |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1044 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1045 |
Asserts.assertTrue(((char[]) NullPointerGenerator.nullReturner(false))[0] == 'A'); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1046 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1047 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1048 |
checkMessage("((char[]) NullPointerGenerator.nullReturner(false))[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1049 |
"The return value of 'java.lang.Object NullPointerExceptionTest$NullPointerGenerator.nullReturner(boolean)' is null. Can not load from null char array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1050 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1051 |
// invokevirtual |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1052 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1053 |
Asserts.assertTrue(((char[]) (new NullPointerGenerator().returnMyNull(1, 1, (short) 1)))[0] == 'a'); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1054 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1055 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1056 |
checkMessage("((char[]) (new NullPointerGenerator().returnMyNull(1, 1, (short) 1)))[0]", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1057 |
"The return value of 'java.lang.Object NullPointerExceptionTest$NullPointerGenerator.returnMyNull(double, long, short)' is null. Can not load from null char array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1058 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1059 |
// Call with array arguments. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1060 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1061 |
Asserts.assertTrue(((double[]) returnNull(null, null, 1f))[0] == 1.0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1062 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1063 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1064 |
checkMessage("((double[]) returnNull(null, null, 1f))[0] ", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1065 |
"The return value of 'java.lang.Object NullPointerExceptionTest.returnNull(java.lang.String[][], int[][][], float)' is null. Can not load from null double array."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1066 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1067 |
// invokeinterface |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1068 |
ImplTestLoadedFromMethod(new DoubleArrayGenImpl()); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1069 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1070 |
returnMeAsNull(null, 1, 'A').dag = null; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1071 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1072 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1073 |
checkMessage("returnMeAsNull(null, 1, 'A').dag = null", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1074 |
"The return value of 'NullPointerExceptionTest NullPointerExceptionTest.returnMeAsNull(java.lang.Throwable, int, char)' is null. Can not write field 'dag'."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1075 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1076 |
testMethodChasing(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1077 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1078 |
// Mixed recursive descend. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1079 |
testMixedChasing(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1080 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1081 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1082 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1083 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1084 |
public void testCreation() throws Exception { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1085 |
// If allocated with new, the message should not be generated. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1086 |
Asserts.assertNull(new NullPointerException().getMessage()); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1087 |
String msg = new String("A pointless message."); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1088 |
Asserts.assertTrue(new NullPointerException(msg).getMessage() == msg); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1089 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1090 |
// If created via reflection, the message should not be generated. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1091 |
Exception ex = NullPointerException.class.getDeclaredConstructor().newInstance(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1092 |
Asserts.assertNull(ex.getMessage()); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1093 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1094 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1095 |
public void testNative() throws Exception { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1096 |
// If NPE is thrown in a native method, the message should |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1097 |
// not be generated. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1098 |
try { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1099 |
Class.forName(null); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1100 |
Asserts.fail(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1101 |
} catch (NullPointerException e) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1102 |
Asserts.assertNull(e.getMessage()); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1103 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1104 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1105 |
} |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1106 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1107 |
// Test we get the same message calling npe.getMessage() twice. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1108 |
public void testSameMessage() throws Exception { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1109 |
Object null_o = null; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1110 |
String expectedMsg = |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1111 |
(hasDebugInfo ? "'null_o" : "'<local1>") + "' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1112 |
"Can not invoke method 'int java.lang.Object.hashCode()'."; |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1113 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1114 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1115 |
null_o.hashCode(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1116 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1117 |
} catch (NullPointerException npe) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1118 |
String msg1 = npe.getMessage(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1119 |
checkMessage("null_o.hashCode()", msg1, expectedMsg); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1120 |
String msg2 = npe.getMessage(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1121 |
Asserts.assertTrue(msg1.equals(msg2)); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1122 |
// It was decided that getMessage should generate the |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1123 |
// message anew on every call, so this does not hold. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1124 |
//Asserts.assertTrue(msg1 == msg2); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1125 |
Asserts.assertFalse(msg1 == msg2); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1126 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1127 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1128 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1129 |
public void testSerialization() throws Exception { |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1130 |
// NPE without message. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1131 |
Object o1 = new NullPointerException(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1132 |
ByteArrayOutputStream bos1 = new ByteArrayOutputStream(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1133 |
ObjectOutputStream oos1 = new ObjectOutputStream(bos1); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1134 |
oos1.writeObject(o1); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1135 |
ByteArrayInputStream bis1 = new ByteArrayInputStream(bos1.toByteArray()); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1136 |
ObjectInputStream ois1 = new ObjectInputStream(bis1); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1137 |
Exception ex1 = (Exception) ois1.readObject(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1138 |
Asserts.assertNull(ex1.getMessage()); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1139 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1140 |
// NPE with custom message. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1141 |
String msg2 = "A useless message"; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1142 |
Object o2 = new NullPointerException(msg2); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1143 |
ByteArrayOutputStream bos2 = new ByteArrayOutputStream(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1144 |
ObjectOutputStream oos2 = new ObjectOutputStream(bos2); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1145 |
oos2.writeObject(o2); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1146 |
ByteArrayInputStream bis2 = new ByteArrayInputStream(bos2.toByteArray()); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1147 |
ObjectInputStream ois2 = new ObjectInputStream(bis2); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1148 |
Exception ex2 = (Exception) ois2.readObject(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1149 |
Asserts.assertEquals(ex2.getMessage(), msg2); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1150 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1151 |
// NPE with generated message. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1152 |
Object null_o3 = null; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1153 |
Object o3 = null; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1154 |
String msg3 = null; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1155 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1156 |
null_o3.hashCode(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1157 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1158 |
} catch (NullPointerException npe3) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1159 |
o3 = npe3; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1160 |
msg3 = npe3.getMessage(); |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1161 |
checkMessage("null_o3.hashCode()", msg3, |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1162 |
(hasDebugInfo ? "'null_o3'" : "'<local14>'") + " is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1163 |
"Can not invoke method 'int java.lang.Object.hashCode()'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1164 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1165 |
ByteArrayOutputStream bos3 = new ByteArrayOutputStream(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1166 |
ObjectOutputStream oos3 = new ObjectOutputStream(bos3); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1167 |
oos3.writeObject(o3); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1168 |
ByteArrayInputStream bis3 = new ByteArrayInputStream(bos3.toByteArray()); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1169 |
ObjectInputStream ois3 = new ObjectInputStream(bis3); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1170 |
Exception ex3 = (Exception) ois3.readObject(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1171 |
// It was decided that getMessage should not store the |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1172 |
// message in Throwable.detailMessage, thus it can not |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1173 |
// be recovered by serialization. |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1174 |
//Asserts.assertEquals(ex3.getMessage(), msg3); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1175 |
Asserts.assertEquals(ex3.getMessage(), null); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1176 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1177 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1178 |
public void testComplexMessages() { |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1179 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1180 |
staticLongArray[0][0] = 2L; |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1181 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1182 |
} catch (NullPointerException e) { |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1183 |
checkMessage("staticLongArray[0][0] = 2L", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1184 |
"'static NullPointerExceptionTest.staticLongArray[0]' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1185 |
"Can not store to null long array."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1186 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1187 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1188 |
try { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1189 |
Asserts.assertTrue(this.nullInstanceField.nullInstanceField == null); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1190 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1191 |
} catch (NullPointerException e) { |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1192 |
checkMessage("this.nullInstanceField.nullInstanceField", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1193 |
"'this.nullInstanceField' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1194 |
"Can not read field 'nullInstanceField'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1195 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1196 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1197 |
try { |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1198 |
NullPointerExceptionTest obj = this; |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1199 |
Asserts.assertNull(obj.dag.getArray().clone()); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1200 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1201 |
} catch (NullPointerException e) { |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1202 |
checkMessage("obj.dag.getArray().clone()", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1203 |
(hasDebugInfo ? "'obj" : "'<local1>") + ".dag' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1204 |
"Can not invoke method 'double[] NullPointerExceptionTest$DoubleArrayGen.getArray()'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1205 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1206 |
try { |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1207 |
int indexes[] = new int[1]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1208 |
NullPointerExceptionTest[] objs = new NullPointerExceptionTest[] {this}; |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1209 |
Asserts.assertNull(objs[indexes[0]].nullInstanceField.returnNull(null, null, 1f)); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1210 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1211 |
} catch (NullPointerException e) { |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1212 |
checkMessage("objs[indexes[0]].nullInstanceField.returnNull(null, null, 1f)", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1213 |
(hasDebugInfo ? "'objs[indexes" : "'<local2>[<local1>") + "[0]].nullInstanceField' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1214 |
"Can not invoke method 'java.lang.Object NullPointerExceptionTest.returnNull(java.lang.String[][], int[][][], float)'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1215 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1216 |
|
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1217 |
try { |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1218 |
int indexes[] = new int[1]; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1219 |
NullPointerExceptionTest[][] objs = |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1220 |
new NullPointerExceptionTest[][] {new NullPointerExceptionTest[] {this}}; |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1221 |
synchronized (objs[indexes[0]][0].nullInstanceField) { |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1222 |
Asserts.fail(); |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1223 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1224 |
} catch (NullPointerException e) { |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1225 |
checkMessage("synchronized (objs[indexes[0]][0].nullInstanceField)", e.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1226 |
(hasDebugInfo ? "'objs[indexes" : "'<local2>[<local1>" ) + "[0]][0].nullInstanceField' is null. " + |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1227 |
"Can not enter a null monitor."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1228 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1229 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1230 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1231 |
// Generates: |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1232 |
// class E implements E0 { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1233 |
// public int throwNPE(F f) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1234 |
// return f.i; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1235 |
// } |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1236 |
// } |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1237 |
static byte[] generateTestClass() { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1238 |
ClassWriter cw = new ClassWriter(0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1239 |
MethodVisitor mv; |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1240 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1241 |
cw.visit(57, ACC_SUPER, "E", null, "java/lang/Object", new String[] { "E0" }); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1242 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1243 |
{ |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1244 |
mv = cw.visitMethod(0, "<init>", "()V", null, null); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1245 |
mv.visitCode(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1246 |
mv.visitVarInsn(ALOAD, 0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1247 |
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1248 |
mv.visitInsn(RETURN); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1249 |
mv.visitMaxs(1, 1); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1250 |
mv.visitEnd(); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1251 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1252 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1253 |
{ |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1254 |
mv = cw.visitMethod(ACC_PUBLIC, "throwNPE", "(LF;)I", null, null); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1255 |
mv.visitCode(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1256 |
Label label0 = new Label(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1257 |
mv.visitLabel(label0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1258 |
mv.visitLineNumber(118, label0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1259 |
mv.visitVarInsn(ALOAD, 1); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1260 |
mv.visitFieldInsn(GETFIELD, "F", "i", "I"); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1261 |
mv.visitInsn(IRETURN); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1262 |
Label label1 = new Label(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1263 |
mv.visitLabel(label1); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1264 |
mv.visitLocalVariable("this", "LE;", null, label0, label1, 0); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1265 |
mv.visitLocalVariable("f", "LE;", null, label0, label1, 1); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1266 |
mv.visitMaxs(1, 2); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1267 |
mv.visitEnd(); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1268 |
} |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1269 |
cw.visitEnd(); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1270 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1271 |
return cw.toByteArray(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1272 |
} |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1273 |
|
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1274 |
// Tests that a class generated on the fly is handled properly. |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1275 |
public void testGeneratedCode() throws Exception { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1276 |
byte[] classBytes = generateTestClass(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1277 |
Lookup lookup = lookup(); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1278 |
Class<?> clazz = lookup.defineClass(classBytes); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1279 |
E0 e = (E0) clazz.getDeclaredConstructor().newInstance(); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1280 |
try { |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1281 |
e.throwNPE(null); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1282 |
} catch (NullPointerException ex) { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1283 |
checkMessage("return f.i;", |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1284 |
ex.getMessage(), |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1285 |
"'f' is null. Can not read field 'i'."); |
57271
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1286 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1287 |
} |
1735d39dbff9
8218628: Add detailed message to NullPointerException describing what is null.
goetz
parents:
diff
changeset
|
1288 |
} |
57319
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1289 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1290 |
// Helper interface for test cases needed for generateTestClass(). |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1291 |
interface E0 { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1292 |
public int throwNPE(F f); |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1293 |
} |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1294 |
|
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1295 |
// Helper class for test cases needed for generateTestClass(). |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1296 |
class F { |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1297 |
int i; |
aa400d41ebd6
Print methods in Java syntax. Simplify computing the message
goetz
parents:
57272
diff
changeset
|
1298 |
} |