hasn't set the compiler. PR: 13246 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273402 13f79535-47bb-0310-9956-ffa450edef68master
@@ -755,8 +755,10 @@ public class Javac extends MatchingTask { | |||||
String compilerImpl = getCompilerVersion(); | String compilerImpl = getCompilerVersion(); | ||||
if (fork) { | if (fork) { | ||||
if (isJdkCompiler(compilerImpl)) { | if (isJdkCompiler(compilerImpl)) { | ||||
log("Since fork is true, ignoring compiler setting.", | |||||
Project.MSG_WARN); | |||||
if (facade.hasBeenSet()) { | |||||
log("Since fork is true, ignoring compiler setting.", | |||||
Project.MSG_WARN); | |||||
} | |||||
compilerImpl = "extJavac"; | compilerImpl = "extJavac"; | ||||
} else { | } else { | ||||
log("Since compiler setting isn't classic or modern," | log("Since compiler setting isn't classic or modern," | ||||
@@ -164,4 +164,14 @@ public class FacadeTaskHelper { | |||||
tmp.copyInto(res); | tmp.copyInto(res); | ||||
return res; | return res; | ||||
} | } | ||||
/** | |||||
* Tests whether the implementation has been chosen by the user | |||||
* (either via a magic property or explicitly. | |||||
* | |||||
* @since Ant 1.5.2 | |||||
*/ | |||||
public boolean hasBeenSet() { | |||||
return userChoice != null || magicValue != null; | |||||
} | |||||
} | } |
@@ -84,4 +84,17 @@ public class FacadeTaskHelperTest extends TestCase { | |||||
fth.setImplementation("baz"); | fth.setImplementation("baz"); | ||||
assertEquals("baz", fth.getImplementation()); | assertEquals("baz", fth.getImplementation()); | ||||
} | } | ||||
public void testHasBeenSet() { | |||||
FacadeTaskHelper fth = new FacadeTaskHelper("foo"); | |||||
assertTrue("nothing set", !fth.hasBeenSet()); | |||||
fth.setMagicValue(null); | |||||
assertTrue("magic has not been set", !fth.hasBeenSet()); | |||||
fth.setMagicValue("foo"); | |||||
assertTrue("magic has been set", fth.hasBeenSet()); | |||||
fth.setMagicValue(null); | |||||
assertTrue(!fth.hasBeenSet()); | |||||
fth.setImplementation("baz"); | |||||
assertTrue("set explicitly", fth.hasBeenSet()); | |||||
} | |||||
} | } |