The following interface:
import javax.xml.ws.Action;
public interface AnnotationsTestInterface {
@Action
public void annotatedMethod();
}
And an implementing class:
public class Impl implements AnnotationsTestInterface {}
At this point Eclipse asks me to add unimplemented methods (I choose this) or make the class abstract.
After the addition the class looks like this:
import javax.xml.ws.Action;
public class Impl implements AnnotationsTestInterface {
@Override
@Action
public void annotatedMethod() {
// TODO Auto-generated method stub
}
}
It correctly writes the Action annotation.
On another Eclipse instance (same version, different user) the "Add unimplemented methods" action results in this (no @Action
annotation):
public class Impl implements AnnotationsTestInterface {
@Override
public void annotatedMethod() {
// TODO Auto-generated method stub
}
}
Is there an option somewhere that deals with this?
Note that the execution environment is set on Java SE 6, with a JDK 6.
Annotation is defined like a ordinary Java interface, but with an '@' preceding the interface keyword (i.e., @interface ). You can declare methods inside an annotation definition (just like declaring abstract method inside an interface). These methods are called elements instead.
On eclipse, go to Window->Preferences->Java->Code Style->Clean Up and look around in there. If not there, look around in Code Style. You ought to find it! If I had to guess, if @Action isn't showing up in the TODO auto-generated stuff smutzle and what not, you have an old version of eclipse, or it wasn't configured to do that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With