Review Request: JDK-8168205: Should not default class path to CWD if -cp is not specified but -m is specified

Mandy Chung mandy.chung at oracle.com
Thu Oct 27 20:51:26 UTC 2016


> On Oct 27, 2016, at 12:24 PM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> 
> 
>> On 26 Oct 2016, at 22:59, Mandy Chung <mandy.chung at oracle.com> wrote:
>> 
>> Webrev:
>>  http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8168205/webrev.00/index.html
>> 
>> If -cp is not specified and -m is not specified, the builtin system
>> class loader will default the class path to the current working
>> directory.  If -m is specified, no -cp and CLASSPATH environment
>> variable is not set, it should mean no class path.  This patch fixes
>> the case if -m is specified and the value of java.class.path is empty,
>> e.g. via -Djava.class.path option, then no class path should be set.
>> 
>> This patch also updates the launcher code used for generating launcher
>> for JDK tools. As the JDK tool no longer passes any class path, it
>> removes APP_CLASSPATH macro.
>> 
> 
> +1
> 
> I would be inclined to separate out the test for whether JAVA_CLASS_PATH property is present from the class loading tests e.g. if you don’t pass any argument to the Main assert the property value is non-null, otherwise assert on loading a resource.

My apology for missing this.  I have just pushed webrev.01 and missed to include you in the reviewer list.

The main purpose of this test is to verify that CWD is not searched when -m is specified.  The check on the non-null value of “java.class.path” is not strictly needed here.  A slightly better version would be to validate both the expected value of “java.class.path” and expected CWD to be searched or not.  I can improve this test in another patch I’m preparing.

Mandy


More information about the core-libs-dev mailing list