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

[WIP - J11] TEST-16 Upgraded to Java 11 #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions failsafe-controller/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<type>pom</type>
</dependency>

<dependency>
Expand All @@ -61,16 +62,4 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
11 changes: 3 additions & 8 deletions junit-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -78,17 +73,17 @@
<limit implementation="org.codice.jacoco.LenientLimit">
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.70</minimum>
<minimum>0.74</minimum>
</limit>
<limit implementation="org.codice.jacoco.LenientLimit">
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>0.66</minimum>
<minimum>0.64</minimum>
</limit>
<limit implementation="org.codice.jacoco.LenientLimit">
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>0.54</minimum>
<minimum>0.52</minimum>
</limit>
</limits>
</rule>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
* loaded by the parent classloader.
*/
public class DeFinalizeClassLoader extends ClassLoader {
private static final double VERSION =
Double.parseDouble(System.getProperty("java.specification.version"));

private final ClassPool pool;
private final Set<String> filters;
Expand Down Expand Up @@ -103,7 +105,7 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE

if (clazz == null) {
clazz = super.loadClass(name, resolve); // always load it from our parent first
if (DeFinalizeClassLoader.isNotFromAReservedPackage(name)) {
if (DeFinalizeClassLoader.isNotFromAReservedPackage(clazz, name)) {
try {
clazz = reloadClass(clazz, shouldDefinalize(name));
} catch (NotFoundException e) {
Expand Down Expand Up @@ -170,18 +172,27 @@ private void definalizeMethod(CtMethod ctMethod) {
}
}

private static boolean isNotFromAReservedPackage(Class<?> clazz, String name) {
// with post Java 8, classes loaded by the boot classloader (i.e. null) are reserved
if ((DeFinalizeClassLoader.VERSION >= 9.0D) && (clazz.getClassLoader() == null)) {
return false;
}
return DeFinalizeClassLoader.isNotFromAReservedPackage(name);
}

private static boolean isNotFromAReservedPackage(String name) {
return !name.startsWith("java.")
&& !name.startsWith("javax.")
&& !name.startsWith("sun.")
&& !name.startsWith("org.xml.")
&& !name.startsWith("org.junit.");
&& !name.startsWith("org.junit.")
&& !name.startsWith("jdk.");
}

private static String checkDefinalizedClass(Class<?> clazz) {
final String name = clazz.getName();

if (!DeFinalizeClassLoader.isNotFromAReservedPackage(name)) {
if (!DeFinalizeClassLoader.isNotFromAReservedPackage(clazz, name)) {
throw new IllegalArgumentException("unable to definalize class: " + name);
}
return name;
Expand Down
101 changes: 84 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,34 @@
</licenses>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- default URL properties -->
<codice.scm.connection.url />
<snapshots.repository.url />
<reports.repository.url />

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>

<codice-maven.version>0.1</codice-maven.version>
<codice-maven.version>0.2</codice-maven.version>

<commons-lang.version>2.6</commons-lang.version>
<guava.version>23.0</guava.version>
<guava.version>26.0-jre</guava.version>
<jsr305.version>3.0.2_1</jsr305.version>
<org.slf4j.version>1.7.1</org.slf4j.version>
<jodah-failsafe.version>0.9.5</jodah-failsafe.version>
<logback.version>1.2.3</logback.version>
<logback.classic.version>1.2.3</logback.classic.version>

<junit.version>4.12</junit.version>
<spock.version>1.1-groovy-2.4</spock.version>
<groovy.version>2.4.7</groovy.version>
<mockito-core.version>2.8.47</mockito-core.version>
<spock.version>1.2-groovy-2.5</spock.version>
<groovy.version>2.5.3-SNAPSHOT</groovy.version>
<mockito-core.version>2.23.0</mockito-core.version>
<hamcrest-all.version>1.3</hamcrest-all.version>

<javassist.version>3.22.0-GA</javassist.version>
<javassist.version>3.23.1-GA</javassist.version>

<!-- Gitflow Incremental Builder Properties -->
<gib.referenceBranch>refs/remotes/origin/master</gib.referenceBranch>
Expand All @@ -69,7 +72,8 @@
<gib.failOnError>false</gib.failOnError>

<!-- Maven Plugin Version Properties -->
<maven-jacoco-plugin.version>0.8.1</maven-jacoco-plugin.version>
<maven-jacoco-plugin.version>0.8.2</maven-jacoco-plugin.version>
<maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>
</properties>

<scm>
Expand Down Expand Up @@ -112,6 +116,14 @@
<name>Codice Repository</name>
<url>https://artifacts.codice.org/content/groups/public/</url>
</repository>
<repository>
<!-- Temp repo to get Groovy snapshot - must set mirrors in settings.xml to "*,!oss-jfrog" -->
<id>oss-jfrog</id>
<url>https://oss.jfrog.org/artifactory/libs-snapshot/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
Expand Down Expand Up @@ -201,18 +213,55 @@
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<artifactId>groovy-dateutil</artifactId>
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock.version}</version>
<!-- Need to exclude groovy artifacts as spock is pulling in an older version -->
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-groovysh</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-json</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-macro</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-nio</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-sql</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-templates</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-test</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-xml</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
Expand All @@ -229,15 +278,20 @@

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.2</version>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
Expand All @@ -262,14 +316,23 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<argLine>${argLine} -Djava.awt.headless=true -noverify</argLine>
<argLine>${argLine} -Djava.awt.headless=true -noverify
</argLine>
<includes>
<include>**/*Test.java</include>
<include>**/*Spec.class</include>
</includes>
</configuration>
<dependencies>
<!-- without this dependency, surefire uses testng instead -->
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${maven-surefire-plugin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
Expand All @@ -278,7 +341,7 @@
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.0.0</version>
<version>2.5.1</version>
<executions>
<execution>
<phase>validate</phase>
Expand All @@ -291,15 +354,19 @@
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
<version>1.6.1</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- does not yet support 11 -->
<targetBytecode>1.8</targetBytecode>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
Expand Down
8 changes: 6 additions & 2 deletions spock-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.4</version>
<version>7.0-beta</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>3.2.6</version>
<version>3.2.8</version>
</dependency>
<dependency>
<groupId>org.objenesis</groupId>
Expand All @@ -50,6 +50,10 @@
<artifactId>groovy-all</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-dateutil</artifactId>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
Expand Down
1 change: 1 addition & 0 deletions spock-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
Expand Down