Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HADOOP-19375. Organize JDK version-specific code in IDEA friendly approach #7245

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

pan3793
Copy link
Member

@pan3793 pan3793 commented Dec 24, 2024

Description of PR

The Hadoop codebase has some JDK version-specific code, and uses maven-compiler-plugin to exclude the specific packages, while IDEA does not work well for this plugin. For example, when setting project JDK to Java 17, the IDEA still loads those excluded source code and complains of class reference issues.
image

The PR proposes to use build-helper-maven-plugin to organize JDK version-specific code, which gets better support from IDEA.

BTW, hadoop-common also uses the same way to organize the arch-specific code, in src/main/arm-java.

How was this patch tested?

IntelliJ IDEA 2024.3.1.1 (Community Edition)
Build #IC-243.22562.218, built on December 18, 2024
Runtime version: 21.0.5+8-b631.28 aarch64 (JCEF 122.1.9)
macOS 15.2

When setting the project JDK to Java 8
image

When setting the project JDK to Java 17
image

Also, verified by running mvn clean install -DskipTests in both Java 8 and 17.

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

@@ -39,7 +39,7 @@

<profiles>
<profile>
<id>jdk1.8</id>
<id>jdk8</id>
<activation>
<jdk>1.8</jdk>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maven supports both 1.8 and 8, but seems IDEA only supports 1.8

@pan3793
Copy link
Member Author

pan3793 commented Dec 24, 2024

cc @jojochuang

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 17m 34s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+0 🆗 xmllint 0m 0s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 6m 47s Maven dependency ordering for branch
+1 💚 mvninstall 30m 15s trunk passed
+1 💚 compile 16m 37s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 compile 15m 8s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 checkstyle 4m 14s trunk passed
+1 💚 mvnsite 2m 13s trunk passed
+1 💚 javadoc 2m 7s trunk passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 2m 34s trunk passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 4m 9s trunk passed
+1 💚 shadedclient 35m 26s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 32s Maven dependency ordering for patch
+1 💚 mvninstall 1m 21s the patch passed
+1 💚 compile 15m 42s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javac 15m 42s the patch passed
+1 💚 compile 15m 16s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 javac 15m 16s root-jdkPrivateBuild-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga generated 0 new + 35 unchanged - 9 fixed = 35 total (was 44)
-1 ❌ blanks 0m 0s /blanks-eol.txt The patch has 35 line(s) that end in blanks. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
+1 💚 checkstyle 4m 15s root: The patch generated 0 new + 0 unchanged - 21 fixed = 0 total (was 21)
+1 💚 mvnsite 2m 13s the patch passed
+1 💚 javadoc 2m 0s the patch passed with JDK Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 2m 37s the patch passed with JDK Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
+1 💚 spotbugs 4m 30s the patch passed
+1 💚 shadedclient 35m 34s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 0m 39s hadoop-annotations in the patch passed.
+1 💚 unit 272m 14s hadoop-hdfs in the patch passed.
+1 💚 asflicense 1m 13s The patch does not generate ASF License warnings.
496m 36s
Subsystem Report/Notes
Docker ClientAPI=1.47 ServerAPI=1.47 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/1/artifact/out/Dockerfile
GITHUB PR #7245
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient codespell detsecrets xmllint spotbugs checkstyle
uname Linux c4d3c1cfc3e6 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 2d58f50
Default Java Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.25+9-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_432-8u432-gaus1-0ubuntu220.04-ga
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/1/testReport/
Max. process+thread count 3536 (vs. ulimit of 5500)
modules C: hadoop-common-project/hadoop-annotations hadoop-hdfs-project/hadoop-hdfs U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-7245/1/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@pan3793
Copy link
Member Author

pan3793 commented Dec 24, 2024

The files complaint by Yetus are renamed without changes, I tend to keep them as-is to avoid introducing any unnecessary noisy changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants