Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(805)

Side by Side Diff: doc/manual/annotations.html

Issue 594833004: Roll FindBugs from 2.0.3 to 3.0.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/findbugs.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « doc/manual/acknowledgments.html ('k') | doc/manual/anttask.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html><head> 1 <html><head>
2 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 2 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
3 <title>Chapter&nbsp;10.&nbsp;Annotations</title><meta name="generator" conten t="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="Fi ndBugs&#8482; Manual"><link rel="up" href="index.html" title="FindBugs&#8482; Ma nual"><link rel="prev" href="analysisprops.html" title="Chapter&nbsp;9.&nbsp;Ana lysis Properties"><link rel="next" href="rejarForAnalysis.html" title="Chapter&n bsp;11.&nbsp;Using rejarForAnalysis"></head><body bgcolor="white" text="black" l ink="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table widt h="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter& nbsp;10.&nbsp;Annotations</th></tr><tr><td width="20%" align="left"><a accesskey ="p" href="analysisprops.html">Prev</a>&nbsp;</td><th width="60%" align="center" >&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="rejarForA nalysis.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Ch apter&nbsp;10.&nbsp;Annotations"><div class="titlepage"><div><div><h2 class="tit le"><a name="annotations"></a>Chapter&nbsp;10.&nbsp;Annotations</h2></div></div> </div><p> 3 <title>Chapter&nbsp;10.&nbsp;Annotations</title><meta name="generator" conten t="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="Fi ndBugs&#8482; Manual"><link rel="up" href="index.html" title="FindBugs&#8482; Ma nual"><link rel="prev" href="analysisprops.html" title="Chapter&nbsp;9.&nbsp;Ana lysis Properties"><link rel="next" href="rejarForAnalysis.html" title="Chapter&n bsp;11.&nbsp;Using rejarForAnalysis"></head><body bgcolor="white" text="black" l ink="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table widt h="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter& nbsp;10.&nbsp;Annotations</th></tr><tr><td width="20%" align="left"><a accesskey ="p" href="analysisprops.html">Prev</a>&nbsp;</td><th width="60%" align="center" >&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="rejarForA nalysis.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Ch apter&nbsp;10.&nbsp;Annotations"><div class="titlepage"><div><div><h2 class="tit le"><a name="annotations"></a>Chapter&nbsp;10.&nbsp;Annotations</h2></div></div> </div><p>
4 <span class="application">FindBugs</span> supports several annotations to expres s the developer's intent 4 <span class="application">FindBugs</span> supports several annotations to expres s the developer's intent
5 so that FindBugs can issue warnings more appropriately. You need to use 5 so that FindBugs can issue warnings more appropriately. You need to use
6 Java 5 to use annotations, and must place the annotations.jar and jsr305.jar 6 Java 5 to use annotations, and must place the annotations.jar and jsr305.jar
7 files in the classpath while compiling your program. 7 files in the classpath while compiling your program.
8 </p><div class="variablelist"><dl><dt><span class="term"><span class="command">< strong>edu.umd.cs.findbugs.annotations.CheckForNull</strong></span></span></dt>< dd><span class="command"><strong>[Target]</strong></span> Field, Method, Paramet er 8 </p><div class="variablelist"><dl><dt><span class="term"><span class="command">< strong>edu.umd.cs.findbugs.annotations.CheckForNull</strong></span></span></dt>< dd><p>
9 <p> 9 <span class="command"><strong>[Target]</strong></span> Field, Method, Pa rameter
10 </p><p>
10 The annotated element might be null, and uses of the element should check for nu ll. 11 The annotated element might be null, and uses of the element should check for nu ll.
11 When this annotation is applied to a method it applies to the method return valu e. 12 When this annotation is applied to a method it applies to the method return valu e.
12 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.CheckReturnValue</strong></span></span></dt><dd><span class= "command"><strong>[Target]</strong></span> Method, Constructor 13 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.CheckReturnValue</strong></span></span></dt><dd><p>
13 <div class="variablelist"><dl><dt><span class="term"><span class="command">< strong>[Parameter]</strong></span></span></dt><dd><p> 14 <span class="command"><strong>[Target]</strong></span> Method, Constructor
15 </p><div class="variablelist"><dl><dt><span class="term"><span class="comman d"><strong>[Parameter]</strong></span></span></dt><dd><p>
14 <span class="command"><strong>priority:</strong></span>The priorit y of the warning (HIGH, MEDIUM, LOW, IGNORE). Default value:MEDIUM. 16 <span class="command"><strong>priority:</strong></span>The priorit y of the warning (HIGH, MEDIUM, LOW, IGNORE). Default value:MEDIUM.
15 </p><p> 17 </p><p>
16 <span class="command"><strong>explanation:</strong></span>A textua l explaination of why the return value should be checked. Default value:"". 18 <span class="command"><strong>explanation:</strong></span>A textua l explaination of why the return value should be checked. Default value:"".
17 </p></dd></dl></div><p> 19 </p></dd></dl></div><p>
18 This annotation is used to denote a method whose return value should always be c hecked after invoking the method. 20 This annotation is used to denote a method whose return value should always be c hecked after invoking the method.
19 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.DefaultAnnotation</strong></span></span></dt><dd><span class ="command"><strong>[Target]</strong></span> Type, Package 21 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.DefaultAnnotation</strong></span></span></dt><dd><p>
20 <div class="variablelist"><dl><dt><span class="term"><span class="command">< strong>[Parameter]</strong></span></span></dt><dd><p> 22 <span class="command"><strong>[Target]</strong></span> Type, Package
23 </p><div class="variablelist"><dl><dt><span class="term"><span class="comm and"><strong>[Parameter]</strong></span></span></dt><dd><p>
21 <span class="command"><strong>value:</strong></span>Annotation cla ss objects. More than one class can be specified. 24 <span class="command"><strong>value:</strong></span>Annotation cla ss objects. More than one class can be specified.
22 </p><p> 25 </p><p>
23 <span class="command"><strong>priority:</strong></span>Default pri ority(HIGH, MEDIUM, LOW, IGNORE). Default value:MEDIUM. 26 <span class="command"><strong>priority:</strong></span>Default pri ority(HIGH, MEDIUM, LOW, IGNORE). Default value:MEDIUM.
24 </p></dd></dl></div><p> 27 </p></dd></dl></div><p>
25 Indicates that all members of the class or package should be annotated with the default 28 Indicates that all members of the class or package should be annotated with the default
26 value of the supplied annotation classes. This would be used for behavior annota tions 29 value of the supplied annotation classes. This would be used for behavior annota tions
27 such as @NonNull, @CheckForNull, or @CheckReturnValue. In particular, you can us e 30 such as @NonNull, @CheckForNull, or @CheckReturnValue. In particular, you can us e
28 @DefaultAnnotation(NonNull.class) on a class or package, and then use @Nullable only 31 @DefaultAnnotation(NonNull.class) on a class or package, and then use @Nullable only
29 on those parameters, methods or fields that you want to allow to be null. 32 on those parameters, methods or fields that you want to allow to be null.
30 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.DefaultAnnotationForFields</strong></span></span></dt><dd><s pan class="command"><strong>[Target]</strong></span> Type, Package 33 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.DefaultAnnotationForFields</strong></span></span></dt><dd><p >
31 <div class="variablelist"><dl><dt><span class="term"><span class="command">< strong>[Parameter]</strong></span></span></dt><dd><p> 34 <span class="command"><strong>[Target]</strong></span> Type, Package
35 </p><div class="variablelist"><dl><dt><span class="term"><span class="comman d"><strong>[Parameter]</strong></span></span></dt><dd><p>
32 <span class="command"><strong>value:</strong></span>Annotation cla ss objects. More than one class can be specified. 36 <span class="command"><strong>value:</strong></span>Annotation cla ss objects. More than one class can be specified.
33 </p><p> 37 </p><p>
34 <span class="command"><strong>priority:</strong></span>Default pri ority(HIGH, MEDIUM, LOW, IGNORE). Default value:MEDIUM. 38 <span class="command"><strong>priority:</strong></span>Default pri ority(HIGH, MEDIUM, LOW, IGNORE). Default value:MEDIUM.
35 </p></dd></dl></div><p> 39 </p></dd></dl></div><p>
36 This is same as the DefaultAnnotation except it only applys to fields. 40 This is same as the DefaultAnnotation except it only applys to fields.
37 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.DefaultAnnotationForMethods</strong></span></span></dt><dd>< span class="command"><strong>[Target]</strong></span> Type, Package 41 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.DefaultAnnotationForMethods</strong></span></span></dt><dd>< p>
38 <div class="variablelist"><dl><dt><span class="term"><span class="command">< strong>[Parameter]</strong></span></span></dt><dd><p> 42 <span class="command"><strong>[Target]</strong></span> Type, Package
43 </p><div class="variablelist"><dl><dt><span class="term"><span class="comman d"><strong>[Parameter]</strong></span></span></dt><dd><p>
39 <span class="command"><strong>value:</strong></span>Annotation cla ss objects. More than one class can be specified. 44 <span class="command"><strong>value:</strong></span>Annotation cla ss objects. More than one class can be specified.
40 </p><p> 45 </p><p>
41 <span class="command"><strong>priority:</strong></span>Default pri ority(HIGH, MEDIUM, LOW, IGNORE). Default value:MEDIUM. 46 <span class="command"><strong>priority:</strong></span>Default pri ority(HIGH, MEDIUM, LOW, IGNORE). Default value:MEDIUM.
42 </p></dd></dl></div><p> 47 </p></dd></dl></div><p>
43 This is same as the DefaultAnnotation except it only applys to methods. 48 This is same as the DefaultAnnotation except it only applys to methods.
44 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.DefaultAnnotationForParameters</strong></span></span></dt><d d><span class="command"><strong>[Target]</strong></span> Type, Package 49 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.DefaultAnnotationForParameters</strong></span></span></dt><d d><p>
45 <div class="variablelist"><dl><dt><span class="term"><span class="command">< strong>[Parameter]</strong></span></span></dt><dd><p> 50 <span class="command"><strong>[Target]</strong></span> Type, Package
51 </p><div class="variablelist"><dl><dt><span class="term"><span class="comman d"><strong>[Parameter]</strong></span></span></dt><dd><p>
46 <span class="command"><strong>value:</strong></span>Annotation cla ss objects. More than one class can be specified. 52 <span class="command"><strong>value:</strong></span>Annotation cla ss objects. More than one class can be specified.
47 </p><p> 53 </p><p>
48 <span class="command"><strong>priority:</strong></span>Default pri ority(HIGH, MEDIUM, LOW, IGNORE). Default value:MEDIUM. 54 <span class="command"><strong>priority:</strong></span>Default pri ority(HIGH, MEDIUM, LOW, IGNORE). Default value:MEDIUM.
49 </p></dd></dl></div><p> 55 </p></dd></dl></div><p>
50 This is same as the DefaultAnnotation except it only applys to method parameters . 56 This is same as the DefaultAnnotation except it only applys to method parameters .
51 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.NonNull</strong></span></span></dt><dd><span class="command" ><strong>[Target]</strong></span> Field, Method, Parameter 57 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.NonNull</strong></span></span></dt><dd><p>
52 <p> 58 <span class="command"><strong>[Target]</strong></span> Field, Method, Para meter
59 </p><p>
53 The annotated element must not be null. 60 The annotated element must not be null.
54 Annotated fields must not be null after construction has completed. Annotated me thods must have non-null return values. 61 Annotated fields must not be null after construction has completed. Annotated me thods must have non-null return values.
55 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.Nullable</strong></span></span></dt><dd><span class="command "><strong>[Target]</strong></span> Field, Method, Parameter 62 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.Nullable</strong></span></span></dt><dd><p>
56 <p> 63 <span class="command"><strong>[Target]</strong></span> Field, Method, Para meter
64 </p><p>
57 The annotated element could be null under some circumstances. In general, this m eans 65 The annotated element could be null under some circumstances. In general, this m eans
58 developers will have to read the documentation to determine when a null value is 66 developers will have to read the documentation to determine when a null value is
59 acceptable and whether it is neccessary to check for a null value. FindBugs wil l 67 acceptable and whether it is neccessary to check for a null value. FindBugs wil l
60 treat the annotated items as though they had no annotation. 68 treat the annotated items as though they had no annotation.
61 </p><p> 69 </p><p>
62 In pratice this annotation is useful only for overriding an overarching NonNull 70 In practice this annotation is useful only for overriding an overarching NonNull
63 annotation. 71 annotation.
64 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.OverrideMustInvoke</strong></span></span></dt><dd><span clas s="command"><strong>[Target]</strong></span> Method 72 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.OverrideMustInvoke</strong></span></span></dt><dd><p>
65 <div class="variablelist"><dl><dt><span class="term"><span class="command">< strong>[Parameter]</strong></span></span></dt><dd><p> 73 <span class="command"><strong>[Target]</strong></span> Method
74 </p><div class="variablelist"><dl><dt><span class="term"><span class="comman d"><strong>[Parameter]</strong></span></span></dt><dd><p>
66 <span class="command"><strong>value:</strong></span>Specify when t he super invocation should be 75 <span class="command"><strong>value:</strong></span>Specify when t he super invocation should be
67 performed (FIRST, ANYTIME, LAST). Default value:ANYTIME. 76 performed (FIRST, ANYTIME, LAST). Default value:ANYTIME.
68 </p></dd></dl></div><p> 77 </p></dd></dl></div><p>
69 Used to annotate a method that, if overridden, must (or should) be invoke super 78 Used to annotate a method that, if overridden, must (or should) be invoke super
70 in the overriding method. Examples of such methods include finalize() and clone( ). 79 in the overriding method. Examples of such methods include finalize() and clone( ).
71 The argument to the method indicates when the super invocation should occur: 80 The argument to the method indicates when the super invocation should occur:
72 at any time, at the beginning of the overriding method, or at the end of the ove rriding method. 81 at any time, at the beginning of the overriding method, or at the end of the ove rriding method.
73 (This anotation is not implmemented in FindBugs as of September 8, 2006). 82 (This anotation is not implmemented in FindBugs as of September 8, 2006).
74 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.PossiblyNull</strong></span></span></dt><dd><p> 83 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.PossiblyNull</strong></span></span></dt><dd><p>
75 This annotation is deprecated. Use CheckForNull instead. 84 This annotation is deprecated. Use CheckForNull instead.
76 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.SuppressWarnings</strong></span></span></dt><dd><span class= "command"><strong>[Target]</strong></span> Type, Field, Method, Parameter, Const ructor, Package 85 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.SuppressWarnings</strong></span></span></dt><dd><p>
77 <div class="variablelist"><dl><dt><span class="term"><span class="command">< strong>[Parameter]</strong></span></span></dt><dd><p> 86 <span class="command"><strong>[Target]</strong></span> Type, Field, Method , Parameter, Constructor, Package
87 </p><div class="variablelist"><dl><dt><span class="term"><span class="comman d"><strong>[Parameter]</strong></span></span></dt><dd><p>
78 <span class="command"><strong>value:</strong></span>The name of th e warning. More than one name can be specified. 88 <span class="command"><strong>value:</strong></span>The name of th e warning. More than one name can be specified.
79 </p><p> 89 </p><p>
80 <span class="command"><strong>justification:</strong></span>Reason why the warning should be ignored. Default value:"". 90 <span class="command"><strong>justification:</strong></span>Reason why the warning should be ignored. Default value:"".
81 </p></dd></dl></div><p> 91 </p></dd></dl></div><p>
82 The set of warnings that are to be suppressed by the compiler in the annotated e lement. 92 The set of warnings that are to be suppressed by the compiler in the annotated e lement.
83 Duplicate names are permitted. The second and successive occurrences of a name are ignored. 93 Duplicate names are permitted. The second and successive occurrences of a name are ignored.
84 The presence of unrecognized warning names is <span class="emphasis"><em>not</em ></span> an error: Compilers 94 The presence of unrecognized warning names is <span class="emphasis"><em>not</em ></span> an error: Compilers
85 must ignore any warning names they do not recognize. They are, however, free to emit a 95 must ignore any warning names they do not recognize. They are, however, free to emit a
86 warning if an annotation contains an unrecognized warning name. Compiler vendors should 96 warning if an annotation contains an unrecognized warning name. Compiler vendors should
87 document the warning names they support in conjunction with this annotation type . They 97 document the warning names they support in conjunction with this annotation type . They
88 are encouraged to cooperate to ensure that the same names work across multiple c ompilers. 98 are encouraged to cooperate to ensure that the same names work across multiple c ompilers.
89 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.UnknownNullness</strong></span></span></dt><dd><span class=" command"><strong>[Target]</strong></span> Field, Method, Parameter 99 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.UnknownNullness</strong></span></span></dt><dd><p>
90 <p> 100 <span class="command"><strong>[Target]</strong></span> Field, Method, Para meter
101 </p><p>
91 Used to indicate that the nullness of the target is unknown, or my vary in unkno wn ways in subclasses. 102 Used to indicate that the nullness of the target is unknown, or my vary in unkno wn ways in subclasses.
92 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.UnknownNullness</strong></span></span></dt><dd><span class=" command"><strong>[Target]</strong></span> Field, Method, Parameter 103 </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.f indbugs.annotations.UnknownNullness</strong></span></span></dt><dd><p>
93 <p> 104 <span class="command"><strong>[Target]</strong></span> Field, Method, Para meter
105 </p><p>
94 Used to indicate that the nullness of the target is unknown, or my vary in unkno wn ways in subclasses. 106 Used to indicate that the nullness of the target is unknown, or my vary in unkno wn ways in subclasses.
95 </p></dd></dl></div><p> 107 </p></dd></dl></div><p>
96 <span class="application">FindBugs</span> also supports the following annotatio ns: 108 <span class="application">FindBugs</span> also supports the following annotatio ns:
97 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="li stitem">net.jcip.annotations.GuardedBy</li><li class="listitem">net.jcip.annotat ions.Immutable</li><li class="listitem">net.jcip.annotations.NotThreadSafe</li>< li class="listitem">net.jcip.annotations.ThreadSafe</li></ul></div><p> 109 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="li stitem"><p>net.jcip.annotations.GuardedBy</p></li><li class="listitem"><p>net.jc ip.annotations.Immutable</p></li><li class="listitem"><p>net.jcip.annotations.No tThreadSafe</p></li><li class="listitem"><p>net.jcip.annotations.ThreadSafe</p>< /li></ul></div><p>
98 </p><p> 110 </p><p>
99 You can refer the JCIP annotation <a class="ulink" href="http://jcip.net/annotat ions/doc/index.html" target="_top"> 111 You can refer the JCIP annotation <a class="ulink" href="http://jcip.net/annotat ions/doc/index.html" target="_top">
100 API documentation</a> at <a class="ulink" href="http://jcip.net/" target="_top"> Java Concurrency in Practice</a>. 112 API documentation</a> at <a class="ulink" href="http://jcip.net/" target="_top"> Java Concurrency in Practice</a>.
101 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation foo ter"><tr><td width="40%" align="left"><a accesskey="p" href="analysisprops.html" >Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" al ign="right">&nbsp;<a accesskey="n" href="rejarForAnalysis.html">Next</a></td></t r><tr><td width="40%" align="left" valign="top">Chapter&nbsp;9.&nbsp;Analysis Pr operties&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.h tml">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp; 11.&nbsp;Using rejarForAnalysis</td></tr></table></div></body></html> 113 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation foo ter"><tr><td width="40%" align="left"><a accesskey="p" href="analysisprops.html" >Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" al ign="right">&nbsp;<a accesskey="n" href="rejarForAnalysis.html">Next</a></td></t r><tr><td width="40%" align="left" valign="top">Chapter&nbsp;9.&nbsp;Analysis Pr operties&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.h tml">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp; 11.&nbsp;Using rejarForAnalysis</td></tr></table></div></body></html>
OLDNEW
« no previous file with comments | « doc/manual/acknowledgments.html ('k') | doc/manual/anttask.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698