Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure with Java 11 and --release #235

Closed
jcflack opened this issue Oct 15, 2019 · 1 comment
Closed

Build failure with Java 11 and --release #235

jcflack opened this issue Oct 15, 2019 · 1 comment

Comments

@jcflack
Copy link
Contributor

jcflack commented Oct 15, 2019

f0bb8b5 (and several later commits) introduced uses of the newFactory methods of javax.xml.stream.XML{Input,Output}Factory. These methods are present in all Java versions we intend to support, back to Java 6. They are documented in the
Java 6 API docs, and can be confirmed with javap in the rt.jar of an IcedTea-6 installation.

There was never a problem until c3b47c9 altered the POM to use javac's --release 6 option when compiling with a 9 to 11 javac, rather than the -source/-target options formerly used. The --release option goes further than checking source compatibility, and checks that all API used was present in the targeted release. To do that, it relies on .sig files (which are really .class files stripped down to only API signatures) that ship in the ct.sym file (which is really a jar) in the JDK's lib directory.

Extracting the 6/javax/xml/stream/XML{In,Out}putFactory.sig files from ct.sym and examining them with javap shows that they are missing the newFactory methods, leading javac to report incorrectly that the methods weren't available in 6.

Building with Java 12 isn't a problem, because it no longer supports Java 6, and the POM already adjusts the --release option in that case to 7, and the methods are not missing from the shipped signatures for 7.

The best fix is probably to change all of the uses to the equivalent newInstance() methods, which are properly found in the .sig files. (There was one newFactory method on XMLOutputFactory that had to be deprecated because of a typo, and a corresponding one in XMLInputFactory that was also deprecated for consistency, but neither of those appears in PL/Java.)

Making a new issue, first reported in a comment on #212.

See also: JEP247

jcflack added a commit that referenced this issue Oct 15, 2019
As reported in issue #235, the --release option in newer javac
versions will check against a ct.sym file included in the jdk
that is meant to record what API was available in which prior
releases, and that file (at least as shipped in Java 11) is
missing the newFactory() methods on XMLInputFactory and
XMLOutputFactory for release 6, so it reports them not found.

Happily, both no-arg newFactory() methods are equivalent to
the no-arg newInstance() methods. Deprecation tags were added
to the newInstance(String,ClassLoader) methods, but not to
the no-arg ones.
@jcflack
Copy link
Contributor Author

jcflack commented Oct 29, 2019

Believed resolved in 1.5.4.

@jcflack jcflack closed this as completed Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant