Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lyo-dev] Generator Backward Compatibility
  • From: Jan-Patrick Osterloh <osterloh@xxxxxxxx>
  • Date: Fri, 22 Nov 2019 13:09:46 +0100
  • Autocrypt: addr=osterloh@xxxxxxxx; prefer-encrypt=mutual; keydata= mQINBFaYzvABEAC6kSTwexU5Zme4Zc21MF2Zy+fsv8/nLPVgeTTGCY/3RJEoqpMzd+Ox7JR3 iSMkItkxTHu6Giw8YcMNbTM5ptoSTryDRMjLXvvMTmaWhPBlv66gvy6KJwfLawkQAubJKj32 rh1/7r9eT4s7iDSTLcabyHHx/9Ogvhm7feRwOvRB9u7ukcI7m4fEDZscvVZKwlcGD3wr1OtY BQIOhhEzS6XvumVTgLBN5NgtEk5MlAmFIQaBxYDt47D1QsDu7991Z2iFTuuybqrJL0vo8PAA Sqtjo0cSQu12NqU78D3zCOG8hU+kiXKW2DdmXnmkbyH1K/yztwSpNfbbOpi17CeD1snmAAEY akTtZKkVvtTa3Xg3GQ6yU/GVxFEZ+cLDViRSStL1gi5mnRHbHY7IyoEx1W/+GYPv5ripe2aB Y9c1a9l/1bLxWXAKwbD9haCHZ19lMfvF0eGn4Li3HyB5YHnhCCapoxIJJnOuDGPvaB5H+qv1 p8cxqN7p24Z6v3NZ0b7sEtQNHnq9IvJ2sSUVpHk9hy93ZNdAg3TqrQ09kN7elXxPy3xQ5OLr Q/PZTGi8bRMSShzSm8KPZy1FKzSWbYTLOtiw6HeM2s7tl+lPVD2+UH0mWleXPfZ7iaIwKa7m XlkwUSgh2dc5LvWBVCz0LiXz1NBiqrT70czodA62l1pQYLno2wARAQABtChKYW4tUGF0cmlj ayBPc3RlcmxvaCA8b3N0ZXJsb2hAb2ZmaXMuZGU+iQJCBBMBCAAsAhsjBwsJCAcDAgEGFQgC CQoLBBYCAwECHgECF4ACGQEFAluWVmQFCQbeuvQACgkQlxtC0YJWygwFGRAAgNfQK1yfY5Wf Mzz9W0JXdQZUwEg3rR4fLMNxwpu1q7OmEF784qKJ2CI0UeiUOozOGR4T8n2HhohW4P/iYSyV dR6Dsl7N/HBXZTUU4xCIFG6nSd/x6mcHC4pclcJbSUcnqChS3+cfMHL04V3unsidhI7qNO5k qyuPHfJPEHJdSOXYgdIkEFpwG8r8FLCuMOo5EXxMBQHCzbic7UE5jt5Rnz3YirQJwfhheDkj FvAh8QUUDN9mReDu7GKZkbfJfoyantLRnwjfQOmtUoDTZpUK09GGKEQAiKtge47FS5hCihpI K8OjAeLQ4XA4ZOExtmI5MaVCLZDXlkXJJlK8zhNFgVFZbGD+WVWpvHD24NShjPrdGMn2PhtY r3Q2m54PLY2ZhpRsGYrI53CLXPDvKaDzfZa+YysBsUe7CCAMHh/ZPKJhPGO1DSSK7DS3tR3s cn84OZRH3i/oSiktjsmnx/iitfVmSt279J8keKEyGtUvsI24i6WPEpldsYaVHdh0I5LVZBn6 y4DFOuJkCOO5dqhNIJC6KnQDcRXFq0MHdeKigUjdh1Rz5IJvf0SiOvRTuhzDUbTg9972jfeF YrWbjO2DWgdAwQ3+i7CiqvPdxMceiUsagALvHvUe5tdwUtRQXFpxcqb5jMTZsY/pQJouh/jZ 0+EYnS4iDVP7vzrxLEEhY5s=
  • Delivered-to: lyo-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/lyo-dev>
  • List-help: <mailto:lyo-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/lyo-dev>, <mailto:lyo-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/lyo-dev>, <mailto:lyo-dev-request@eclipse.org?subject=unsubscribe>
  • Openpgp: preference=signencrypt
  • User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1

