Hey,
I noticed the following:
The JavaParserImpl did this:
if (JavaAnnotation.class.isAssignableFrom(type))
return (T) parse("public @annotation JavaAnnotation { }");
I changed it to this and now it works:
if (JavaAnnotation.class.isAssignableFrom(type))
return (T) parse("public @interface JavaAnnotation { }");
Is everybody in with me?
Cheers,
Daniel
Am 15.12.2011 um 22:04 schrieb Daniel Sachse:
Hey guys,
atm I am working on FORGE-372 and I need to create a Qualifier into the target project.
I made a method on my own which looks the following:
private JavaAnnotation createQualifier(String packageName, String interfaceName) {
JavaAnnotation javaAnnotation =
JavaParser.create(JavaAnnotation.class).setName(interfaceName).setPackage(packageName);
javaAnnotation.addImport(Qualifier.class);
javaAnnotation.addImport(Target.class);
javaAnnotation.addImport(Retention.class);
javaAnnotation.addImport(Documented.class);
javaAnnotation.addAnnotation(Qualifier.class);
javaAnnotation.addAnnotation(Target.class).setEnumValue(TYPE).setEnumValue(METHOD).setEnumValue(PARAMETER).setEnumValue(FIELD);
javaAnnotation.addAnnotation(Retention.class).setEnumValue(RUNTIME);
javaAnnotation.addAnnotation(Documented.class);
return javaAnnotation;
}
As soon as I try to save it with
"javaSourceFacet.saveJavaSource(createQualifier(packageName,
"Forge"));", Forge throws the following error: "seam-persistence
install-managed-persistence-context] Unknown JavaSource type."
Anyone any idea?
BTW:
If this createQualifier annotation doesn't exist already somewhere else, I would
suggest to move into the core somewhere, as soon as it is finished and tested.
Unfortunately I can't see the output atm.
Regards,
Daniel