FULL PRODUCT VERSION :
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
In the documentation of APT, the tool is suppose to parse the command line arguments and construct a map of options. This map should include all processor-specific options (the -A options).
The syntax for -A option is -A[key][=value]. The problem occurs with options in the form of -Akey=value - the following code is suppose to return the value:
AnnotationProcessorEnvironment env (obtained from the factory)
String val=env.getOptions().get("-Akey");
val should contain "value", instead it is always null, and the following key is added to the options map: "key=value", which means that in order to obtain the value the following code should be used:
for(String s : env.getOptions().keySet()) {
if(s.startsWith("-Akey=")) {
String val=s.substring(s.indexOf("=")+1);
System.out.println(val);
}
}
in simple words - the parsing of the option is not done, instead the key value pair is inserted as the key of the options map and the value is always null.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
write an annotation processor factory that declares that it accepts a -Akey option and try my code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the expected result is the value of the key in the options map
ACTUAL -
the actual result is always null value - as if the key has no value
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
see probelm description
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
see above description
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
In the documentation of APT, the tool is suppose to parse the command line arguments and construct a map of options. This map should include all processor-specific options (the -A options).
The syntax for -A option is -A[key][=value]. The problem occurs with options in the form of -Akey=value - the following code is suppose to return the value:
AnnotationProcessorEnvironment env (obtained from the factory)
String val=env.getOptions().get("-Akey");
val should contain "value", instead it is always null, and the following key is added to the options map: "key=value", which means that in order to obtain the value the following code should be used:
for(String s : env.getOptions().keySet()) {
if(s.startsWith("-Akey=")) {
String val=s.substring(s.indexOf("=")+1);
System.out.println(val);
}
}
in simple words - the parsing of the option is not done, instead the key value pair is inserted as the key of the options map and the value is always null.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
write an annotation processor factory that declares that it accepts a -Akey option and try my code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the expected result is the value of the key in the options map
ACTUAL -
the actual result is always null value - as if the key has no value
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
see probelm description
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
see above description
- duplicates
-
JDK-6258929 AnnotationProcessorEnvironment.getOptions doesn't return options as key/values
- Closed