Bug 60863 - AJC behaves different when using @ to supply parameters
Summary: AJC behaves different when using @ to supply parameters
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-04 08:34 EDT by Gerard Davison CLA
Modified: 2005-03-22 08:56 EST (History)
0 users

See Also:


Attachments
Batch file with all parameter in-line (4.54 KB, text/plain)
2004-05-04 08:34 EDT, Gerard Davison CLA
no flags Details
aj2.bat, with @ specified parameters (199 bytes, text/plain)
2004-05-04 08:35 EDT, Gerard Davison CLA
no flags Details
aj2.param, external parameters for aj2.bat (4.39 KB, text/plain)
2004-05-04 08:35 EDT, Gerard Davison CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gerard Davison CLA 2004-05-04 08:34:00 EDT
Summary:

I was looking integrating ajc in my build sytem and I found that in some cases 
using the @ tag to supply parameters would fail whereas the command would 
suceed if the parameters would supplied directly.

For the attach aj.bat the following output is seen:

zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdk\jre\lib\i18n.jar

directory classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdk\jre\classes

directory classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\classes

zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\lib\jgl3.1.0.jar

zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\..\jsp\lib\ojspicons.jar

zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\..\jlib\jssl-1_2.jar

zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\lib\modelers.jar

zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\lib\jdukshare.jar

Terminate batch job (Y/N)? y

[D:\ade\gdavison_ct\modelers\src]..\tmp\aj.bat
zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdk\jre\lib\i18n.jar

directory classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdk\jre\classes

directory classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\classes

zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\lib\jgl3.1.0.jar

zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\..\jsp\lib\ojspicons.jar

zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\..\jlib\jssl-1_2.jar

zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\lib\modelers.jar

zipfile classpath entry does not exist: 
d:\ade\gdavison_ct\oracle\jdev\lib\jdukshare.jar

compiling D:\ade\gdavison_ct\modelers\ajsrc\oracle\ide\util\DontAllowPrintln.aj
.......

When I try to run the apparently similar aj2.bat with it parameter in 
aj2.param the aj command fails and complains that:

