Sample testcase attached.
Because of this behavior, WsGen is generating incorrect classes when the WebServices it compiles uses java.xml.ws.Holder<T> as WebParam, and many TCK tests are failing.
In the testcase, for
public void testHolder(Holder<String> param) { }
public void visitMethodDeclaration(MethodDeclaration method) {
System.out.println(method.getSimpleName());
for (ParameterDeclaration param : method.getParameters()) {
TypeMirror type = param.getType();
System.out.println(type);
if (type instanceof DeclaredType) {
Collection<TypeMirror> argTypes = ((DeclaredType) type).getActualTypeArguments();
System.out.println(argTypes.size());
if (argTypes.size() == 1) {
TypeMirror mirror = argTypes.iterator().next();
System.out.println("argsTypes.iterator().next(): " + mirror);
}
}
}
}
argTypes.size is 0 when the sources are compiled with debug option. We expect the argTypes.iterator.next() to be String.
Output Without debug option:
test.Bar
testHolder
ann.Holder<java.lang.String>
1
argsTypes.iterator().next(): java.lang.String
Output With debug option:
test.Bar
testHolder
ann.Holder
0
Because of this behavior, WsGen is generating incorrect classes when the WebServices it compiles uses java.xml.ws.Holder<T> as WebParam, and many TCK tests are failing.
In the testcase, for
public void testHolder(Holder<String> param) { }
public void visitMethodDeclaration(MethodDeclaration method) {
System.out.println(method.getSimpleName());
for (ParameterDeclaration param : method.getParameters()) {
TypeMirror type = param.getType();
System.out.println(type);
if (type instanceof DeclaredType) {
Collection<TypeMirror> argTypes = ((DeclaredType) type).getActualTypeArguments();
System.out.println(argTypes.size());
if (argTypes.size() == 1) {
TypeMirror mirror = argTypes.iterator().next();
System.out.println("argsTypes.iterator().next(): " + mirror);
}
}
}
}
argTypes.size is 0 when the sources are compiled with debug option. We expect the argTypes.iterator.next() to be String.
Output Without debug option:
test.Bar
testHolder
ann.Holder<java.lang.String>
1
argsTypes.iterator().next(): java.lang.String
Output With debug option:
test.Bar
testHolder
ann.Holder
0
- duplicates
-
JDK-6468404 ExecutableElement.getParameters() uses raw type for class loaded from -g bytecode
-
- Closed
-