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

Any plans on releasing 2.4 ? #129

Closed
rzo1 opened this issue Sep 27, 2017 · 11 comments
Closed

Any plans on releasing 2.4 ? #129

rzo1 opened this issue Sep 27, 2017 · 11 comments
Assignees
Labels
Milestone

Comments

@rzo1
Copy link

rzo1 commented Sep 27, 2017

Hi,

thanks for your awesome plugin.

However, I was wondering, if you could push forward for 2.4 RELEASE in order to provide Java 9 compatibility.

Thanks in advance...

@uschindler
Copy link
Member

Hi,
2.3 is already Java 9 compatible (it contains Java 9 signatures for unsafe & deprecated stuff). There will be a 2.4 release soon, but that's mainly for Groovy support.

@uschindler
Copy link
Member

What's your issue with Java 9?

@uschindler uschindler self-assigned this Sep 27, 2017
@uschindler
Copy link
Member

I updated ASM to version 6 and removed the interrim class file patching. I also added Java 9 to the official documentation as shipped with release.

A release will come soon!

It would still be nice to get an info what your problem with Java 9 was. There is no change in support for Java 9, so it's unclear why you opened this issue. So if you have seen an issue with Java 9, speak loud, otherwise I will release soon.

@rzo1
Copy link
Author

rzo1 commented Oct 2, 2017

Thanks for your response. Atm, I am waiting for feedback from our developer, who reported this in our Issue tracker. As soon as I have an update, I will report it back to you.

@rzo1
Copy link
Author

rzo1 commented Oct 2, 2017

I got some information for reproducing it and will try to provide more details tomorrow.

@uschindler
Copy link
Member

FYI, I was able to build zlibsvm-master with forbiddenapis 2.3 (after fixing the POM file to work with newer javadoc plugin). I was also able to build the project with source/target 9 instead of 1.8.

If you used another project that fails it would be good to get a hint, but as far as I see, all is fine. Maybe it's an unrelated Maven problem with outdated plugins (like the Javadoc one)?

@rzo1
Copy link
Author

rzo1 commented Oct 3, 2017

Thanks for testing zlibsvm - this project behaves as expected with version 2.3

Setup:

  • Windows 10 64bit
  • JDK 9:
java -version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
  • Maven: 3.3.9 (also with 3.5.0)
  • Maven Java Doc Plugin: 3.0.0-M1

Build our (sadly, closed source) API with 2.3 on the above setup, Maven output is:

[ERROR] Failed to execute goal de.thetaphi:forbiddenapis:2.3:check (default) on project tp-api: Check for forbidden API calls failed: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlType -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal de.thetaphi:forbiddenapis:2.3:check (default) on project tp-api: Check for forbidden API calls failed: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlType
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Check for forbidden API calls failed: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlType
	at de.thetaphi.forbiddenapis.maven.AbstractCheckMojo.execute(AbstractCheckMojo.java:446)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 21 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlType
	at de.thetaphi.forbiddenapis.Checker.getClassFromClassLoader(Checker.java:314)
	at de.thetaphi.forbiddenapis.Checker.lookupRelatedClass(Checker.java:326)
	at de.thetaphi.forbiddenapis.ClassScanner.checkClassUse(ClassScanner.java:120)
	at de.thetaphi.forbiddenapis.ClassScanner.checkAnnotationDescriptor(ClassScanner.java:216)
	at de.thetaphi.forbiddenapis.ClassScanner.visitAnnotation(ClassScanner.java:255)
	at de.thetaphi.forbiddenapis.asm.ClassReader.accept(Unknown Source)
	at de.thetaphi.forbiddenapis.asm.ClassReader.accept(Unknown Source)
	at de.thetaphi.forbiddenapis.Checker.checkClass(Checker.java:602)
	at de.thetaphi.forbiddenapis.Checker.run(Checker.java:619)
	at de.thetaphi.forbiddenapis.maven.AbstractCheckMojo.execute(AbstractCheckMojo.java:444)
	... 23 more

Building it with JDK 8 (and version 2.3) works out of the box. I added a sample project to reproduce this behaviour: https://github.com/rzo1/forbidden-api-issue

Same behaviour also appears for latest 2.4-SNAPSHOPT from this repository. Using a JDK 8, it will process it without printing this stacktrace.

Maybe, I overlook something... ?

EDIT: Okay... this is related to https://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j and JDK-9 - sorry for bothering you.

Would it be possible to apply something similar to the javadoc plugin <additionalparam>--add-modules java.xml.bind</additionalparam> with forbiddenapis?

@uschindler
Copy link
Member

Hi,
this issue was already discussed in the issue tracker. See issue #127. A quick workaround is also described there!

The problems comes from the fact that forbiddenapis runs in the same JVM as Maven. And Maven cannot see JAXB classes, because they were removed from Java 9's default classpath. When compiling stuff with javac this works, as the compiler runs in a separate process where you may use --add-modules. For forbiddenapis you may need to pass --add-modules in MAVEN_OPTS. Alternatively use the described workaround.

I will release 2.4 later this evening.

@uschindler uschindler added this to the 2.4 milestone Oct 3, 2017
@rzo1
Copy link
Author

rzo1 commented Oct 3, 2017

@uschindler Would it be possible to apply something similar to the javadoc plugin --add-modules java.xml.bind with forbiddenapis?

@uschindler
Copy link
Member

uschindler commented Oct 3, 2017

No, because it runs inside Maven's process. Javadoc gets forked.

You can pass a parameter to disable some checks, see related issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants