Please review -XshowSettings a java launcher option.

Kumar Srinivasan kumar.x.srinivasan at oracle.COM
Fri Nov 12 00:42:47 UTC 2010

Hi Mandy,

> java.c
> line 1031: this doesn't catch invalid option if it has the 
> -XshowSettings prefix e.g. -XshowSettingsJunk.

Will fix it.

> line 1032: Perhaps you could store the suboption ("all", "vm", etc) 
> rather than the entire option string.

I want to keep all the parsing logic as much as possible  in java.

> line 1507-1511: should these lines align with the argument "env"  to 
> CallStaticVoidMethod method in line 1506?
> line 106-109: if optionFlag is just the suboption to -XshowSettings, 
> these lines can be removed.
> line 150-152: Runtime.maxMemory() is not equivalent to -Xmx value.  
> Perhaps -XshowSettings always prints Runtime.maxMemory() and print 
> -Xmx if set in the command line?

That is exactly what is happening ie. if the launcher has been given the 
-Xmx flag
then that is displayed, if not LauncherHelper will use some means to 
display any
value it can get from Java libraries so for now we use Runtime.maxMemory().

> line 176, 188, 190-191, 195, and other lines in printPrintLocales and 
> printLocale methods:
> - the assignment to the buf and out variable to itself (returned from 
> StringBuffer.append() method) is not necessary.

Yes fixed, I missed these.

> line 174: would it be better to pass the StringBuilder to the 
> printPrintValue method so that it can avoid creating a new 
> StringBuilder instance for each property?
We have to create the StringBuilder somewhere it is either in the 
prettyPrintValue or the calling
method, I will convert it to StringBuilder and pass it into 

> line 213-214: same comment as the above.   And should it use 
> StringBuilder instead?


Thanks for the review.!


> Mandy
>> This will print all the known settings/properties/locales
>> supported and known  to Java, this has  been a long standing request.
>> A sample output attached below.
>> Note: the -X option specifically is being used so we can evolve this 
>> option
>> and add more useful information, in future versions of java.
>> Thanks
>> Kumar

More information about the core-libs-dev mailing list