@@ -33,6 +33,9 @@ Other changes: | |||||
* Allow Saxon to be used for junitreport XSL transformation | * Allow Saxon to be used for junitreport XSL transformation | ||||
Github Pull Request #57 | Github Pull Request #57 | ||||
* when running on Java 11+ rmic will fail early if iiop or idl are | |||||
requested. Java11 removes support for CORBA and the switches have | |||||
been removed from the rmic tool. | |||||
Changes from Ant 1.10.1 TO Ant 1.10.2 | Changes from Ant 1.10.1 TO Ant 1.10.2 | ||||
===================================== | ===================================== | ||||
@@ -70,6 +70,14 @@ are the choices:</p> | |||||
project contains a compiler implementation for this task as well, please consult miniRMI's | project contains a compiler implementation for this task as well, please consult miniRMI's | ||||
documentation to learn how to use it.</p> | documentation to learn how to use it.</p> | ||||
<h4>CORBA support</h4> | |||||
<p>Java 11 removes the CORBA and JavaEE packages and rmic no longer | |||||
supports either <code>iiop</code> nor <code>idl</code>. Starting | |||||
with Ant 1.10.3 the rmic task will fail when using either while | |||||
running Java11+ unless you fork the task and explicitly specify an | |||||
executable.</p> | |||||
<h3>Parameters</h3> | <h3>Parameters</h3> | ||||
<table class="attr"> | <table class="attr"> | ||||
<tr> | <tr> | ||||
@@ -155,7 +163,8 @@ documentation to learn how to use it.</p> | |||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td>iiop</td> | <td>iiop</td> | ||||
<td>indicates that portable (RMI/IIOP) stubs should be generated</td> | |||||
<td>indicates that portable (RMI/IIOP) stubs should be | |||||
generated.<br/> See the note on CORBA support above.</td> | |||||
<td>No</td> | <td>No</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
@@ -165,7 +174,8 @@ documentation to learn how to use it.</p> | |||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td>idl</td> | <td>idl</td> | ||||
<td>indicates that IDL output files should be generated</td> | |||||
<td>indicates that IDL output files should be generated.<br/> See | |||||
the note on CORBA support above.</td> | |||||
<td>No</td> | <td>No</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
@@ -175,6 +175,18 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { | |||||
return classpath; | return classpath; | ||||
} | } | ||||
/** | |||||
* Whether the iiop and idl switches are supported. | |||||
* | |||||
* <p>This implementation returns false if running on Java 11 | |||||
* onwards and true otherwise.</p> | |||||
* @return true if the iiop and idl switches are supported | |||||
* @since Ant 1.10.3 | |||||
*/ | |||||
protected boolean areIiopAndIdlSupported() { | |||||
return !JavaEnvUtils.isAtLeastJavaVersion("11"); | |||||
} | |||||
/** | /** | ||||
* Setup rmic argument for rmic. | * Setup rmic argument for rmic. | ||||
* @return the command line | * @return the command line | ||||
@@ -222,6 +234,9 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { | |||||
} | } | ||||
if (attributes.getIiop()) { | if (attributes.getIiop()) { | ||||
if (!areIiopAndIdlSupported()) { | |||||
throw new BuildException("this rmic implementation doesn't support the -iiop switch"); | |||||
} | |||||
attributes.log("IIOP has been turned on.", Project.MSG_INFO); | attributes.log("IIOP has been turned on.", Project.MSG_INFO); | ||||
cmd.createArgument().setValue("-iiop"); | cmd.createArgument().setValue("-iiop"); | ||||
if (attributes.getIiopopts() != null) { | if (attributes.getIiopopts() != null) { | ||||
@@ -232,6 +247,9 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { | |||||
} | } | ||||
if (attributes.getIdl()) { | if (attributes.getIdl()) { | ||||
if (!areIiopAndIdlSupported()) { | |||||
throw new BuildException("this rmic implementation doesn't support the -idl switch"); | |||||
} | |||||
cmd.createArgument().setValue("-idl"); | cmd.createArgument().setValue("-idl"); | ||||
attributes.log("IDL has been turned on.", Project.MSG_INFO); | attributes.log("IDL has been turned on.", Project.MSG_INFO); | ||||
if (attributes.getIdlopts() != null) { | if (attributes.getIdlopts() != null) { | ||||
@@ -45,6 +45,21 @@ public class ForkingSunRmic extends DefaultRmicAdapter { | |||||
*/ | */ | ||||
public static final String COMPILER_NAME = "forking"; | public static final String COMPILER_NAME = "forking"; | ||||
/** | |||||
* @since Ant 1.10.3 | |||||
*/ | |||||
@Override | |||||
protected boolean areIiopAndIdlSupported() { | |||||
boolean supported = !JavaEnvUtils.isAtLeastJavaVersion("11"); | |||||
if (!supported && getRmic().getExecutable() != null) { | |||||
getRmic().getProject() | |||||
.log("Allowing -iiop and -idl for forked rmic even though this version of Java doesn't support it.", | |||||
Project.MSG_INFO); | |||||
return true; | |||||
} | |||||
return supported; | |||||
} | |||||
/** | /** | ||||
* exec by creating a new command | * exec by creating a new command | ||||
* @return true if the command ran successfully | * @return true if the command ran successfully | ||||
@@ -43,6 +43,16 @@ public class KaffeRmic extends DefaultRmicAdapter { | |||||
*/ | */ | ||||
public static final String COMPILER_NAME = "kaffe"; | public static final String COMPILER_NAME = "kaffe"; | ||||
/** | |||||
* @since Ant 1.10.3 | |||||
*/ | |||||
@Override | |||||
protected boolean areIiopAndIdlSupported() { | |||||
// actually I don't think Kaffee supports either, but we've | |||||
// accepted the flags prior to 1.10.3 | |||||
return true; | |||||
} | |||||
/** {@inheritDoc} */ | /** {@inheritDoc} */ | ||||
@Override | @Override | ||||
public boolean execute() throws BuildException { | public boolean execute() throws BuildException { | ||||
@@ -51,6 +51,16 @@ public class WLRmic extends DefaultRmicAdapter { | |||||
/** unsupported error message */ | /** unsupported error message */ | ||||
public static final String UNSUPPORTED_STUB_OPTION = "Unsupported stub option: "; | public static final String UNSUPPORTED_STUB_OPTION = "Unsupported stub option: "; | ||||
/** | |||||
* @since Ant 1.10.3 | |||||
*/ | |||||
@Override | |||||
protected boolean areIiopAndIdlSupported() { | |||||
// actually I don't think Weblogic's rmic supports either, but | |||||
// we've accepted the flags prior to 1.10.3 | |||||
return true; | |||||
} | |||||
/** | /** | ||||
* Carry out the rmic compilation. | * Carry out the rmic compilation. | ||||
* @return true if the compilation succeeded | * @return true if the compilation succeeded | ||||
@@ -389,7 +389,7 @@ public class RmicAdvancedTest { | |||||
*/ | */ | ||||
@Test | @Test | ||||
public void testIDL() throws Exception { | public void testIDL() throws Exception { | ||||
buildRule.executeTarget("testIDL"); | |||||
corbaTest("testIDL"); | |||||
} | } | ||||
/** | /** | ||||
@@ -399,7 +399,7 @@ public class RmicAdvancedTest { | |||||
*/ | */ | ||||
@Test | @Test | ||||
public void testIDLDest() throws Exception { | public void testIDLDest() throws Exception { | ||||
buildRule.executeTarget("testIDLDest"); | |||||
corbaTest("testIDLDest"); | |||||
} | } | ||||
/** | /** | ||||
@@ -409,7 +409,7 @@ public class RmicAdvancedTest { | |||||
*/ | */ | ||||
@Test | @Test | ||||
public void testIIOP() throws Exception { | public void testIIOP() throws Exception { | ||||
buildRule.executeTarget("testIIOP"); | |||||
corbaTest("testIIOP"); | |||||
} | } | ||||
/** | /** | ||||
@@ -419,7 +419,7 @@ public class RmicAdvancedTest { | |||||
*/ | */ | ||||
@Test | @Test | ||||
public void testIIOPDest() throws Exception { | public void testIIOPDest() throws Exception { | ||||
buildRule.executeTarget("testIIOPDest"); | |||||
corbaTest("testIIOPDest"); | |||||
} | } | ||||
private void xnewTest(String target) { | private void xnewTest(String target) { | ||||
@@ -435,6 +435,23 @@ public class RmicAdvancedTest { | |||||
} | } | ||||
} | } | ||||
private void corbaTest(String target) { | |||||
if (!JavaEnvUtils.isAtLeastJavaVersion("11")) { | |||||
buildRule.executeTarget(target); | |||||
} else { | |||||
try { | |||||
buildRule.executeTarget(target); | |||||
fail("Target should have thrown a BuildException"); | |||||
} catch (BuildException ex) { | |||||
if (target.indexOf("IDL") > -1) { | |||||
assertEquals("this rmic implementation doesn't support the -idl switch", ex.getMessage()); | |||||
} else { | |||||
assertEquals("this rmic implementation doesn't support the -iiop switch", ex.getMessage()); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
/** | /** | ||||
* this little bunny verifies that we can load stuff, and that | * this little bunny verifies that we can load stuff, and that | ||||
* a failure to execute is turned into a fault | * a failure to execute is turned into a fault | ||||