| @@ -54,6 +54,9 @@ Other changes: | |||||
| reproducible builds (https://reproducible-builds.org/specs/source-date-epoch/#idm55) | reproducible builds (https://reproducible-builds.org/specs/source-date-epoch/#idm55) | ||||
| Bugzilla Report 62617 | Bugzilla Report 62617 | ||||
| * rmic has been removed from Java 15. The task will now throw an | |||||
| exception if you try to use it while running Java 15 or newer. | |||||
| Changes from Ant 1.10.6 TO Ant 1.10.7 | Changes from Ant 1.10.6 TO Ant 1.10.7 | ||||
| ===================================== | ===================================== | ||||
| @@ -27,6 +27,11 @@ | |||||
| <h2 id="rmic">Rmic</h2> | <h2 id="rmic">Rmic</h2> | ||||
| <h3>Description</h3> | <h3>Description</h3> | ||||
| <p>Runs the <kbd>rmic</kbd> compiler for a certain class.</p> | <p>Runs the <kbd>rmic</kbd> compiler for a certain class.</p> | ||||
| <p><b>Note</b> <kbd>rmic</kbd> has been deprecated as of Java 13 and | |||||
| removed as of Java 15. Trying to use it with Java15 will fail unless | |||||
| you specifiy the execxutable or rmic-adapter explicitly.</p> | |||||
| <p><code>Rmic</code> can be run on a single class (as specified with the classname attribute) or a | <p><code>Rmic</code> can be run on a single class (as specified with the classname attribute) or a | ||||
| number of classes at once (all classes below base that are neither <code>_Stub</code> | number of classes at once (all classes below base that are neither <code>_Stub</code> | ||||
| nor <code>_Skel</code> classes). If you want to <code>rmic</code> a single class and this class is | nor <code>_Skel</code> classes). If you want to <code>rmic</code> a single class and this class is | ||||
| @@ -201,67 +201,75 @@ | |||||
| <target name="probe-rmic"> | <target name="probe-rmic"> | ||||
| <available property="kaffe.present" classname="jkaffe.rmi.rmic.RMIC"/> | <available property="kaffe.present" classname="jkaffe.rmi.rmic.RMIC"/> | ||||
| <condition property="rmic.present"> | <condition property="rmic.present"> | ||||
| <or> | |||||
| <available classname="sun.rmi.rmic.Main"/> | |||||
| <!-- we'll use forking as default for Java9 --> | |||||
| <available classname="java.lang.module.ModuleDescriptor"/> | |||||
| </or> | |||||
| <and> | |||||
| <or> | |||||
| <available classname="sun.rmi.rmic.Main"/> | |||||
| <!-- we'll use forking as default for Java9 --> | |||||
| <available classname="java.lang.module.ModuleDescriptor"/> | |||||
| </or> | |||||
| <not> | |||||
| <javaversion atleast="15"/> | |||||
| </not> | |||||
| </and> | |||||
| </condition> | </condition> | ||||
| <condition property="rmic.compiler" value="forking"> | <condition property="rmic.compiler" value="forking"> | ||||
| <available classname="java.lang.module.ModuleDescriptor"/> | <available classname="java.lang.module.ModuleDescriptor"/> | ||||
| </condition> | </condition> | ||||
| <property name="rmic.compiler" value="sun"/> | <property name="rmic.compiler" value="sun"/> | ||||
| <available property="wlrmic.present" classname="weblogic.rmic"/> | <available property="wlrmic.present" classname="weblogic.rmic"/> | ||||
| <condition property="java15+"> | |||||
| <javaversion atleast="15"/> | |||||
| </condition> | |||||
| </target> | </target> | ||||
| <target name="testDefault" depends="init"> | |||||
| <target name="testDefault" depends="init" unless="java15+"> | |||||
| <base-rmic compiler="default" listfiles="true"/> | <base-rmic compiler="default" listfiles="true"/> | ||||
| <assertBaseCompiled/> | <assertBaseCompiled/> | ||||
| </target> | </target> | ||||
| <target name="testDefaultDest" depends="init"> | |||||
| <target name="testDefaultDest" depends="init" unless="java15+"> | |||||
| <dest-rmic compiler="default"/> | <dest-rmic compiler="default"/> | ||||
| <assertBaseCompiledInDest/> | <assertBaseCompiledInDest/> | ||||
| </target> | </target> | ||||
| <target name="testEmpty" depends="init"> | |||||
| <target name="testEmpty" depends="init" unless="java15+"> | |||||
| <base-rmic compiler=""/> | <base-rmic compiler=""/> | ||||
| <assertBaseCompiled/> | <assertBaseCompiled/> | ||||
| </target> | </target> | ||||
| <target name="testEmptyDest" depends="init"> | |||||
| <target name="testEmptyDest" depends="init" unless="java15+"> | |||||
| <dest-rmic compiler=""/> | <dest-rmic compiler=""/> | ||||
| <assertBaseCompiledInDest/> | <assertBaseCompiledInDest/> | ||||
| </target> | </target> | ||||
| <target name="testVersion11" depends="init"> | |||||
| <target name="testVersion11" depends="init" unless="java15+"> | |||||
| <base-rmic compiler="default" stubversion="1.1" /> | <base-rmic compiler="default" stubversion="1.1" /> | ||||
| <assertBaseCompiled/> | <assertBaseCompiled/> | ||||
| </target> | </target> | ||||
| <target name="testVersion11Dest" depends="init"> | |||||
| <target name="testVersion11Dest" depends="init" unless="java15+"> | |||||
| <dest-rmic compiler="default" stubversion="1.1" /> | <dest-rmic compiler="default" stubversion="1.1" /> | ||||
| <assertBaseCompiledInDest/> | <assertBaseCompiledInDest/> | ||||
| </target> | </target> | ||||
| <target name="testVersion12" depends="init"> | |||||
| <target name="testVersion12" depends="init" unless="java15+"> | |||||
| <base-rmic compiler="default" stubversion="1.2" /> | <base-rmic compiler="default" stubversion="1.2" /> | ||||
| <assertStubCompiled/> | <assertStubCompiled/> | ||||
| <assertSkelAbsent/> | <assertSkelAbsent/> | ||||
| </target> | </target> | ||||
| <target name="testVersion12Dest" depends="init"> | |||||
| <target name="testVersion12Dest" depends="init" unless="java15+"> | |||||
| <dest-rmic compiler="default" stubversion="1.2" /> | <dest-rmic compiler="default" stubversion="1.2" /> | ||||
| <assertStubCompiledInDest/> | <assertStubCompiledInDest/> | ||||
| <assertSkelAbsentInDest/> | <assertSkelAbsentInDest/> | ||||
| </target> | </target> | ||||
| <target name="testVersionCompat" depends="init"> | |||||
| <target name="testVersionCompat" depends="init" unless="java15+"> | |||||
| <base-rmic compiler="default" stubversion="compat" /> | <base-rmic compiler="default" stubversion="compat" /> | ||||
| <assertBaseCompiled/> | <assertBaseCompiled/> | ||||
| </target> | </target> | ||||
| <target name="testVersionCompatDest" depends="init"> | |||||
| <target name="testVersionCompatDest" depends="init" unless="java15+"> | |||||
| <dest-rmic compiler="default" stubversion="compat" /> | <dest-rmic compiler="default" stubversion="compat" /> | ||||
| <assertBaseCompiledInDest/> | <assertBaseCompiledInDest/> | ||||
| </target> | </target> | ||||
| @@ -379,35 +387,35 @@ | |||||
| </javac> | </javac> | ||||
| </target> | </target> | ||||
| <target name="testAntClasspath" depends="compileAntTimestamp"> | |||||
| <target name="testAntClasspath" depends="compileAntTimestamp" unless="java15+"> | |||||
| <base-rmic | <base-rmic | ||||
| compiler="default" | compiler="default" | ||||
| /> | /> | ||||
| <assertAntCompiled/> | <assertAntCompiled/> | ||||
| </target> | </target> | ||||
| <target name="testAntClasspathDest" depends="compileAntTimestamp"> | |||||
| <target name="testAntClasspathDest" depends="compileAntTimestamp" unless="java15+"> | |||||
| <dest-rmic | <dest-rmic | ||||
| compiler="default" | compiler="default" | ||||
| /> | /> | ||||
| <assertAntCompiledInDest/> | <assertAntCompiledInDest/> | ||||
| </target> | </target> | ||||
| <target name="testForkingAntClasspath" depends="compileAntTimestamp"> | |||||
| <target name="testForkingAntClasspath" depends="compileAntTimestamp" unless="java15+"> | |||||
| <base-rmic | <base-rmic | ||||
| compiler="forking" | compiler="forking" | ||||
| /> | /> | ||||
| <assertAntCompiled /> | <assertAntCompiled /> | ||||
| </target> | </target> | ||||
| <target name="testForkingAntClasspathDest" depends="compileAntTimestamp"> | |||||
| <target name="testForkingAntClasspathDest" depends="compileAntTimestamp" unless="java15+"> | |||||
| <dest-rmic | <dest-rmic | ||||
| compiler="forking" | compiler="forking" | ||||
| /> | /> | ||||
| <assertAntCompiledInDest /> | <assertAntCompiledInDest /> | ||||
| </target> | </target> | ||||
| <target name="testDefaultBadClass" depends="init"> | |||||
| <target name="testDefaultBadClass" depends="init" unless="java15+"> | |||||
| <rmic-bad-class compiler="default"/> | <rmic-bad-class compiler="default"/> | ||||
| </target> | </target> | ||||
| @@ -423,7 +431,7 @@ | |||||
| /> | /> | ||||
| </target> | </target> | ||||
| <target name="testMagicPropertyIsEmptyString" depends="init"> | |||||
| <target name="testMagicPropertyIsEmptyString" depends="init" unless="java15+"> | |||||
| <property name="build.rmic" value=""/> | <property name="build.rmic" value=""/> | ||||
| <base-rmic /> | <base-rmic /> | ||||
| <assertBaseCompiled/> | <assertBaseCompiled/> | ||||
| @@ -455,23 +463,23 @@ | |||||
| <assertBaseCompiledInDest/> | <assertBaseCompiledInDest/> | ||||
| </target> | </target> | ||||
| <target name="testIDL" depends="init"> | |||||
| <target name="testIDL" depends="init" unless="java15+"> | |||||
| <base-rmic compiler="default" idl="true"/> | <base-rmic compiler="default" idl="true"/> | ||||
| <assertFileCreated file="RemoteTimestamp.idl"/> | <assertFileCreated file="RemoteTimestamp.idl"/> | ||||
| </target> | </target> | ||||
| <target name="testIDLDest" depends="init"> | |||||
| <target name="testIDLDest" depends="init" unless="java15+"> | |||||
| <dest-rmic compiler="default" idl="true"/> | <dest-rmic compiler="default" idl="true"/> | ||||
| <assertFileCreatedInDest file="RemoteTimestamp.idl"/> | <assertFileCreatedInDest file="RemoteTimestamp.idl"/> | ||||
| </target> | </target> | ||||
| <target name="testIIOP" depends="init"> | |||||
| <target name="testIIOP" depends="init" unless="java15+"> | |||||
| <base-rmic compiler="default" iiop="true"/> | <base-rmic compiler="default" iiop="true"/> | ||||
| <assertFileCreated file="_RemoteTimestamp_Stub.class"/> | <assertFileCreated file="_RemoteTimestamp_Stub.class"/> | ||||
| <assertFileCreated file="_RemoteTimestampImpl_Tie.class"/> | <assertFileCreated file="_RemoteTimestampImpl_Tie.class"/> | ||||
| </target> | </target> | ||||
| <target name="testIIOPDest" depends="init"> | |||||
| <target name="testIIOPDest" depends="init" unless="java15+"> | |||||
| <dest-rmic compiler="default" iiop="true"/> | <dest-rmic compiler="default" iiop="true"/> | ||||
| <assertFileCreatedInDest file="_RemoteTimestamp_Stub.class"/> | <assertFileCreatedInDest file="_RemoteTimestamp_Stub.class"/> | ||||
| <assertFileCreatedInDest file="_RemoteTimestampImpl_Tie.class"/> | <assertFileCreatedInDest file="_RemoteTimestampImpl_Tie.class"/> | ||||
| @@ -72,6 +72,11 @@ public class ForkingSunRmic extends DefaultRmicAdapter { | |||||
| Project project = owner.getProject(); | Project project = owner.getProject(); | ||||
| String executable = owner.getExecutable(); | String executable = owner.getExecutable(); | ||||
| if (executable == null) { | if (executable == null) { | ||||
| if (JavaEnvUtils.isAtLeastJavaVersion("15")) { | |||||
| throw new BuildException("rmic does not exist under Java 15 and higher," | |||||
| + " use rmic of an older JDK and explicitly set the executable attribute"); | |||||
| } | |||||
| // no explicitly specified executable | // no explicitly specified executable | ||||
| // rely on RMIC being on the path | // rely on RMIC being on the path | ||||
| executable = JavaEnvUtils.getJdkExecutable(getExecutableName()); | executable = JavaEnvUtils.getJdkExecutable(getExecutableName()); | ||||
| @@ -76,8 +76,13 @@ public class Adapter implements RmicAdapter { | |||||
| <au:assertLogContains text="adapter called"/> | <au:assertLogContains text="adapter called"/> | ||||
| </target> | </target> | ||||
| <target name="testSourceBase" | |||||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=48970"> | |||||
| <target name="-check-jdk"> | |||||
| <condition property="java15+"> | |||||
| <javaversion atleast="15"/> | |||||
| </condition> | |||||
| </target> | |||||
| <target name="-setup-real-test"> | |||||
| <mkdir dir="${input}/org/example"/> | <mkdir dir="${input}/org/example"/> | ||||
| <mkdir dir="${output}"/> | <mkdir dir="${output}"/> | ||||
| <echo file="${input}/org/example/Foo.java"><![CDATA[ | <echo file="${input}/org/example/Foo.java"><![CDATA[ | ||||
| @@ -96,10 +101,23 @@ public class FooImpl implements Foo { | |||||
| } | } | ||||
| }]]></echo> | }]]></echo> | ||||
| <javac srcdir="${input}" destdir="${output}"/> | <javac srcdir="${input}" destdir="${output}"/> | ||||
| </target> | |||||
| <target name="testSourceBase" depends="-check-jdk, -setup-real-test" unless="java15+" | |||||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=48970"> | |||||
| <rmic sourcebase="${input}" base="${output}"> | <rmic sourcebase="${input}" base="${output}"> | ||||
| <include name="**/*Impl.class"/> | <include name="**/*Impl.class"/> | ||||
| </rmic> | </rmic> | ||||
| <au:assertFileExists file="${input}/org/example/FooImpl_Stub.java"/> | <au:assertFileExists file="${input}/org/example/FooImpl_Stub.java"/> | ||||
| <au:assertFileDoesntExist file="${output}/org/example/FooImpl_Stub.java"/> | <au:assertFileDoesntExist file="${output}/org/example/FooImpl_Stub.java"/> | ||||
| </target> | </target> | ||||
| <target name="testSimpleCompileFailsOnJava15+" depends="-check-jdk, -setup-real-test" | |||||
| if="java15+"> | |||||
| <au:expectfailure> | |||||
| <rmic sourcebase="${input}" base="${output}"> | |||||
| <include name="**/*Impl.class"/> | |||||
| </rmic> | |||||
| </au:expectfailure> | |||||
| </target> | |||||
| </project> | </project> | ||||
| @@ -229,6 +229,8 @@ public class RmicAdvancedTest { | |||||
| */ | */ | ||||
| @Test | @Test | ||||
| public void testDefaultBadClass() { | public void testDefaultBadClass() { | ||||
| assumeFalse("Current system is Java 15 or newer", | |||||
| JavaEnvUtils.isAtLeastJavaVersion("15")); | |||||
| thrown.expect(BuildException.class); | thrown.expect(BuildException.class); | ||||
| thrown.expectMessage(Rmic.ERROR_RMIC_FAILED); | thrown.expectMessage(Rmic.ERROR_RMIC_FAILED); | ||||
| try { | try { | ||||
| @@ -337,6 +339,8 @@ public class RmicAdvancedTest { | |||||
| public void testXnewForkedJava9plus() { | public void testXnewForkedJava9plus() { | ||||
| assumeTrue("Current system is Java 8 or older", | assumeTrue("Current system is Java 8 or older", | ||||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | ||||
| assumeFalse("Current system is Java 15 or newer", | |||||
| JavaEnvUtils.isAtLeastJavaVersion("15")); | |||||
| thrown.expect(BuildException.class); | thrown.expect(BuildException.class); | ||||
| thrown.expectMessage("JDK9 has removed support for -Xnew"); | thrown.expectMessage("JDK9 has removed support for -Xnew"); | ||||
| buildRule.executeTarget("testXnewForked"); | buildRule.executeTarget("testXnewForked"); | ||||
| @@ -359,6 +363,8 @@ public class RmicAdvancedTest { | |||||
| public void testXnewForkedDestJava9plus() { | public void testXnewForkedDestJava9plus() { | ||||
| assumeTrue("Current system is Java 8 or older", | assumeTrue("Current system is Java 8 or older", | ||||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | ||||
| assumeFalse("Current system is Java 15 or newer", | |||||
| JavaEnvUtils.isAtLeastJavaVersion("15")); | |||||
| thrown.expect(BuildException.class); | thrown.expect(BuildException.class); | ||||
| thrown.expectMessage("JDK9 has removed support for -Xnew"); | thrown.expectMessage("JDK9 has removed support for -Xnew"); | ||||
| buildRule.executeTarget("testXnewForkedDest"); | buildRule.executeTarget("testXnewForkedDest"); | ||||
| @@ -381,6 +387,8 @@ public class RmicAdvancedTest { | |||||
| public void testXnewCompilerJava9plus() { | public void testXnewCompilerJava9plus() { | ||||
| assumeTrue("Current system is Java 8 or older", | assumeTrue("Current system is Java 8 or older", | ||||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | ||||
| assumeFalse("Current system is Java 15 or newer", | |||||
| JavaEnvUtils.isAtLeastJavaVersion("15")); | |||||
| thrown.expect(BuildException.class); | thrown.expect(BuildException.class); | ||||
| thrown.expectMessage("JDK9 has removed support for -Xnew"); | thrown.expectMessage("JDK9 has removed support for -Xnew"); | ||||
| buildRule.executeTarget("testXnewCompiler"); | buildRule.executeTarget("testXnewCompiler"); | ||||
| @@ -403,6 +411,8 @@ public class RmicAdvancedTest { | |||||
| public void testXnewCompilerDestJava9plus() { | public void testXnewCompilerDestJava9plus() { | ||||
| assumeTrue("Current system is Java 8 or older", | assumeTrue("Current system is Java 8 or older", | ||||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | ||||
| assumeFalse("Current system is Java 15 or newer", | |||||
| JavaEnvUtils.isAtLeastJavaVersion("15")); | |||||
| thrown.expect(BuildException.class); | thrown.expect(BuildException.class); | ||||
| thrown.expectMessage("JDK9 has removed support for -Xnew"); | thrown.expectMessage("JDK9 has removed support for -Xnew"); | ||||
| buildRule.executeTarget("testXnewCompilerDest"); | buildRule.executeTarget("testXnewCompilerDest"); | ||||
| @@ -423,6 +433,8 @@ public class RmicAdvancedTest { | |||||
| @Test | @Test | ||||
| public void testIDLJava11plus() { | public void testIDLJava11plus() { | ||||
| assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); | assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); | ||||
| assumeFalse("Current system is Java 15 or newer", | |||||
| JavaEnvUtils.isAtLeastJavaVersion("15")); | |||||
| thrown.expect(BuildException.class); | thrown.expect(BuildException.class); | ||||
| thrown.expectMessage("this rmic implementation doesn't support the -idl switch"); | thrown.expectMessage("this rmic implementation doesn't support the -idl switch"); | ||||
| buildRule.executeTarget("testIDL"); | buildRule.executeTarget("testIDL"); | ||||
| @@ -443,6 +455,8 @@ public class RmicAdvancedTest { | |||||
| @Test | @Test | ||||
| public void testIDLDestJava11plus() { | public void testIDLDestJava11plus() { | ||||
| assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); | assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); | ||||
| assumeFalse("Current system is Java 15 or newer", | |||||
| JavaEnvUtils.isAtLeastJavaVersion("15")); | |||||
| thrown.expect(BuildException.class); | thrown.expect(BuildException.class); | ||||
| thrown.expectMessage("this rmic implementation doesn't support the -idl switch"); | thrown.expectMessage("this rmic implementation doesn't support the -idl switch"); | ||||
| buildRule.executeTarget("testIDL"); | buildRule.executeTarget("testIDL"); | ||||
| @@ -463,6 +477,8 @@ public class RmicAdvancedTest { | |||||
| @Test | @Test | ||||
| public void testIIOPJava11plus() { | public void testIIOPJava11plus() { | ||||
| assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); | assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); | ||||
| assumeFalse("Current system is Java 15 or newer", | |||||
| JavaEnvUtils.isAtLeastJavaVersion("15")); | |||||
| thrown.expect(BuildException.class); | thrown.expect(BuildException.class); | ||||
| thrown.expectMessage("this rmic implementation doesn't support the -iiop switch"); | thrown.expectMessage("this rmic implementation doesn't support the -iiop switch"); | ||||
| buildRule.executeTarget("testIIOP"); | buildRule.executeTarget("testIIOP"); | ||||
| @@ -483,6 +499,8 @@ public class RmicAdvancedTest { | |||||
| @Test | @Test | ||||
| public void testIIOPDestJava11plus() { | public void testIIOPDestJava11plus() { | ||||
| assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); | assumeTrue("Current system is Java 10 or older", JavaEnvUtils.isAtLeastJavaVersion("11")); | ||||
| assumeFalse("Current system is Java 15 or newer", | |||||
| JavaEnvUtils.isAtLeastJavaVersion("15")); | |||||
| thrown.expect(BuildException.class); | thrown.expect(BuildException.class); | ||||
| thrown.expectMessage("this rmic implementation doesn't support the -iiop switch"); | thrown.expectMessage("this rmic implementation doesn't support the -iiop switch"); | ||||
| buildRule.executeTarget("testIIOP"); | buildRule.executeTarget("testIIOP"); | ||||