error directory does not exist: -inpath d:\ade\gdavison_ct\modelers\classes -d 
d:\ade\gdavison_ct\mo
delers\ajclasses -sourceroots d:\ade\gdavison_ct\modelers\ajsrc -classpath 
d:\ade\gdavison_ct\jtbuil
d\buildtools\aspectj\aspectjrt.jar;d:\ade\gdavison_ct\oracle\jdev\classes;d:\ad
e\gdavison_ct\oracle\
jdev\..\ide\lib\javatools.jar;d:\ade\gdavison_ct\oracle\jdev\..\ide\lib\ide.jar
;d:\ade\gdavison_ct\o
racle\jdev\lib\jdev.jar;d:\ade\gdavison_ct\oracle\jdev\lib\xmleditor.jar;d:\ade
\gdavison_ct\oracle\j
dev\lib\xmladdin.jar;d:\ade\gdavison_ct\oracle\jdev\lib\ojc.jar;d:\ade\gdavison
_ct\oracle\jdev\..\rd
bms\jlib\ojdi.jar;d:\ade\gdavison_ct\oracle\jdev\..\apache-ant-1.6.0
\lib\ant.jar;d:\ade\gdavison_ct\
oracle\jdev\..\apache-ant-1.6.0\lib\ant-
nodeps.jar;d:\ade\gdavison_ct\oracle\jdev\lib\batik-ext.jar;
d:\ade\gdavison_ct\oracle\jdev\..\lib\xmlparserv2.jar;d:\ade\gdavison_ct\oracle
\jdev\lib\jgl3.1.0.ja
r;d:\ade\gdavison_ct\oracle\jdev\..\jlib\jewt4.jar;d:\ade\gdavison_ct\oracle\jd
ev\..\jlib\share.jar;
d:\ade\gdavison_ct\oracle\jdev\..\jlib\help4.jar;d:\ade\gdavison_ct\oracle\jdev
\..\jlib\inspect4.jar
;d:\ade\gdavison_ct\oracle\jdev\..\vbroker4
\lib\vbjorb.jar;d:\ade\gdavison_ct\oracle\jdev\..\javavm\
lib\aurora.zip;d:\ade\gdavison_ct\oracle\jdev\..\jdbc\lib\ojdbc14.jar;d:\ade\gd
avison_ct\oracle\jdev
\..\jdbc\lib\orai18n.jar;d:\ade\gdavison_ct\oracle\jdev\..\j2ee\home\lib\ojsp.j
ar;d:\ade\gdavison_ct
\oracle\jdev\..\j2ee\home\jsp\lib\taglib\ojsputil.jar;d:\ade\gdavison_ct\oracle
\jdev\..\jsp\lib\ojsp
icons.jar;d:\ade\gdavison_ct\oracle\jdev\..\jlib\oracle_ice.jar;d:\ade\gdavison
_ct\oracle\jdev\..\sq
lj\lib\translator.jar;d:\ade\gdavison_ct\oracle\jdev\..\sqlj\lib\runtime12.jar;
d:\ade\gdavison_ct\or
acle\jdev\..\j2ee\home\lib\servlet.jar;d:\ade\gdavison_ct\oracle\jdev\..\jlib\r
egexp.jar;d:\ade\gdav
ison_ct\oracle\jdev\..\soap\lib\soap.jar;d:\ade\gdavison_ct\oracle\jdev\..\webs
ervices\lib\wsdl.jar;
d:\ade\gdavison_ct\oracle\jdev\..\webservices\lib\orawsdl.jar;d:\ade\gdavison_c
t\oracle\jdev\..\webs
ervices\lib\wsdl-
api.jar;d:\ade\gdavison_ct\oracle\jdev\..\webservices\lib\wsa.jar;d:\ade\gdavis
on_c
t\oracle\jdev\..\webservices\lib\wsclient.jar;d:\ade\gdavison_ct\oracle\jdev\..
\j2ee\home\lib\http_c
lient.jar;d:\ade\gdavison_ct\oracle\jdev\..\jlib\jssl-
1_2.jar;d:\ade\gdavison_ct\oracle\jdev\..\j2ee
\home\oc4j.jar;d:\ade\gdavison_ct\oracle\jdev\..\j2ee\home\lib\oc4j-
internal.jar;d:\ade\gdavison_ct\
oracle\jdev\..\lib\xmlcomp.jar;d:\ade\gdavison_ct\oracle\jdev\..\uddi\lib\uddic
lient.jar;d:\ade\gdav
ison_ct\oracle\jdev\..\jlib\uix2.jar;d:\ade\gdavison_ct\oracle\jdev\lib\jr_cmd.
jar;d:\ade\gdavison_c
t\oracle\jdev\lib\jr_cws.jar;d:\ade\gdavison_ct\oracle\jdev\lib\jr_dav.jar;d:\a
de\gdavison_ct\oracle
\jdev\lib\jr_diff.jar;d:\ade\gdavison_ct\oracle\jdev\lib\jr_file.jar;d:\ade\gda
vison_ct\oracle\jdev\
lib\jr_jol.jar;d:\ade\gdavison_ct\oracle\jdev\lib\jr_vhv.jar;d:\ade\gdavison_ct
\oracle\jdev\lib\tsgd
tj50.jar;d:\ade\gdavison_ct\oracle\jdev\lib\tsgetj50.jar;d:\ade\gdavison_ct\ora
cle\jdev\lib\tsgltjav
a50.jar;d:\ade\gdavison_ct\oracle\jdev\lib\tsgmtj50.jar;d:\ade\gdavison_ct\orac
le\jdev\..\toplink\jl
ib\toplink.jar;d:\ade\gdavison_ct\oracle\jdev\..\j2ee\home\lib\ejb.jar;d:\ade\g
davison_ct\oracle\jde
v\lib\tl_mappingeditor.jar;d:\ade\gdavison_ct\oracle\jdev\..\jakarta-commons-
el\commons-el.jar;d:\ad
e\gdavison_ct\oracle\jdev\..\jakarta-commons-el\jsp-el-
api.jar;d:\ade\gdavison_ct\oracle\jdev\..\jak
arta-commons-el\oracle-el.jar;d:\ade\gdavison_ct\oracle\jdev\lib\looks-
1.2.1.jar;d:\ade\gdavison_ct\
oracle\jdev\..\j2ee\home\lib\javax88.jar;d:\ade\gdavison_ct\oracle\jdev\..\xdoc
let-1.2\lib\commons-l
ogging.jar;d:\ade\gdavison_ct\oracle\jdev\..\xdoclet-1.2\lib\xdoclet-
1.2.jar;d:\ade\gdavison_ct\orac
le\jdev\..\xdoclet-1.2\lib\xjavadoc-
1.0.2.jar;d:\ade\gdavison_ct\oracle\jdev\lib\batik-awt-util.jar;
d:\ade\gdavison_ct\oracle\jdev\lib\batik-
dom.jar;d:\ade\gdavison_ct\oracle\jdev\lib\batik-svggen.jar
;d:\ade\gdavison_ct\oracle\jdev\lib\batik-
transcoder.jar;d:\ade\gdavison_ct\oracle\jdev\lib\batik-ut
il.jar;d:\ade\gdavison_ct\oracle\jdev\lib\batik-
xml.jar;d:\ade\gdavison_ct\oracle\jdev\lib\batik-bri
dge.jar;d:\ade\gdavison_ct\oracle\jdev\lib\batik-
css.jar;d:\ade\gdavison_ct\oracle\jdev\lib\batik-gu
i-util.jar;d:\ade\gdavison_ct\oracle\jdev\lib\batik-
gvt.jar;d:\ade\gdavison_ct\oracle\jdev\lib\batik
-parser.jar;d:\ade\gdavison_ct\oracle\jdev\lib\batik-
script.jar;d:\ade\gdavison_ct\oracle\jdev\lib\b
atik-svg-
dom.jar;d:\ade\gdavison_ct\oracle\jdev\lib\modelers.jar;d:\ade\gdavison_ct\orac
le\jdev\lib\
jdukshare.jar; -verbose

