Skip to content

Commit

Permalink
introduce openjdk17 compile compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
chewiebug committed Jan 29, 2022
1 parent 44c761e commit aa49fcd
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 34 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# more details for build customization see http://docs.travis-ci.com/user/customizing-the-build/
language: java

# use the container based infrastructure on travis
sudo: false

jdk:
- openjdk8
- openjdk11
- openjdk15
- openjdk17

# enable cache to stop downloading all maven plugins every time
cache:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GCViewer 1.36
=============

[![Build Status](https://travis-ci.com/chewiebug/GCViewer.svg?branch=develop)](https://travis-ci.com/chewiebug/GCViewer)
[![Build Status](https://app.travis-ci.com/chewiebug/GCViewer.svg?branch=develop)](https://app.travis-ci.com/chewiebug/GCViewer)
[![codecov.io](https://codecov.io/github/chewiebug/GCViewer/coverage.svg?branch=develop)](https://codecov.io/github/chewiebug/GCViewer?branch=develop)

GCViewer is a little tool that visualizes verbose GC output
Expand Down
55 changes: 36 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,13 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>4.13.1</junit.version>
<hamcrest.version>1.3</hamcrest.version>
<mockito.version>1.10.19</mockito.version>
<junit.version>4.13.2</junit.version>
<hamcrest.version>2.2</hamcrest.version>
<mockito.version>4.3.1</mockito.version>
<jdk.source.version>1.8</jdk.source.version>
<jdk.target.version>1.8</jdk.target.version>
<tools.maven.plugin.version>1.4</tools.maven.plugin.version>
<jacoco.maven.plugin.version>0.8.6</jacoco.maven.plugin.version>
<jacoco.maven.plugin.version>0.8.7</jacoco.maven.plugin.version>
<maven.source.plugin.version>3.0.1</maven.source.plugin.version>
<maven.javadoc.plugin.version>3.0.1</maven.javadoc.plugin.version>
<maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
Expand All @@ -219,7 +219,7 @@
<!-- https://issues.apache.org/jira/browse/MRELEASE-1013 -->
<maven.scm.plugin.version>1.10.0</maven.scm.plugin.version>
<maven.deploy.plugin.version>2.8.2</maven.deploy.plugin.version>
<maven.jdeps.plugin.version>3.1.1</maven.jdeps.plugin.version>
<maven.jdeps.plugin.version>3.1.2</maven.jdeps.plugin.version>
<nexus.staging.maven.plugin.version>1.6.8</nexus.staging.maven.plugin.version>
</properties>

Expand All @@ -239,13 +239,13 @@
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<artifactId>hamcrest</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -432,22 +432,22 @@
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-jdeps-plugin</artifactId>
<version>${maven.jdeps.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>jdkinternals</goal> <!-- verify main classes -->
<goal>test-jdkinternals</goal> <!-- verify test classes -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<artifactId>maven-jdeps-plugin</artifactId>
<version>${maven.jdeps.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>jdkinternals</goal> <!-- verify main classes -->
<goal>test-jdkinternals</goal> <!-- verify test classes -->
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
Expand Down Expand Up @@ -557,6 +557,23 @@
</build>

<profiles>
<profile>
<id>jdk9plus-build</id>
<activation>
<jdk>[9,17]</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-jdeps-plugin</artifactId>
<configuration>
<multiRelease>base</multiRelease>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<!-- Override plugin versions of Sonatype profile. This needs
to be done here because profiles are not inherited. -->
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/tagtraum/perf/gcviewer/GCViewerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.Matchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.tagtraum.perf.gcviewer.ctrl.impl;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;

import com.tagtraum.perf.gcviewer.model.GCResource;
import com.tagtraum.perf.gcviewer.model.GcResourceFile;
import com.tagtraum.perf.gcviewer.model.GcResourceSeries;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
import org.mockito.junit.MockitoJUnitRunner;

/**
* @author martin.geldmacher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class GcSeriesLoaderTest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.tagtraum.perf.gcviewer.imp;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
Expand Down Expand Up @@ -89,9 +90,9 @@ public void loadModelIllegalArgument() throws Exception {
}
catch (DataReaderException e) {
assertNotNull("cause", e.getCause());
Class expectedClass;
String javaVersion = System.getProperty("java.version");
if (javaVersion.startsWith("14") || javaVersion.startsWith("15")) {
Class<?> expectedClass;
int javaMajorVersion = getJavaMajorVersion();
if (javaMajorVersion > 13) {
expectedClass = IOException.class;
} else {
expectedClass = IllegalArgumentException.class;
Expand Down Expand Up @@ -171,4 +172,12 @@ public void testLoadModelFromSeries() throws IOException, DataReaderException {
GCModel result = dataReaderFacade.loadModel(series);
assertThat(result.toString(), is(expectedModel.toString()));
}

private int getJavaMajorVersion() {
String javaVersion = System.getProperty("java.version");
String[] javaVersionParts = javaVersion.split("\\.");
assertThat("java version format", javaVersionParts.length, greaterThanOrEqualTo(1));
return Integer.parseInt(javaVersionParts[0]);
}

}

0 comments on commit aa49fcd

Please sign in to comment.