JDK-8042406 : javac.jvm.ClassReader.readClassFile() is using Target to verify valid major versions
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-05-05
  • Updated: 2014-07-01
  • Resolved: 2014-05-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b15Fixed
Related Reports
Relates :  
Description
The set of class file versions we accept for input (in ClassReader) is not necessarily the same as the set of class file versions we support for output.   Therefore ClassReader should not use Target to determine the set of valid class file versions it can accept.
Comments
This bug needs to be fixed before JDK-8011044, which will remove support for -source and -target deprecated options. Specifically, if versions 1.1 through 1.5 are removed from Target, then the build will fail when ClassReader() fails to read class files created by RMIC. These files hold either version number 1.1 or 1.2.
08-05-2014

There are the following references to Target in ClassReader. if (majorVersion > Target.JDK1_8.majorVersion || (majorVersion == Target.JDK1_8.majorVersion && minorVersion >= Target.JDK1_8.minorVersion)) { int maxMajor = Target.MAX().majorVersion; int maxMinor = Target.MAX().minorVersion; Target.MIN().majorVersion * 1000 + Target.MIN().minorVersion) References to Target.JDK1_8 are ugly. It's effectively a feature test for default methods. For now, the correct replacement would be to use V52 instead of Target.JDK1_8. The names of the fields for the major and minor version are slightly different and will need to be updated. References to MIN() and MAX() should be adapted to use javac.jvm.ClassFile.Version The definitions of MIN() and MAX() can be directly copied (cut n paste) from Target to ClassFile.Version
06-05-2014

ClassReader should be more consistent about using com.sun.tools.javac.jvm.ClassFile.Version instead
06-05-2014