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>
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