This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 5b0b2ba  build(java): add ErrorProne/NullAway (#625)
5b0b2ba is described below

commit 5b0b2baff1ef4de7f9361995b43eccdf8a1d1ca2
Author: David Li <li.david...@gmail.com>
AuthorDate: Fri Apr 28 16:50:30 2023 +0900

    build(java): add ErrorProne/NullAway (#625)
    
    Fixes #623.
---
 .github/workflows/java.yml        | 34 ++++++++++++++++++++++++++++++++++
 dev/release/rat_exclude_files.txt |  1 +
 java/pom.xml                      | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+)

diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml
index 2954b9e..057f960 100644
--- a/.github/workflows/java.yml
+++ b/.github/workflows/java.yml
@@ -79,3 +79,37 @@ jobs:
         run: |
           cd java
           mvn install
+
+  java-errorprone:
+    name: "Java ${{ matrix.java }}/Linux with ErrorProne"
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        java: ['11']
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+          persist-credentials: false
+      - uses: actions/setup-java@v3
+        with:
+          cache: "maven"
+          distribution: "temurin"
+          java-version: ${{ matrix.java }}
+      - name: Build/Test
+        run: |
+          cd java
+          mkdir .mvn
+          cat <<HERE > .mvn/jvm.config
+          --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
+          --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
+          --add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
+          --add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
+          --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
+          --add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
+          --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
+          --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
+          --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
+          --add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
+          HERE
+          mvn -P errorprone install
diff --git a/dev/release/rat_exclude_files.txt 
b/dev/release/rat_exclude_files.txt
index 5c7be27..1fc87de 100644
--- a/dev/release/rat_exclude_files.txt
+++ b/dev/release/rat_exclude_files.txt
@@ -11,6 +11,7 @@ go/adbc/drivermgr/adbc_driver_manager.h
 go/adbc/status_string.go
 go/adbc/infocode_string.go
 go/adbc/go.sum
+java/.mvn/jvm.config
 rat.txt
 r/adbcdrivermanager/DESCRIPTION
 r/adbcdrivermanager/NAMESPACE
diff --git a/java/pom.xml b/java/pom.xml
index bb983ad..431e2a5 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -208,6 +208,7 @@
             <exclude>**/*.iml</exclude>
             <exclude>**/*.log</exclude>
             <exclude>**/target/**</exclude>
+            <exclude>.mvn/jvm.config</exclude>
           </excludes>
         </configuration>
       </plugin>
@@ -284,5 +285,38 @@
         </plugins>
       </build>
     </profile>
+
+    <profile>
+      <id>errorprone</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-compiler-plugin</artifactId>
+            <version>3.10.1</version>
+            <configuration>
+              <source>1.8</source>
+              <target>1.8</target>
+              <compilerArgs>
+                <arg>-XDcompilePolicy=simple</arg>
+                <arg>-Xplugin:ErrorProne -Xep:NullAway:ERROR 
-XepOpt:NullAway:AnnotatedPackages=com.uber</arg>
+              </compilerArgs>
+              <annotationProcessorPaths>
+                <path>
+                  <groupId>com.google.errorprone</groupId>
+                  <artifactId>error_prone_core</artifactId>
+                  <version>2.18.0</version>
+                </path>
+                <path>
+                  <groupId>com.uber.nullaway</groupId>
+                  <artifactId>nullaway</artifactId>
+                  <version>0.10.10</version>
+                </path>
+              </annotationProcessorPaths>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
   </profiles>
 </project>

Reply via email to