JDK-8008343 : Old build of langtools fails when SKIP_BOOT_CYCLE=false
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P2
  • Status: Resolved
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 2013-02-16
  • Updated: 2013-03-29
  • Resolved: 2013-03-29
Related Reports
Relates :  
Description
The fix for JDK-8007113 removed Class.isAnnotationPresent and replaced it with a default method in an interface implemented by Class.  When the resulting jdk build is used to compile test.java which contains a reference to Class.isAnnotationPresent, with option -source 7, an error results saying that method isAnnotationPresent cannot be found in class Class.

The -source 7 causes javac to ignore the default methods in .class files resulting in the error.

This error occurs when a SKIP_BOOT_CYCLE=false build is done using the old build system.
First, the jdk is built with the boot jdk, and then the jdk is rebuilt using the just built jdk.  In this rebuild, the langtoold build is run with -source 7 causing the above failure.  The -source 7 option results from build.properties setting ant property
    boot.javac.source=7

I don't know what happens if a SKIP_BOOT_CYCLE=false build is done with the new build system.

The fix MIGHT be to fix the old langtools build.xml to determine the version of the bootjdk and set the -source option accordingly.

Whether or not the behavior of javac -source 7 .... in the presence of default methods is correct is TBD.



Comments
Verified that old build with SBC=false still works The original cause would have gone away with JDK-8009267
29-03-2013

The methods that were removed from Class have been replaced.
19-03-2013

Seems like there are three issues: 1. Is it correct for javac -source 7 to ignore default methods in existing .class files? What about other new Ver 52 items? 2. If yes, then, do we want to allow an existing public method to be replaced with a default method , which will break compatibility with javac -source 7? 3. If yes, then we have to fix the old langtools build so that it works, eg, don't use -source at all in the build, or add the old jar files to the bootclasspath Note that this problem does not occur with the new build infra - don't yet know why, but I bet it doesn't use -source 7.
18-02-2013