From 4f42fdcea0101f4916f652ca0cafc1660fdd3a79 Mon Sep 17 00:00:00 2001 From: Reto Weiss Date: Thu, 18 Oct 2018 23:04:28 +0200 Subject: [PATCH] Initial support for java module system --- .classpath | 6 ++-- .settings/org.eclipse.jdt.core.prefs | 10 ++++-- .travis.yml | 2 +- pom.xml | 32 ++++++++++++++++--- src/main/java/module-info.java | 10 ++++++ .../ch/rweiss/terminal/chart/TestUnit.java | 11 ++++--- 6 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 src/main/java/module-info.java diff --git a/.classpath b/.classpath index daab756..4f4fdff 100644 --- a/.classpath +++ b/.classpath @@ -8,12 +8,12 @@ + - - + @@ -30,7 +30,7 @@ - + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index d59e09c..190a4c7 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,5 +1,9 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/.travis.yml b/.travis.yml index f757e88..66a1d3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: java -jdk: oraclejdk8 +jdk: openjdk11 install: true script: mvn --settings .travis.settings.xml clean deploy cache: diff --git a/pom.xml b/pom.xml index 2cd9f2a..10d6e35 100644 --- a/pom.xml +++ b/pom.xml @@ -14,16 +14,39 @@ maven-compiler-plugin - 3.6.2 + 3.8.0 + + + module-compile + + compile + + + + 11 + + module-info.java + + + + + default-compile + + + + module-info.java + + + + - 1.8 - 1.8 + 8 org.apache.maven.plugins maven-surefire-plugin - 2.21.0 + 2.22.1 org.junit.platform @@ -38,7 +61,6 @@ - ch.rweiss.ansi.terminal.chart Reto Weiss ${project.artifactId} Reto Weiss diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..231cb27 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,10 @@ +module ch.rweiss.terminal.chart +{ + exports ch.rweiss.terminal.chart; + exports ch.rweiss.terminal.chart.format; + exports ch.rweiss.terminal.chart.serie; + exports ch.rweiss.terminal.chart.unit; + + requires transitive ch.rweiss.terminal; + requires ch.rweiss.check; +} \ No newline at end of file diff --git a/src/test/java/ch/rweiss/terminal/chart/TestUnit.java b/src/test/java/ch/rweiss/terminal/chart/TestUnit.java index 1dc62e5..028a095 100644 --- a/src/test/java/ch/rweiss/terminal/chart/TestUnit.java +++ b/src/test/java/ch/rweiss/terminal/chart/TestUnit.java @@ -1,14 +1,15 @@ package ch.rweiss.terminal.chart; import static org.assertj.core.api.Assertions.assertThat; + import org.junit.jupiter.api.Test; import ch.rweiss.terminal.chart.unit.Unit; -class TestUnit +public class TestUnit { @Test - void testToString() + public void testToString() { assertThat(Unit.BYTES.toString()).isEqualTo("B (bytes)"); assertThat(Unit.KILO_BYTES.toString()).isEqualTo("kB (kilo bytes)"); @@ -18,7 +19,7 @@ void testToString() } @Test - void symbol() + public void symbol() { assertThat(Unit.BYTES.symbol()).isEqualTo("B"); assertThat(Unit.KILO_BYTES.symbol()).isEqualTo("kB"); @@ -28,7 +29,7 @@ void symbol() } @Test - void scaleUp() + public void scaleUp() { long value = Unit.BYTES.convertTo(1024*1024*1024, Unit.KILO_BYTES); assertThat(value).isEqualTo(1024*1024); @@ -39,7 +40,7 @@ void scaleUp() } @Test - void scaleDown() + public void scaleDown() { long value = Unit.MINUTES.convertTo(1, Unit.SECONDS); assertThat(value).isEqualTo(60);