Ok, my error. I had maven set to java source compatibility to 1.7, which was the initial JDK we had on this server. I just found out, that the server has been upgraded since then to 1.8 without my knowledge. That's why it probably worked...

Thanks for your support, and have a nice weekend.

Best regards
Jan-Patrick


Am 21.11.2019 um 20:07 schrieb Andrii Berezovskyi:

Hello Jan-Patrick,

 

We have upgraded to JDK8 long time ago. While technically possible to backport, it is not just the lambdas. Some parts of the code in core and other places already use Java 8 Streams. All bytecode targets 1.8. Stream API was the main reason to drop JDK7.

 

I am surprised how other parts of Lyo were still working for you before this change. You should add https://stackoverflow.com/questions/26559830/required-java-version-of-maven-dependency to your code and try rejecting all libs compiled with the JDK above 1.7. If you are ready to go over all code in Lyo that uses lambdas or streams and rewrite it in Java 7 syntax, we can consider merging it, I don’t mind supporting more Java versions. Otherwise, we don’t have the capacity to make the change. If Lyo seriously wants to extend version support, we should consider migrating all code to Kotlin. Kotlin allows using all Java 13 features plus many more while compiling to Java 6 bytecode.  Something tells me Lyo will not be the only library to fail the check. I just added maven-enforcer-plugin configuration to reject all bytecode in deps above JDK 1.7 and here is the list of deps that have JDK 1.8 bytecode:

 

Rule 0: org.apache.maven.plugins.enforcer.EnforceBytecodeVersion failed with message:

 

 

Found Banned Dependency: javax.ws.rs:javax.ws.rs-api:jar:2.1

Found Banned Dependency: org.apache.jena:jena-shaded-guava:jar:3.12.0

Found Banned Dependency: org.apache.jena:jena-tdb2:jar:3.12.0

Found Banned Dependency: org.apache.jena:jena-arq:jar:3.12.0

Found Banned Dependency: org.apache.jena:jena-base:jar:3.12.0

Found Banned Dependency: org.apache.jena:jena-rdfconnection:jar:3.12.0

Found Banned Dependency: org.apache.jena:jena-iri:jar:3.12.0

Found Banned Dependency: org.apache.jena:jena-tdb:jar:3.12.0

Found Banned Dependency: org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.27

Found Banned Dependency: org.apache.jena:jena-dboe-base:jar:3.12.0

Found Banned Dependency: com.github.jsonld-java:jsonld-java:jar:0.12.3

Found Banned Dependency: org.apache.jena:jena-dboe-index:jar:3.12.0

Found Banned Dependency: org.glassfish.jersey.core:jersey-client:jar:2.27

Found Banned Dependency: org.glassfish.jersey.media:jersey-media-jaxb:jar:2.27

Found Banned Dependency: org.apache.jena:jena-dboe-transaction:jar:3.12.0

Found Banned Dependency: org.apache.jena:jena-dboe-trans-data:jar:3.12.0

Found Banned Dependency: org.apache.jena:jena-core:jar:3.12.0

 

There are critical security vulnerabilities in Jena below 3.12, we are not ready to go back to its older versions. Also, it is decided that Lyo 4.0 will update to JAX-RS 2.0. Plus, extended commercial support (which I doubt  many of us here have) end in June 2020 for JDK7: https://access.redhat.com/articles/1299013. I am pretty sure you have unsupported Java version on your server.

 

Cheers,

Andrew

 

