From b1f75a400db0cef4a61e42b69e7402db5ac0ee7c Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Mon, 7 Mar 2005 15:12:25 +0000 Subject: [PATCH] First fix the tests to fail when they should, then fix rmic to work as before, even on Java1.5, then add new tests to explicitly do version checks. bug "rmic always compiles on Java1.5" http://issues.apache.org/bugzilla/show_bug.cgi?id=33862 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277811 13f79535-47bb-0310-9956-ffa450edef68 --- src/etc/testcases/taskdefs/rmic/rmic.xml | 73 +++++++++++++++++-- .../ant/taskdefs/rmic/DefaultRmicAdapter.java | 19 ++++- .../tools/ant/taskdefs/RmicAdvancedTest.java | 32 +++++++- 3 files changed, 111 insertions(+), 13 deletions(-) diff --git a/src/etc/testcases/taskdefs/rmic/rmic.xml b/src/etc/testcases/taskdefs/rmic/rmic.xml index d5c25dd14..634229a06 100644 --- a/src/etc/testcases/taskdefs/rmic/rmic.xml +++ b/src/etc/testcases/taskdefs/rmic/rmic.xml @@ -37,26 +37,71 @@ - - - Not found : ${file.to.find} + Not found : ${build.dir}/@{file} + + + + - + + + + Expected to be missing : ${build.dir}/@{file} + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -75,6 +120,22 @@ + + + + + + + + + + + + + + + + diff --git a/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java b/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java index 980f72425..22b48a42d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java +++ b/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation + * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,6 +44,9 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { public static final String RMI_SKEL_SUFFIX = "_Skel"; /** suffix denoting a tie file */ public static final String RMI_TIE_SUFFIX = "_Tie"; + public static final String STUB_COMPAT = "-vcompat"; + public static final String STUB_1_1 = "-v1.1"; + public static final String STUB_1_2 = "-v1.2"; /** * Default constructor @@ -186,16 +189,24 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { cmd.createArgument().setValue("-classpath"); cmd.createArgument().setPath(classpath); + //handle the many different stub options. String stubVersion = attributes.getStubVersion(); + //default is compatibility + String stubOption=STUB_COMPAT; if (null != stubVersion) { if ("1.1".equals(stubVersion)) { - cmd.createArgument().setValue("-v1.1"); + stubOption = STUB_1_1; } else if ("1.2".equals(stubVersion)) { - cmd.createArgument().setValue("-v1.2"); + stubOption = STUB_1_2; + } else if ("compat".equals(stubVersion)) { + stubOption = STUB_COMPAT; } else { - cmd.createArgument().setValue("-vcompat"); + //anything else + attributes.log("Unknown stub option "+stubVersion); + //do nothing with the value? or go -v+stubVersion?? } } + cmd.createArgument().setValue(stubOption); if (null != attributes.getSourceBase()) { cmd.createArgument().setValue("-keepgenerated"); diff --git a/src/testcases/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java b/src/testcases/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java index 7a368f917..1fdf2293e 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation + * Copyright 2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,7 +92,7 @@ public class RmicAdvancedTest extends BuildFileTest { /** * test the forking compiler */ - public void NotestForkingAntClasspath() throws Exception { + public void testForkingAntClasspath() throws Exception { executeTarget("testForkingAntClasspath"); } @@ -154,7 +154,7 @@ public class RmicAdvancedTest extends BuildFileTest { /** - * test the forking compiler + * */ public void testMagicPropertyIsEmptyString() throws Exception { executeTarget("testMagicPropertyIsEmptyString"); @@ -168,6 +168,32 @@ public class RmicAdvancedTest extends BuildFileTest { } + /** + * test that version 1.1 stubs are good + * @throws Exception + */ + public void testVersion11() throws Exception { + executeTarget("testVersion11"); + } + + /** + * test that version 1.2 stubs are good + * + * @throws Exception + */ + public void testVersion12() throws Exception { + executeTarget("testVersion12"); + } + + /** + * test that version compat stubs are good + * + * @throws Exception + */ + public void testVersionCompat() throws Exception { + executeTarget("testVersionCompat"); + } + /** * this little bunny verifies that we can load stuff, and that * a failure to execute is turned into a fault