diff --git a/etc/toolchains-example.xml b/etc/toolchains-example.xml index 24ce7d98a..08cee8b24 100644 --- a/etc/toolchains-example.xml +++ b/etc/toolchains-example.xml @@ -33,4 +33,15 @@ C:\Program Files\Java\jdk1.8.0_11 + + jdk + + 1.9.0 + oracle + jdk1.9 + + + C:\Program Files\Java\jdk1.9.0 + + diff --git a/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java index 1592d6bf9..826b4384e 100644 --- a/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java +++ b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java @@ -64,6 +64,11 @@ public @interface ProcessorSuite { */ ORACLE_JAVA_8( null, "javac", "1.8" ), + /** + * Use an Oracle JDK 1.9 (or 1.9.x) via toolchain support to perform the processing + */ + ORACLE_JAVA_9( "oracle-[1.9,1.10)", "javac", "1.9" ), + /** * Use the eclipse compiler with 1.7 source/target level from tycho-compiler-jdt to perform the build and * processing @@ -76,12 +81,6 @@ public @interface ProcessorSuite { */ ECLIPSE_JDT_JAVA_8( null, "jdt", "1.8" ), - /** - * Use the maven-processor-plugin with 1.7 source/target level with the same JDK that runs the mvn build to - * perform the processing - */ - PROCESSOR_PLUGIN_JAVA_7( null, null, "1.7" ), - /** * Use the maven-processor-plugin with 1.8 source/target level with the same JDK that runs the mvn build to * perform the processing @@ -91,8 +90,8 @@ public @interface ProcessorSuite { /** * Use all available processing variants */ - ALL( ORACLE_JAVA_6, ORACLE_JAVA_7, ORACLE_JAVA_8, ECLIPSE_JDT_JAVA_7, ECLIPSE_JDT_JAVA_8, - PROCESSOR_PLUGIN_JAVA_7, PROCESSOR_PLUGIN_JAVA_8 ), + ALL( ORACLE_JAVA_6, ORACLE_JAVA_7, ORACLE_JAVA_8, ORACLE_JAVA_9, ECLIPSE_JDT_JAVA_7, ECLIPSE_JDT_JAVA_8, + PROCESSOR_PLUGIN_JAVA_8 ), /** * Use all JDK8 compatible processing variants diff --git a/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java index 4f3eedf3b..494dc9918 100644 --- a/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java +++ b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java @@ -57,6 +57,8 @@ public class ProcessorSuiteRunner extends ParentRunner { */ public static final String SYS_PROP_DEBUG = "processorIntegrationTest.debug"; + public static final String SYS_PROP_CAN_USE_JDK_9 = "processorIntegrationTest.canUseJdk9"; + public static final class ProcessorTestCase { private final String baseDir; private final ProcessorType processor; @@ -65,12 +67,15 @@ public class ProcessorSuiteRunner extends ParentRunner { public ProcessorTestCase(String baseDir, ProcessorType processor) { this.baseDir = baseDir; this.processor = processor; - this.ignored = !TOOLCHAINS_ENABLED && processor.getToolchain() != null; + this.ignored = + ( !TOOLCHAINS_ENABLED && processor.getToolchain() != null ) + || ( processor == ProcessorType.ORACLE_JAVA_9 && !CAN_USE_JDK_9 ); } } private static final File SPECIFIED_TOOLCHAINS_FILE = getSpecifiedToolchainsFile(); private static final boolean TOOLCHAINS_ENABLED = toolchainsFileExists(); + private static final boolean CAN_USE_JDK_9 = canUseJdk9(); private final List methods; @@ -184,7 +189,8 @@ public class ProcessorSuiteRunner extends ParentRunner { verifier.addCliOption( "-Dcompiler-source-target-version=" + child.processor.getSourceTargetVersion() ); - if ( "1.8".equals( child.processor.getSourceTargetVersion() ) ) { + if ( "1.8".equals( child.processor.getSourceTargetVersion() ) + || "1.9".equals( child.processor.getSourceTargetVersion() ) ) { verifier.addCliOption( "-Dmapstruct-artifact-id=mapstruct-jdk8" ); } else { @@ -275,6 +281,10 @@ public class ProcessorSuiteRunner extends ParentRunner { return null; } + private static boolean canUseJdk9() { + return Boolean.parseBoolean( System.getProperty( SYS_PROP_CAN_USE_JDK_9, "true" ) ); + } + private static boolean toolchainsFileExists() { if ( null != SPECIFIED_TOOLCHAINS_FILE ) { return SPECIFIED_TOOLCHAINS_FILE.exists();