sw.print(constructor.getReturnType().getQualifiedSourceName());
sw.print(" ");
sw.print(constructor.getName());
sw.print("(");
for (int i = 0; i < parameters.length; i++) {
JType returnType = parameters[i].getType();
JParameterizedType pType = returnType.isParameterized();
if (pType != null) {
sw.print(pType.getRawType().getQualifiedSourceName());
} else {
sw.print(returnType.getQualifiedSourceName());
}
sw.print(" ");
sw.print(parameters[i].getName());
if (i < parameters.length - 1) {
sw.print(", ");
}
}
sw.print(")");
sw.println(" /*-{");
sw.indent();
JType returnType = constructor.getReturnType();
FragmentGeneratorContext subContext = new FragmentGeneratorContext(context);
subContext.returnType = returnType;
subContext.parameterName = "jsReturn";
subContext.objRef = "jsReturn";
sw.print("var ");
sw.print(subContext.objRef);
sw.print(" = ");
Constructor constructorAnnotation = hasTag(logger, constructor,
Constructor.class);
Global globalAnnotation = hasTag(logger, constructor, Global.class);
if (constructorAnnotation != null) {
// If the imported method is acting as an invocation of a JavaScript
// constructor, use the new Foo() syntax, otherwise treat is an an
// invocation on a field on the underlying JSO.
sw.print("new ");
sw.print(constructorAnnotation.value());
// Write the invocation's parameter list
sw.print("(");
for (int i = 0; i < parameters.length; i++) {
// Create a sub-context to generate the wrap/unwrap logic
JType subType = parameters[i].getType();
FragmentGeneratorContext subParams = new FragmentGeneratorContext(
context);
subParams.returnType = subType;
subParams.parameterName = parameters[i].getName();