RFR 8058569: Update java/lang/invoke/lambda tests to eliminate dependency on sun.tools.jar.Main

Amy Lu amy.lu at oracle.com
Wed Sep 17 15:29:41 UTC 2014

Hi, David

Thank you for your review!

Here's the updated version, run jar tool directly:
webrev: http://cr.openjdk.java.net/~tyan/amylu/8058569/webrev.02/

com.sun.tools.javac.Main is not reported as internal API so far (see 
below jdeps result before the fix), if this changed in the future, it 
will be fixed in a separate bug.

Before the fix:
$ $TEST_JAVA/bin/jdeps -jdkinternals $CLASSES_DIR
lambda -> jdk.dev
    LUtils (lambda)
       -> sun.tools.jar.Main JDK internal API (jdk.dev)
    LambdaAccessControlDoPrivilegedTest (lambda)
       -> sun.tools.jar.Main JDK internal API (jdk.dev)

Warning: JDK internal APIs are unsupported and private to JDK 
implementation that are
subject to be removed or changed incompatibly and could break your 
Please modify your code to eliminate dependency on any JDK internal APIs.
For the most recent update on JDK internal API replacements, please check:

JDK Internal API                         Suggested Replacement
----------------                         ---------------------
sun.tools.jar.Main                       Use java.util.jar or jar tool 
@since 1.2


On 9/17/14, 8:31 AM, David Holmes wrote:
> Hi Amy,
> On 17/09/2014 1:49 AM, Amy Lu wrote:
>> Some java/lang/invoke/lambda tests have dependency on sun.tools.jar.Main
>> This fix is to remove above internal JDK API dependency from the tests.
>> bug: https://bugs.openjdk.java.net/browse/JDK-8058569
>> webrev: http://cr.openjdk.java.net/~tyan/amylu/8058569/webrev.01/
> I'm a little confused as to the issue here. Running the jar tool 
> programmatically as a Java program doesn't seem like a big deal, but 
> if it is then just run the the jar tool directly (this test is a 
> JDK-only test either way); or remove the static dependency with 
> reflection based code. Plus the same code still has this dependency:
>      static final com.sun.tools.javac.Main javac =
>               new com.sun.tools.javac.Main();
> so I don't see that anything is being gained at the moment.
> Is there a bigger picture that this is part of?
> Thanks,
> David
>> Thanks,
>> Amy

More information about the core-libs-dev mailing list