Skip to content

Java 9+ support #1120

Closed
Closed

Description

@dustContributor

Hi! I imagine that with how many dependencies there are in a web project these days, these kind of things get pretty complex but I'll ask anyway.

How's Java 9+ support? Modules and all.

The particular reason I'm asking is a few nice syntax additions that are present today in Java 10 (like var) and some that are coming soon (switch expressions, pattern matching, etc).

Activity

  1. jknack commented on Jun 10, 2018

    @jknack
    Member

    I haven't try to run and deploy in Java 9 yet, but all the issues that were reported has been fixed.

    Give it a try and share your experience

  2. aclowkey commented on Jun 10, 2018

    @aclowkey
    Contributor

    +1 We also would be happy for an upgrade to Java 10, what does this entail?

  3. dustContributor commented on Jun 10, 2018

    @dustContributor
    Author

    Give it a try and share your experience

    Yeah you're right, no better test than that 😄 I'll see how it goes, need to read up a bit first.

  4. dustContributor commented on Jun 10, 2018

    @dustContributor
    Author

    Well I setup Maven to compile against Java 10

    <plugin>
    	<groupId>org.apache.maven.plugins</groupId>
    	<artifactId>maven-compiler-plugin</artifactId>
    	<configuration>
    		<!-- Force use of Java 10 -->
    		<source>10</source>
    		<target>10</target>
    		<release>10</release>
    	</configuration>
    </plugin>

    I'm getting this exception in what seems to be Jooby code:

    java.lang.IncompatibleClassChangeError: Inconsistent constant pool data in classfile for class org/jooby/whoops/SourceLocator. Method lambda$local$1(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/lang/String;)Lorg/jooby/whoops/SourceLocator$Source; at index 73 is CONSTANT_MethodRef and should be CONSTANT_InterfaceMethodRef
    

    Somewhere here I guess:
    https://github.com/jooby-project/jooby/blob/master/modules/jooby-whoops/src/main/java/org/jooby/whoops/SourceLocator.java

    If I remove Whoops module altogether, seems to return a Jade view just fine, but then it fails while executing a GET to fetch some data from database.

    Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXB
    	at app//org.jooq.conf.SettingsTools.<clinit>(SettingsTools.java:71)
    	at app//org.jooq.impl.DefaultConfiguration.set(DefaultConfiguration.java:1029)
    	at app//org.jooq.impl.DefaultConfiguration.<init>(DefaultConfiguration.java:506)
    

    That one looks like a jOOQ issue, I should upgade to 3.11 since the developer says it works on Java 10.

  5. aclowkey commented on Jun 13, 2018

    @aclowkey
    Contributor

    @dustContributor Did you try upgrading?
    I upgraded maven-compiler to 10.
    JOOQ to 3.11, which resulted in some naming changes and --add-modules tricks, and I got stuck on having bad generated sources..They're importing jooq.Index classes which don't actually exist in the package

  6. dustContributor commented on Jun 14, 2018

    @dustContributor
    Author

    I upgraded jOOQ, re-generated the classes for my database with the updated codegen, updated jOOQ on my Jooby site, everything works so far.

    The only extra module flag I needed was '--add-modules java.xml.bind'

    The only issue I've had in jOOQ's generated code is a bunch of javax.annotation.Generated imports that should be javax.annotation.processing.Generated instead, which I've already created an issue for in jOOQ's repo.

    In my case, org.jooq.Index class is there in jooq's 3.11.0 jar.

  7. aclowkey commented on Jun 14, 2018

    @aclowkey
    Contributor

    @dustContributor Did you import the package org.jooq:jooq:3.11.0, or org.jooby:jooq:1.4.0? or Both?
    EDIT: Adding org.jooby.jooq dependency solved the issue!

  8. jknack commented on Jun 14, 2018

    @jknack
    Member

    Guys, what else did you find?

    I found we need to upgrade all these libraries for running a simple/small app (JSON API):

    • guice:4.2.0 (but still shows a couple of illegal access warnings)
    • maven-compiler-plugin:3.7.0
    • maven-assembly-plugin:3.1.0 (stork)
      -rest-assured:3.1.0 (for running tests)
  9. aclowkey commented on Jun 15, 2018

    @aclowkey
    Contributor
  10. added
    java9+
    and removed on Jun 15, 2018
  11. added this to the next milestone on Jun 15, 2018
  12. jknack commented on Jun 21, 2018

    @jknack
    Member
  13. ludmiloff commented on Jan 30, 2019

    @ludmiloff
    Contributor

    Working sample: https://github.com/jooby-project/hello-java10-starter

    Sorry for writing on closed issue... and I know it is better to stick with Java 8 for jooby 1.x, but
    still can not get rid of illegal access warnings on Java 10 even after forcing to guice:4.2.2 and maven-compiler-plugin:3.8.0 and/or module-info.java with explicitly added a ton of requires statements, see google/guice#1133
    My pom.xml file looks like the one on the sample project above (except dependencies of my own), using jooby 1.5.1
    Not an issue directly to jooby, it is really a guice problem IMO as commented here
    google/guice#1133

  14. jknack commented on Jan 30, 2019

    @jknack
    Member

    shared the feeling, but we have to deal with it for a bit :(

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementjava9+

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions