absurdfarce commented on PR #2000:
URL: 
https://github.com/apache/cassandra-java-driver/pull/2000#issuecomment-2581367690

   @lukasz-antoniak and I talked through this pretty extensively this 
afternoon.  After digging in a bit it looks like the underlying issue here is 
that the Maven shade plugin moves things around in it's target directory in 
order to create the structure you want for the shaded JAR.  The guava-shaded 
project also contains two Java source files that need to be included in the 
shaded JAR, and it's the intersection of these two behaviours that leads to the 
problem:
   
   * "mvn clean install" compiles everything, including the shaded JAR, and 
installs it into the local Maven repo
   * We switch to a new Java version (Java11 in this case)
   * We then come along and do a "mvn verify", but when Maven checks to see 
whether we have built class files for the two Java classes that are part of 
that project it can't find them (because the shade plugin in the previous step 
moved them around) so it tries to recompile them.  We thus find JVM classes 
with the wrong class version.
   
   We're pretty confident in this diagnosis; we literally watched these 
directories get moved around in real time on the file system while the build 
was happening.
   
   Based on testing @lukasz-antoniak indicates that the fix offered in this PR 
(removing the clean step from the shaded build on a package) will resolve the 
issue.  It's not at all clear how _excluding_ this clean would fix anything, 
though, and I'm reluctant to make a build fix which relies on a mechanism we 
don't understand.
   
   Another option we discussed was seeing if we could move the source files in 
the lib somewhere else; that would leave guava-shaded as supporting only shaded 
artifacts, freeing the shade plugin to move things around at will.  The two 
class files in question are Graal substitutions that came in with 
[JAVA-2799](https://datastax-oss.atlassian.net/browse/JAVA-2799).  In addition 
to this ticket there's a lot of backstory there to consider:
   
   * [JAVA-2782](https://datastax-oss.atlassian.net/browse/JAVA-2782) which 
documents the original source of the problem
   * The cassandra-quarkus 
[issue](https://github.com/datastax/cassandra-quarkus/issues/25) which 
JAVA-2782 was migrated to
   * The [original 
attempt](https://github.com/apache/cassandra-java-driver/pull/1443) to fix this 
issue directly in the Java driver
   * The [subsequent 
attempt](https://github.com/datastax/java-driver-shaded-guava/pull/4) which 
actually did fix this in the old java-driver-guava-shaded lib
   
   If we want to move this functionality somewhere else we should make sure we 
aren't breaking any functionality discussed in that history.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to