I want to see the values of the created string objects in the system. To do this, I override String.class using the Xbootclasspath option. In my new override class, I modified the String.class constructors by adding a System.out.println (value) line to each line, such that
public String() {
this.offset = 0;
this.count = 0;
this.value = new char[0];
System.out.println(value);
}
But I got an error,
Error occurred during initialization of VM
java.lang.ExceptionInInitializerError
at java.lang.Runtime.loadLibrary0(Runtime.java:819)
at java.lang.System.loadLibrary(System.java:1030)
at java.lang.System.initializeSystemClass(System.java:1077)
Caused by: java.lang.NullPointerException
at java.lang.String.<init>(String.java:219)
at java.lang.StringBuilder.toString(StringBuilder.java:430)
at java.io.File.<clinit>(File.java:167)
at java.lang.Runtime.loadLibrary0(Runtime.java:819)
at java.lang.System.loadLibrary(System.java:1030)
at java.lang.System.initializeSystemClass(System.java:1077)
If anyone can tell me how to see the created string objects, I would be very happy.
source
share