7.10.1 -XX:HitachiCallToString
-XX:HitachiCallToString outputs the character strings of the String objects that were obtained via a local variable object in the applicable class, as strings that represent variable values.
Description
-XX:HitachiCallToString outputs the character strings of the String objects that were obtained via a local variable object in a class corresponding to applicable_range, as strings that represent variable values.
Note that, if there are no objects stored in the local variable or the objects are Java VM internal objects, the local variable information is not output.
- Prerequisite option
-
-
-XX:+HitachiLocalsInThrowable
-
Syntax
-XX:HitachiCallToString=applicable_range
Specifiable values
- applicable_range
-
Type: String
Specify minimal or full.
- minimal
-
The following classes in the package java.lang are targets:
-
String
-
StringBuffer
-
Boolean
-
Byte
-
Character
-
Short
-
Integer
-
Long
-
Float
-
Double
Note that the target classes when a null character ("") is specified are the same as those when minimal is specified.
-
- full
-
All classes and array types are targets.
Examples
Examples of output (in the simple output format) when the following Java program example is used are shown below.
- Java program example
class Example3 { public static void main(String[] args) { Example3 e3 = new Example3(); e3.method(); // 4th line } void method() { String l1 = "local 1"; StringBuffer l2 = new StringBuffer(l1); l2.append(" + local 2"); Boolean l3 = new Boolean(false); Character l4 = new Character('X'); Long l5 = new Long(Long.MIN_VALUE); // Minimum value of the long data type Object l6 = new Thread(); Object[] l7 = new Thread[10]; try { <An exception occurred!> // 18th line } catch (Exception e) { e.printStackTrace(); } } public String toString() { return "I am an Example3 instance."; } }
- Example 1
-
When -XX:HitachiCallToString=minimal is specified:
at Example3.method(Example3.java:18) locals: (Example3) this = <0xaa07db58> (java.lang.String) l1 = <0xae173a28> "local 1" (java.lang.StringBuffer) l2 = <0xaa07dca0> "local 1 + local 2" (java.lang.Boolean) l3 = <0xaa07de18> "false" (java.lang.Character) l4 = <0xaa07df68> "X" (java.lang.Long) l5 = <0xaa07e078> "-9223372036854775808" (java.lang.Object) l6 = <0xaa07e1a8> (java.lang.Object[]) l7 = <0xaa07e298> at Example3.main(Example3.java:4) locals: ...
- Example 2
-
When -XX:HitachiCallToString=full is specified:
at Example3.method(Example3.java:18) locals: (Example3) this = <0xaa07db58> "I am an Example3 instance." (java.lang.String) l1 = <0xae173a28> "local 1" (java.lang.StringBuffer) l2 = <0xaa07dca0> "local 1 + local 2" (java.lang.Boolean) l3 = <0xaa07de18> "false" (java.lang.Character) l4 = <0xaa07df68> "X" (java.lang.Long) l5 = <0xaa07e078> "-9223372036854775808" (java.lang.Object) l6 = <0xaa07e1a8> "Thread[Thread-0,5,main]" (java.lang.Object[]) l7 = <0xaa07e298> "[Ljava.lang.Thread;@26e431" at Example3.main(Example3.java:4) locals: ...
Notes
To collect all local variable information, when you create the class file by using javac, you must embed local variable information in the class file by specifying the -g option or the -g:vars option. If you create the class file without specifying either the -g option or the -g:vars option, the local variable information will be output within the collectable range.
Note that the specification of full is not supported in version 10-00 and later.