Skip to content

Commit

Permalink
fix: allow java16+ as JRE
Browse files Browse the repository at this point in the history
This commit includes a small change to the AbstractToken
class to avoid an InaccessibleObjectException when
running code using a Java 16 (or later) JRE.
  • Loading branch information
padamstx committed Mar 23, 2022
1 parent 1eb35ef commit 480f3ad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
34 changes: 22 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm.cloud</groupId>
<artifactId>sdk-core</artifactId>
Expand All @@ -15,7 +14,7 @@
<surefire-version>3.0.0-M5</surefire-version>
<checkstyle-plugin-version>3.1.2</checkstyle-plugin-version>
<checkstyle-version>8.41</checkstyle-version>
<jacoco-plugin-version>0.8.3</jacoco-plugin-version>
<jacoco-plugin-version>0.8.7</jacoco-plugin-version>
<compiler-plugin-version>3.8.0</compiler-plugin-version>
<okhttp3-version>4.9.1</okhttp3-version>
<guava-version>30.1.1-jre</guava-version>
Expand All @@ -24,17 +23,20 @@
<commons-io-version>2.7</commons-io-version>
<commons-lang3-version>3.8.1</commons-lang3-version>
<rx-version>2.2.7</rx-version>
<mockito-version>3.11.2</mockito-version>
<mockito-version>3.12.4</mockito-version>
<powermock-version>2.0.9</powermock-version>
<maven-deploy-plugin-version>3.0.0-M1</maven-deploy-plugin-version>
<nexus-staging-plugin-version>1.6.8</nexus-staging-plugin-version>
<maven-gpg-plugin-version>3.0.1</maven-gpg-plugin-version>

<!-- versions of transitive dependencies we need to override to avoid vulnerability alerts -->
<junit-version>4.13.2</junit-version>

<!-- This property should be empty by default. -->
<surefireJvmArgs></surefireJvmArgs>
</properties>

<licenses>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
Expand Down Expand Up @@ -65,8 +67,7 @@
<distributionManagement></distributionManagement>

<!-- we currently don't need any non-public repositories -->
<repositories>
</repositories>
<repositories></repositories>

<dependencies>
<dependency>
Expand Down Expand Up @@ -249,8 +250,6 @@
<configuration>
<append>true</append>
<destFile>${sonar.jacoco.reportPath}</destFile>
<!-- Sets the VM argument line used when unit tests are run. -->
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
</executions>
Expand All @@ -276,6 +275,7 @@
<configuration>
<reuseForks>false</reuseForks>
<forkCount>1</forkCount>
<argLine>@{argLine} ${surefireJvmArgs}</argLine>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -319,7 +319,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-plugin-version}</version>
<version>${nexus-staging-plugin-version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand All @@ -331,7 +331,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin-version}</version>
<version>${maven-gpg-plugin-version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -357,6 +357,16 @@
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
<profile>
<id>java16+</id>
<activation>
<jdk>[16,)</jdk>
</activation>
<properties>
<!-- For java 16 and higher, we need these jvm args when running tests due to errors caused by other libraries. -->
<surefireJvmArgs>--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.logging/java.util.logging=ALL-UNNAMED</surefireJvmArgs>
</properties>
</profile>
</profiles>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class AbstractToken {

// This field will be used to indicate that the most recent interaction with the token server
// resulted in an error.
private Throwable exception;
private transient Throwable exception;

public AbstractToken() {
}
Expand Down

0 comments on commit 480f3ad

Please sign in to comment.