JAVA-2799: Create GraalVM substitutions for Guava's UnsignedBytes#1443
JAVA-2799: Create GraalVM substitutions for Guava's UnsignedBytes#1443absurdfarce wants to merge 3 commits into
Conversation
| <quiet>true</quiet> | ||
| <doclint>all,-missing</doclint> | ||
| <excludePackageNames>com.datastax.*.driver.internal*</excludePackageNames> | ||
| <excludePackageNames>com.datastax.*.driver.internal*,com.datastax.oss.driver.shaded.guava.common.primitives</excludePackageNames> |
There was a problem hiding this comment.
Weirdly this was required... without this change Javadoc generation started failing the build:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28.949 s
[INFO] Finished at: 2020-05-19T13:18:42-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.1.1:jar (attach-javadocs) on project java-driver-core: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - javadoc: error - class file for com.datastax.oss.driver.shaded.guava.errorprone.annotations.CheckReturnValue not found
[ERROR]
[ERROR] Command line was: /work/local/graalvm-ce-java8-19.3.1/jre/../bin/javadoc @options @packages
[ERROR]
[ERROR] Refer to the generated Javadoc files in '/work/git/java-driver/core/target/apidocs' dir.
[ERROR]
[ERROR] -> [Help 1]
I'm not sure where the reference to that class is coming from; it isn't introduced by the new dependency added in this change and isn't in the shaded Guava JAR.
There was a problem hiding this comment.
I think Graal generates the substituted class inside driver-core own classes, i.e. in driver-core/target/classes which is why many tools (javadoc, bundle) are picking it up.
I think you can actually exclude everything that is shaded here, just in case we generate some more substitutions in the future:
<excludePackageNames>com.datastax.*.driver.internal*,com.datastax.*.driver.shaded*</excludePackageNames>
|
This change also winds up splitting the com.datastax.oss.driver.shaded.guava.common.primitives across two JARs (this one and the shaded Guava JAR) which appeared to make the Felix bundler plugin pretty unhappy as well: I get the general idea but I don't understand enough yet about Felix and the bundler plugin to clearly understand how to resolve and/or test something like this. |
|
Split packages are an absolute showstopper in OSGi I'm afraid, so we'll need to find a solution for this. I will investigate tomorrow. |
|
Maybe if you change the For driver-core-shaded, I think we are safe. (I didn't test this yet, this is just a guess from the top of my head) |
|
@absurdfarce as I said here I think we should try to fix this in shaded-guava itself. This would certainly make our javadocs and OSGi problems go away. |
| <dependency> | ||
| <groupId>org.graalvm.nativeimage</groupId> | ||
| <artifactId>svm</artifactId> | ||
| <version>20.0.0</version> |
There was a problem hiding this comment.
Is it safe to hardcode the version of the graal here?
The quarkus takes it from the env runtime variable.
What will happen if someone will try to compile it in earlier versions?
There was a problem hiding this comment.
This lib is only required to gain access to the annotations needed to implement the substitution. So long as the Graal native build respects those annotations there shouldn't be an issue. I've tested this with a toolchain going back to 19.2.1 and it worked without issue so we should be fine.
Note that Quarkus only supports 19.3.1 so even with 19.2.1 we'd be talking about users writing their own apps for Graal and not using Quarkus.
|
Worth noting: we're only "fixing" the shaded Guava artifact with these changes. If a customer also includes a (perhaps different) version of Guava in their classpath they might wind up seeing the warnings in question. I don't think that's necessarily wrong; seems like we should be on the hook to fix our part of this and anything in user-land is something the user should address. I'm also not 100% sure we can (or should) fix this for the base Guava impl either. Perhaps we can mention it in the Graal-specific docs being discussed as part of JAVA-2777 and let users take action with user code as needed. |
|
As discussed in standup: we'll keep the substitutions in java-driver, which means we need to resolve the OSGi issues. |
|
Still haven't had tome to look. Also, we need a proper ticket for capturing the Guava substitutions, JAVA-2782 is for the Quarkus extension and has been migrated. |
|
As discussed offline, it's not that simple. I was hoping to eliminate the split package completely, but that's not possible. I'm not very confident on the idea of allowing this split package to exist, even if we include a strategy for merging split package occurrences. I suggest that we go back to the idea of doing these substitutions inside the guava artifact itself. Just for the record, the substitutions only add new classes, they do not modify existing ones, and from that perspective, they are pretty safe. |
|
Created JAVA-2799 to isolate the changes required to Guava. |
|
After mucking around with the OSGi stuff myself for a while yesterday and today I'm inclined to agree with you @adutra . OSGi just doesn't like this split package concept... well, at least the Maven tools certainly don't Anyways, if we take this path...what do we do to address the versioning question? Do we just add some extra qualifying names to the existing artifact (something like "25.1-jre-graal-subs-1")? |
|
Version of the Guava shaded JAR PR now up at datastax/java-driver-shaded-guava#4. Hopefully this should give us something concrete to look at and compare to. Presumably if we move forward with that change this PR would simply be closed. |
|
We're addressing this in the shaded Guava artifact so I'm closing this out |
No description provided.