error no sources specified

This is an obvious difference in functionality for a change that shouldn't 
have made any difference. It was not apparent to me which directory doesn't 
exist, perhaps this error message could be made a little bit more versbose.
Comment 1 Gerard Davison CLA 2004-05-04 08:34:44 EDT
Created attachment 10248 [details]
Batch file with all parameter in-line
Comment 2 Gerard Davison CLA 2004-05-04 08:35:23 EDT
Created attachment 10249 [details]
aj2.bat, with @ specified parameters
Comment 3 Gerard Davison CLA 2004-05-04 08:35:46 EDT
Created attachment 10250 [details]
aj2.param, external parameters for aj2.bat
Comment 4 Andrew Clement CLA 2004-05-05 09:49:33 EDT
I've copied Wes (hope he doesn't mind!) as I'd like his opinion on this - he 
might have seen some previous bug report along these lines.

Basically, if you want to supply these kinds of argument in a .lst file then 
you need to supply one per line.

If your command line was:

ajc -sourceroots . -classpath "a.jar;b.jar"

then it looks like this in a .lst file:
----------
-sourceroots
.
-classpath
"a.jar;b.jar"
----------
If you put:
----------
-sourceroots .
-classpath "a.jar;b.jar"
----------
then the parsing code interprets each of these as a single option and as there 
is no single option called "-sourceroots ." then it fails.

If you put:
----------
-sourceroots . -classpath "a.jar;b.jar"
----------
then the parsing code interprets it as a single option and as there is no 
single option called '-sourceroots . -classpath "a.jar;b.jar"' then it fails.


The code that doesn't break lines in .lst files into pieces is:
  ConfigParser.parseConfigFileHelper()

And there may be a further peculiarity with -verbose ...  I think we check 
for -verbose before even opening the .lst file, so putting it in there rather 
than directly passing it to ajc is too late for it to 'switch on' verbose 
output.
Comment 5 Wes Isberg CLA 2004-05-05 13:23:09 EDT
All true: there should be no difference to ajc between specifying arguments on
the command-line or in a .lst file, except (a) relative .lst file arguments are
calculated relative to the .lst file, not the current working driectory; and (b)
special arguments like -verbose.  Also, if there is a problem with the argument,
ajc should point to the offending .lst file.

If ajc quoted the offending argument, then the error might be clearer:

  from: error directory does not exist: -inpath mydir
    to: error directory does not exist: "-inpath mydir"

Further, "directory does not exist" is just the last condition and rarely
helplful; it could say 

    to: error unrecognized input: "-inpath mydir"

These two changes would be harmless but helpful.
Comment 6 Gerard Davison CLA 2004-05-07 12:09:34 EDT
Okay I suppose that I didn't really know that was a limitation because I think 
that javac and javadoc allow more than one parameter on a line. But as you say 
it might be worth improving the error messages, possibly even failing if it 
detects more than one parameters on a line.
Comment 7 Andrew Clement CLA 2004-09-08 12:36:57 EDT
I've put in a fix for this - I think its ok - if no-one on the bug complains
I'll leave it like this ...

Basically I've changed the message and quoted it as per Wes' comment - but I
didn't use 'unrecognized input', I used:

[error] unrecognized single argument: "-inpath mydir"

Is that ok?

I did implement a fix that allowed for multiple arguments on each line of a .lst
file - but the implementation basically assumed ' ' was an argument boundary
(but it allowed for ' ' within an argument if it was quoted).  

The problem is all the .lst files out there in the wild may have entries like:

c:\program files\eclipse\blah.java
c:\program files\eclipse\aspect.java

which are paths that contain spaces but aren't quoted - so putting in my fix
will break people using .lst files with entries like that.
Comment 8 Adrian Colyer CLA 2005-03-22 08:56:56 EST
Fixed by Andy, closing out since no further comments were added in the last 6
months.