P.S. Maven Enforcer config (run ‘mvn clean validate’ to trigger it):

 

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-enforcer-plugin</artifactId>
  <version>3.0.0-M2</version>
  <executions>
    <execution>
      <id>enforce-versions</id>
      <goals>
        <goal>enforce</goal>
      </goals>
      <configuration>
        <rules>
          <bannedPlugins>
            <!-- will only display a warning but does not fail the build. -->
            <level>WARN</level>
            <excludes>
              <exclude>org.apache.maven.plugins:maven-verifier-plugin</exclude>
            </excludes>
            <message>Please consider using the maven-invoker-plugin (http://maven.apache.org/plugins/maven-invoker-plugin/)!</message>
          </bannedPlugins>
          <requireMavenVersion>
            <version>3.1</version>
          </requireMavenVersion>
          <requireJavaVersion>
            <version>1.8</version>
          </requireJavaVersion>
          <requireOS>
            <family>unix</family>
          </requireOS>
        </rules>
      </configuration>
    </execution>
    <execution>
      <id>enforce-bytecode-version</id>
      <goals>
        <goal>enforce</goal>
      </goals>
      <configuration>
        <rules>
          <enforceBytecodeVersion>
            <maxJdkVersion>7</maxJdkVersion>
          </enforceBytecodeVersion>
        </rules>
        <fail>true</fail>
      </configuration>
    </execution>
  </executions>
  <dependencies>
    <dependency>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>extra-enforcer-rules</artifactId>
      <version>1.2</version>
    </dependency>
  </dependencies>
</plugin>

 

 

From: <lyo-dev-bounces@xxxxxxxxxxx> on behalf of Jan-Patrick Osterloh <osterloh@xxxxxxxx>
Reply to: Lyo project developer discussions <lyo-dev@xxxxxxxxxxx>
Date: Thursday, 21 November 2019, W47 at 17:18
To: "lyo-dev@xxxxxxxxxxx" <lyo-dev@xxxxxxxxxxx>
Subject: [lyo-dev] Generator Backward Compatibility

 

Hi,

I just updated to Lyo Code Generator 4.0.0.201911060911.

When I now generate my code, in my "ServletListener", the following get's generated:

private static String generateBasePath(final ServletContextEvent servletContextEvent, String basePathEnvKey, String basePathContextPropertyKey, String fallbackBase) {
    String base = getBasePathFromEnvironment(basePathEnvKey).orElseGet(() -> getBasePathFromContext(servletContextEvent, basePathContextPropertyKey).orElseGet(() -> fallbackBase));
    UriBuilder builder = UriBuilder.fromUri(base);
    return builder.path(servletContextEvent.getServletContext().getContextPath()).build().toString();
}


Unfortunately, my Server is still on JDK 1.7 (I'll ask for an update, but I don't know if this will be possible). Lambdas are only for JDK > 1.7, and thus this breaks my code generation. With eclipse I can easily transform it back, but it is regenerated every time...

And I had to CreationDialogs defined, but the generated code resulted in multiple Compile errors in eclipse: in the FromHTML there where some "new URI...", and the compiler complained about missing URI...Exceptions. I cant remember exactly, because I deleted the Dialogs to fix this, since I don't need them...

Best
Jan-Patrick


-- 
Dipl. Inform. Jan-Patrick Osterloh
Senior Research Engineer
Human Centered Design Group
 
OFFIS e.V. - Institut für Informatik | Institute for Information Technology
             FuE Bereich Verkehr     | R&D Division Transportation
             Escherweg 2, 26121 Oldenburg - Germany
Room:        D107
Phone/Fax:   +49 441 97 22-524 / -502
E-Mail:      osterloh@xxxxxxxx
URL:         http://www.offis.de 
 
Registergericht: Amtsgericht Oldenburg VR 1956
Vorstand: Prof. Dr.-Ing. Wolfgang H. Nebel (Vorsitzender),
          Prof. Dr. techn. Susanne Boll-Westermann,
          Prof. Dr.-Ing. Axel Hahn,
          Prof. Dr.-Ing. Andreas Hein,
          Prof. Dr. Sebastian Lehnhoff 
 
Unsere Hinweise zum Datenschutz sind abrufbar unter: 
https://www.offis.de/datentransparenz.html

_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/lyo-dev

-- 
Dipl. Inform. Jan-Patrick Osterloh
Senior Research Engineer
Human Centered Design Group

OFFIS e.V. - Institut für Informatik | Institute for Information Technology
             FuE Bereich Verkehr     | R&D Division Transportation
             Escherweg 2, 26121 Oldenburg - Germany
Room:        D107
Phone/Fax:   +49 441 97 22-524 / -502
E-Mail:      osterloh@xxxxxxxx
URL:         http://www.offis.de 

Registergericht: Amtsgericht Oldenburg VR 1956
Vorstand: Prof. Dr.-Ing. Wolfgang H. Nebel (Vorsitzender),
          Prof. Dr. techn. Susanne Boll-Westermann,
          Prof. Dr.-Ing. Axel Hahn,
          Prof. Dr.-Ing. Andreas Hein,
          Prof. Dr. Sebastian Lehnhoff 

Unsere Hinweise zum Datenschutz sind abrufbar unter: 
https://www.offis.de/datentransparenz.html

Back to the top