Re: @override?




"Roedy Green" <see_website@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:5h6ha3t6vhu9u7rhnp9pae2ior0idoj0di@xxxxxxxxxx
On Thu, 26 Jul 2007 08:16:48 GMT, "George3" <u19006@uwe> wrote, quoted
or indirectly quoted someone who said :

Are there any samples of how to use @override?
like any annotation, you put it between the JavaDoc and the method
definition. see http://mindprod.com/jgloss/annotations.html

Annotations can appear in other locations than on a method (but for
@Override, it only makes sense in that location).

You can put annotations on fields, or on specific parameters of a
method, for example.

public class Example {
@DoNotSerialize
public int fieldThatShouldntBeSerialized;

public int myMethod(@NonNull String foo) {
/*doesn't check against null here, because the contract of the method
assumes that it won't receive null as a parameter.*/
return foo.hashcode();
}
}

- Oliver


.



Relevant Pages

  • Re: Puzzling warning message
    ... >>> That is a strange syntax. ... It looks like JavaDoc but it is not. ... Since they eventually added annotations, ... If deprecation was going to be the last bit of meta-information ...
    (comp.lang.java.programmer)
  • Re: Canonical Comments
    ... I'm lazier than I should be about using annotations. ... Perhaps you are referring to the '@param' Javadoc tag? ... Javadoc tags are not annotations. ... As to Roedy's point, I put a /* comment block at the top of the file, before the package directive, with file name, repository keywords and the like. ...
    (comp.lang.java.programmer)
  • Annotations suppress javadoc
    ... When I include an annotation in my .java file, javadoc no longer gets generated. ... Javadoc works fine here, but unfortunately I'm using a code generator to create this file, and it's not capable of putting the annotations under the javadoc. ...
    (comp.lang.java.programmer)
  • Re: Annotations suppress javadoc
    ... My javadoc comments... ... The javadoc tool will not include the javadoc comments for the class in the output. ... Javadoc works fine here, but unfortunately I'm using a code generator to create this file, and it's not capable of putting the annotations under the javadoc. ...
    (comp.lang.java.programmer)