this is my code logic: I have a JSR 199 (JavaCompiler) that plugs in a processor (processor extends AbstractProcess or), the processor supports the annotation I want to reflect upon, @Worker and supports release 6 of J2SE. Am using NetBeans. The @Worker annotation is implemented a class, Staff, and the @Worker has @Target of TYPE.
Now the problem: when I compile the JSR 199 code, it returns:
E:\Documents and Settings\isaak\ My Documents\NetBe ansProjects\art icles\src\art\S taff.java:14: cannot find symbol
symbol: class Worker
@Worker(value=@ Name(firstName= "Jules", lastName="Verno n"),
E:\Documents and Settings\isaak\ My Documents\NetBe ansProjects\art icles\src\art\S taff.java:14: cannot find symbol
symbol: class Worker
@Worker(value=@ Name(firstName= "Jules", lastName="Verno n"),
1 error
now this is my @Worker declaration:
@Target(Element Type.TYPE)
@Retention(Rete ntionPolicy.CLA SS)
public @interface Worker {
Name value();
enum SeasonEmployed{ Spring, Winter, Autumn, Summer}
SeasonEmployed season();
String[] references() default "unavailabl e";
String townResidence() ;
}
and the @Name declaration that it nests:
@Target(Element Type.ANNOTATION _TYPE)
@Retention(Rete ntionPolicy.CLA SS)
public @interface Name {
String firstName();
String lastName();
}
and it's implemented by a class, Staff:
@Worker(value=@ Name(firstName= "Jules", lastName="Verno n"),
season=Worker.S easonEmployed.S ummer,
references={"Si te-Mgr", "Works-Mgr"},
townResidence=" London")
public class Staff {
private boolean employeeType;
public boolean getEType(){
return employeeType;
}
public Staff(boolean type){
this.employeeTy pe = type;
}
}
can anyone tell me why the compiler is giving that error. The processor's process method is very simple does nothing but call:
for(TypeElement te : annotations)... .
print out count of annotations in the element, staff.
That's all.
thanx
Now the problem: when I compile the JSR 199 code, it returns:
E:\Documents and Settings\isaak\ My Documents\NetBe ansProjects\art icles\src\art\S taff.java:14: cannot find symbol
symbol: class Worker
@Worker(value=@ Name(firstName= "Jules", lastName="Verno n"),
E:\Documents and Settings\isaak\ My Documents\NetBe ansProjects\art icles\src\art\S taff.java:14: cannot find symbol
symbol: class Worker
@Worker(value=@ Name(firstName= "Jules", lastName="Verno n"),
1 error
now this is my @Worker declaration:
@Target(Element Type.TYPE)
@Retention(Rete ntionPolicy.CLA SS)
public @interface Worker {
Name value();
enum SeasonEmployed{ Spring, Winter, Autumn, Summer}
SeasonEmployed season();
String[] references() default "unavailabl e";
String townResidence() ;
}
and the @Name declaration that it nests:
@Target(Element Type.ANNOTATION _TYPE)
@Retention(Rete ntionPolicy.CLA SS)
public @interface Name {
String firstName();
String lastName();
}
and it's implemented by a class, Staff:
@Worker(value=@ Name(firstName= "Jules", lastName="Verno n"),
season=Worker.S easonEmployed.S ummer,
references={"Si te-Mgr", "Works-Mgr"},
townResidence=" London")
public class Staff {
private boolean employeeType;
public boolean getEType(){
return employeeType;
}
public Staff(boolean type){
this.employeeTy pe = type;
}
}
can anyone tell me why the compiler is giving that error. The processor's process method is very simple does nothing but call:
for(TypeElement te : annotations)... .
print out count of annotations in the element, staff.
That's all.
thanx
Comment