[ https://issues.apache.org/jira/browse/CASSANDRA-18190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17711144#comment-17711144 ]
Ekaterina Dimitrova edited comment on CASSANDRA-18190 at 4/11/23 11:24 PM: --------------------------------------------------------------------------- Current state: - there was some discussion in ASF Slack around ecj and it seems the licenses requirements were checked in CASSANDRA-16550. Our releases do not contain EPL code or binary. Our convenience binaries contain the EPL binary, and that's ok. Reading [here|https://www.apache.org/legal/resolved.html#weak-copyleft-licenses] it seems both EPL 1.0 and 2.0 are there so I do not change anything from that perspective that changes that. CC [~mck] (reminder: the newer ecj version is under EPL 2.0, the old current trunk one is EPL 1.0) - The newest version of ecj cannot be used with JDK8, we cannot compile, result from ant jar: {code:java} [javac] /cassandra/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java:56: error: cannot access IProblem [javac] import org.eclipse.jdt.core.compiler.IProblem; [javac] ^ [javac] bad class file: /cassandra/build/lib/jars/ecj-3.33.0.jar(org/eclipse/jdt/core/compiler/IProblem.class) [javac] class file has wrong version 55.0, should be 52.0 [javac] Please remove or make sure it appears in the correct subdirectory of the classpath. [javac] /cassandra/src/java/org/apache/cassandra/utils/Nemesis.java:26: error: cannot find symbol [javac] import static org.apache.cassandra.utils.Nemesis.Traffic.HIGH; [javac] ^ [javac] symbol: static HIGH [javac] location: class {code} This means if we make Cassandra work with latest ecj and JDK11 eclipse warnings, the commit will be blocked on CASSANDRA-18255. ECJ is used in two places - the ant task eclipse-warnings and UDF java functions *About eclipse-warnings:* - it was added in CASSANDRA-9431 with the following goal - Static Analysis to warn on unsafe use of Autocloseable instances That explains why [eclipse_compiler.properties|https://github.com/apache/cassandra/blob/trunk/eclipse_compiler.properties] ignores/disables many of the checks. Now in newer ecj versions there are more compiler options added but we never updated that file for them, I do not have information if that was intentional or not. My wild _guess_ is we just never hit any of them so we did not look into them during upgrades of ecj. I also did not find any info what is the difference between ignore and disabled? [~tjake], [~benedict] do you happen to remember that detail as you were looking into CASSANDRA-9431 where eclipse-warnings was added? - now I tried to run the task with the latest version of ecj which supports Java 11, I changed the source and target to 11 and I am not able to compile. I am getting more than 57 000 errors and many of them are with the following error message: {code:java} Syntax error, parameterized types are only available if source level is 1.5 or greater {code} This tells me it tries earlier JDK versions? My JAVA_HOME points correctly to JDK11 and I verified the task is using the right ecj version jar too. I also realized that similar to [here|https://github.com/apache/cassandra/blob/trunk/build.xml#L1803] we actually need the same add-exports which the help of ecj tells me it is available but I am getting the following error when added in the eclipse-warnings task: {code:java} [java] Unrecognized option : --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED {code} So again I think there is something fishy around the source java version. I plan to probably submit a question to the eclipse ecj community. In the meantime if someone sees something I might be missing - I am open for suggestions and constructive criticism. CC [~jlewandowski] *About the Java UDFs:* - as far as I remember, my testing a few months ago showed Java UDF tests were fixed when we run with the newer version. Also, ecj supports up to Java 19. I guess we need to replace CompilerOptions.VERSION_1_8 with CompilerOptions.VERSION_11 in JavaBasedUDFunction [here|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java#L145-L148]. And I need to look closer for anything else needed there. I was more focused for now on the eclipse warnings. was (Author: e.dimitrova): Current state: - there was some discussion in ASF Slack around ecj and it seems the licenses requirements were checked in CASSANDRA-16550. Our releases do not contain EPL code or binary. Our convenience binaries contain the EPL binary, and that's ok. Reading [here|https://www.apache.org/legal/resolved.html#weak-copyleft-licenses] it seems both EPL 1.0 and 2.0 are there so I do not change anything from that perspective that changes that. CC [~mck] (reminder: the newer ecj version is under EPL 2.0, the old current trunk one is EPL 1.0) - The newest version of ecj cannot be used with JDK8, we cannot compile, result from ant jar: {code:java} [javac] /cassandra/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java:56: error: cannot access IProblem [javac] import org.eclipse.jdt.core.compiler.IProblem; [javac] ^ [javac] bad class file: /cassandra/build/lib/jars/ecj-3.33.0.jar(org/eclipse/jdt/core/compiler/IProblem.class) [javac] class file has wrong version 55.0, should be 52.0 [javac] Please remove or make sure it appears in the correct subdirectory of the classpath. [javac] /cassandra/src/java/org/apache/cassandra/utils/Nemesis.java:26: error: cannot find symbol [javac] import static org.apache.cassandra.utils.Nemesis.Traffic.HIGH; [javac] ^ [javac] symbol: static HIGH [javac] location: class {code} This means if we make Cassandra work with latest ecj and JDK11 eclipse warnings, the commit will be blocked on CASSANDRA-18255. ECJ is used in two places - the ant task eclipse-warnings and UDF java functions *About eclipse-warnings:* - it was added in CASSANDRA-9431 with the following goal - Static Analysis to warn on unsafe use of Autocloseable instances That explains why [eclipse_compiler.properties|https://github.com/apache/cassandra/blob/trunk/eclipse_compiler.properties] ignores/disables many of the checks. Now in newer ecj versions there are more compiler options added but we never updated that file for them, I do not have information if that was intentional or not. My wild _guess_ is we just never hit any of them so we did not look into them during upgrades of ecj. I also did not find any info what is the difference between ignore and disabled? [~tjake], [~benedict] do you happen to remember that detail as you were looking into CASSANDRA-9431 where eclipse-warnings was added? - now I tried to run the task with the latest version of ecj which supports Java 11, I changed the source and target to 11 and I am not able to compile. I am getting more than 57 000 errors and many of them are with the following error message: {code:java} Syntax error, parameterized types are only available if source level is 1.5 or greater {code} This tells me it tries earlier JDK versions? My JAVA_HOME points correctly to JDK11 and I verified the task is using the right ecj version jar too. I also realized that similar to [here|https://github.com/apache/cassandra/blob/trunk/build.xml#L1803] we actually need the same add-exports which the help of ecj tells me it is available but I am getting the following error when added in the eclipse-warnings task: {code:java} [java] Unrecognized option : --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED {code} So again I think there is something fishy around the source java version. I plan to probably submit a question to the eclipse ecj community. In the meantime if someone sees something I might be missing - I am open for suggestions and constructive criticism. CC [~jlewandowski] About the Java UDFs: - as far as I remember, my testing a few months ago showed Java UDF tests were fixed when we run with the newer version. Also, ecj supports up to Java 19. I guess we need to replace CompilerOptions.VERSION_1_8 with CompilerOptions.VERSION_11 in JavaBasedUDFunction [here|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cql3/functions/JavaBasedUDFunction.java#L145-L148]. And I need to look closer for anything else needed there. I was more focused for now on the eclipse warnings. > ECJ upgrade > ----------- > > Key: CASSANDRA-18190 > URL: https://issues.apache.org/jira/browse/CASSANDRA-18190 > Project: Cassandra > Issue Type: Task > Components: Feature/UDF > Reporter: Ekaterina Dimitrova > Assignee: Ekaterina Dimitrova > Priority: Normal > Fix For: 5.x > > > During testing it was identified that we will need to update ECJ for the Java > UDF functions in order to bring Java 17 in. > It seems the compiler artifacts are moved from > [here|https://mvnrepository.com/artifact/org.eclipse.jdt.core.compiler/ecj ] > to [here|https://mvnrepository.com/artifact/org.eclipse.jdt/ecj] and there is > change of license from EPL1.0 to EPL2.0 too. But if I read correctly > [here|https://www.apache.org/legal/resolved.html#weak-copyleft-licenses] that > should not affect us > Further testing and review of all changes between artifacts to be done. > ECJ is used for the eclipse-warnings and Java UDFs -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org