HADOOP-19725. [JDK17] Upgrade SpotBugs Version to Support JDK 17 Compilation.#8028
HADOOP-19725. [JDK17] Upgrade SpotBugs Version to Support JDK 17 Compilation.#8028slfan1989 merged 2 commits intoapache:trunkfrom
Conversation
|
💔 -1 overall
This message was automatically generated. |
|
I have completed the investigation of the mvnsite build issues and confirmed that the problem is related to the JDIFF module. We plan to submit a separate PR to fix and optimize this issue. |
|
@steveloughran Could you please review this PR? Thank you very much! |
|
@Hexiaoqiao Could you please review this PR? Thank you very much! |
szetszwo
left a comment
There was a problem hiding this comment.
@slfan1989 , thanks for working on this! Please see the comments inlined.
| <dependency-check-maven.version>7.1.1</dependency-check-maven.version> | ||
| <spotbugs.version>4.2.2</spotbugs.version> | ||
| <spotbugs-maven-plugin.version>4.2.0</spotbugs-maven-plugin.version> | ||
| <spotbugs.version>4.8.3</spotbugs.version> |
There was a problem hiding this comment.
Why not 4.9.7 (or 4.8.6)?
https://mvnrepository.com/artifact/com.github.spotbugs/spotbugs
There was a problem hiding this comment.
Thank you for reviewing! You made a very good point — I’ll update this PR accordingly.
There was a problem hiding this comment.
spotbugs 4.9 onwards requires JDK 11+, are we ready to drop Java 8 support on trunk?
currently, trunk GitHub Actions site jobs fail due to this upgrade.
There was a problem hiding this comment.
@slfan1989 , we probably should move back to 4.8.x?
@pan3793 , Actually, SpotBugs is build tool but not a runtime library. One option is to run SpotBugs code analysis using jdk11 or above. The runtime still can be built with and run with JDK8. Would it work?
There was a problem hiding this comment.
Thank you all for the discussion! I believe what @szetszwo mentioned makes sense.
Let me explain the situation:
We have upgraded the JDK version in the trunk to JDK 17 and JDK 21. Regarding the issue of mvn site failing to compile, this is a known issue and is unrelated to the SpotBugs plugin.
Here’s a detailed explanation of the two issues:
- The reason for upgrading is that
SpotBugs 4.2.0, as indicated byYetus, does not support scanning for JDK 17 and above. Therefore, we upgraded to a higher version, choosingSpotBugs 4.9.7.From my perspective, upgrading toSpotBugs 4.9.7is reasonable. Although new warning messages have appeared, I do not plan to roll back the version. Issue after upgrading toSpotBugs 4.9.7: Due to the introduction of new rules, new warning messages appeared during compilation. We have formulated a solution:
- Temporary solution: We are filtering out these new warnings globally to mitigate the impact of the new filtering rules. You can refer to the related PR HADOOP-19731. Fix SpotBugs warnings introduced after SpotBugs version upgrade. #8053.
- mvn site compilation failure: This issue is related to our custom annotations, which we can see in the error logs. We already have a solution for this:
- Referring to PR HADOOP-19402. [JDK11] JDiff Support JDK11. #8038. we have rewritten all the annotations under
hadoop-common-project/hadoop-annotations/src/main/java17/org/apache/hadoop/classification/tools/*and added support for JDIFF under JDK 17.
Currently, these two PRs are being followed up by HuaLong. In offline communication, HuaLong mentioned that he is currently on leave, so it may take some more time to complete.
I hope this makes the situation clearer!
| <spotbugs.version>4.2.2</spotbugs.version> | ||
| <spotbugs-maven-plugin.version>4.2.0</spotbugs-maven-plugin.version> | ||
| <spotbugs.version>4.8.3</spotbugs.version> | ||
| <spotbugs-maven-plugin.version>4.7.3.6</spotbugs-maven-plugin.version> |
There was a problem hiding this comment.
Similarly, why not 4.9.7.0 (or 4.8.6.7)?
szetszwo
left a comment
There was a problem hiding this comment.
+1 the change looks good.
Hexiaoqiao
left a comment
There was a problem hiding this comment.
Thanks @slfan1989 . LGTM. +1. I think it is smooth after check spotbug release changes and other apache projects upgrade feedbacks. TBH, I am not check it with new JDK version carefully.
|
💔 -1 overall
This message was automatically generated. |
@Hexiaoqiao Many thanks for reviewing the code! The new Sputbug plugin has been tested on JDK 17 and JDK 21 and works properly. |
|
@szetszwo @steveloughran @Hexiaoqiao @zhtttylz Thank you very much for reviewing the code! |
Description of PR
JIRA: HADOOP-19725. [JDK17] Upgrade SpotBugs Version to Support JDK 17 Compilation.
The error in sputbug is currently caused by incompatibility with JDK 17.
We upgraded
spotbugs.versionfrom 4.2.2 to 4.8.3, andspotbugs-maven-plugin.versionfrom 4.2.0 to 4.7.3.6.How was this patch tested?
CI.
For code changes:
LICENSE,LICENSE-binary,NOTICE-binaryfiles?