ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jaikiran Pai <>
Subject Re: module naming syntax
Date Wed, 15 May 2019 04:43:33 GMT

On 14/05/19 12:31 PM, Stefan Bodewig wrote:
> On 2019-05-14, Glenn Burkhardt wrote:
>>   <java fork="true" modulepath="axb-ri/mod"
>> module="">
>>                 <arg value="-d out"/>
>>                 <arg value="-p generated"/>
>>                 <arg value="Schema_Specification.xsd"/>
>>  </java>
>> Running 'ant' in verbose mode, it shows that the argument "-m
>>\" is passed to the Java
>> program.
> I think what happens here is CommandlineJava#setModule is called with
> executableType being null and thus Commandline#setExecutable is called
> without the second argument which would prevent slash translation.
> From the top of my head I don't recall why we have a case for
> executableType being null here at all rather than switching to module
> mode immediately and processing the argument after that. There must be a
> reason for that but figuring things out requires a bit more thought.
Now that Glenn seems to have got past the issue by following the
workaround suggested, do you think we should fix this code, to handle
the case where the module name could have a slash character. I think the
fix could be as simple as:

diff --git a/src/main/org/apache/tools/ant/types/
index 876675332..9f9b444e7 100644
--- a/src/main/org/apache/tools/ant/types/
+++ b/src/main/org/apache/tools/ant/types/
@@ -397,7 +397,7 @@ public class CommandlineJava implements Cloneable {
     public void setModule(final String module) {
         if (executableType == null) {
-            javaCommand.setExecutable(module);
+            javaCommand.setExecutable(module, false);
         } else {
             switch (executableType) {
                 case JAR:

(of course with test cases added for this specific case).

Just like you, I'm not fully sure why that executableType == null check
is there. Maybe that whole if/else block along with the switch is trying
to take into account the case of attribute order parsing (for example,
the "classname" attribute having been parsed before the "module"
attribute because that's how the user used it?) while reading the
"<java>" element?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message