mirror of
https://github.com/github/codeql.git
synced 2026-08-06 10:18:43 +02:00
53 lines
1.4 KiB
XML
53 lines
1.4 KiB
XML
<!DOCTYPE qhelp PUBLIC
|
|
"-//Semmle//qhelp//EN"
|
|
"qhelp.dtd">
|
|
<qhelp>
|
|
|
|
|
|
<overview>
|
|
<p>Although an annotation type is a special kind of interface that
|
|
can be implemented by a concrete class, this is not its intended use.
|
|
It is more likely that an annotation type should be used to annotate a class.
|
|
</p>
|
|
|
|
</overview>
|
|
<recommendation>
|
|
|
|
<p>Ensure that any annotations are used to annotate a class, unless they are really supposed to be
|
|
extended or implemented by the class.
|
|
</p>
|
|
|
|
</recommendation>
|
|
<example>
|
|
|
|
<p>In the following example, the annotation <code>Deprecated</code> is implemented by the class
|
|
<code>ImplementsAnnotation</code>.</p>
|
|
|
|
<sample src="ImplementsAnnotation.java" />
|
|
|
|
<p>The following example shows the intended use of annotations: to annotate the class
|
|
<code>ImplementsAnnotationFix</code>.</p>
|
|
|
|
<sample src="ImplementsAnnotationGood.java" />
|
|
|
|
</example>
|
|
<references>
|
|
|
|
|
|
<li>
|
|
The Java Language Specification:
|
|
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-9.html#jls-9.6">Annotation Types</a>.
|
|
</li>
|
|
<li>
|
|
The Java Tutorials:
|
|
<a href="http://docs.oracle.com/javase/tutorial/java/annotations/index.html">Annotations</a>.
|
|
</li>
|
|
<li>
|
|
Help - Eclipse Platform:
|
|
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
|
</li>
|
|
|
|
|
|
</references>
|
|
</qhelp>
|