summaryrefslogtreecommitdiff
path: root/tools/findbugs/doc/ja/manual/annotations.html
blob: 9a44cc67521af4f696c3756e16af5c1f1d16fb67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>&#31532;10&#31456; &#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="FindBugs&#8482; &#12510;&#12491;&#12517;&#12450;&#12523;"><link rel="up" href="index.html" title="FindBugs&#8482; &#12510;&#12491;&#12517;&#12450;&#12523;"><link rel="prev" href="analysisprops.html" title="&#31532;9&#31456; &#20998;&#26512;&#12503;&#12525;&#12497;&#12486;&#12451;&#12540;"><link rel="next" href="rejarForAnalysis.html" title="&#31532;11&#31456; rejarForAnalysis &#12398;&#20351;&#29992;&#26041;&#27861;"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">&#31532;10&#31456; &#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="analysisprops.html">&#25147;&#12427;</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="rejarForAnalysis.html">&#27425;&#12408;</a></td></tr></table><hr></div><div class="chapter" title="&#31532;10&#31456; &#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;"><div class="titlepage"><div><div><h2 class="title"><a name="annotations"></a>&#31532;10&#31456; &#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;</h2></div></div></div><p><span class="application">FindBugs</span> &#12399;&#12356;&#12367;&#12388;&#12363;&#12398;&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12434;&#12469;&#12509;&#12540;&#12488;&#12375;&#12390;&#12356;&#12414;&#12377;&#12290;&#38283;&#30330;&#32773;&#12398;&#24847;&#22259;&#12434;&#26126;&#30906;&#12395;&#12377;&#12427;&#12371;&#12392;&#12391;&#12289; FindBugs &#12399;&#12424;&#12426;&#30340;&#30906;&#12395;&#35686;&#21578;&#12434;&#30330;&#34892;&#12377;&#12427;&#12371;&#12392;&#12364;&#12391;&#12365;&#12414;&#12377;&#12290;&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12434;&#20351;&#29992;&#12377;&#12427;&#12383;&#12417;&#12395;&#12399; Java 5 &#12364;&#24517;&#35201;&#12391;&#12354;&#12426;&#12289; annotations.jar &#12362;&#12424;&#12403; jsr305.jar &#12501;&#12449;&#12452;&#12523;&#12434;&#12467;&#12531;&#12497;&#12452;&#12523;&#26178;&#12398;&#12463;&#12521;&#12473;&#12497;&#12473;&#12395;&#21547;&#12417;&#12427;&#24517;&#35201;&#12364;&#12354;&#12426;&#12414;&#12377;&#12290;</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, Parameter
    <p>&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12434;&#12388;&#12369;&#12383;&#35201;&#32032;&#12399;&#12289; null &#12391;&#12354;&#12427;&#21487;&#33021;&#24615;&#12364;&#12354;&#12426;&#12414;&#12377;&#12290;&#12375;&#12383;&#12364;&#12387;&#12390;&#12289;&#24403;&#35442;&#35201;&#32032;&#12434;&#20351;&#29992;&#12377;&#12427;&#38555;&#12399; null &#12481;&#12455;&#12483;&#12463;&#12434;&#12377;&#12427;&#12409;&#12365;&#12391;&#12377;&#12290;&#12371;&#12398;&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12434;&#12513;&#12477;&#12483;&#12489;&#12395;&#36969;&#29992;&#12377;&#12427;&#12392;&#12289;&#12513;&#12477;&#12483;&#12489;&#12398;&#25147;&#12426;&#20516;&#12395;&#36969;&#29992;&#12373;&#12428;&#12414;&#12377;&#12290;</p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.CheckReturnValue</strong></span></span></dt><dd><span class="command"><strong>[Target]</strong></span> Method, Constructor
    <div class="variablelist"><dl><dt><span class="term"><span class="command"><strong>[Parameter]</strong></span></span></dt><dd><p>
              <span class="command"><strong>priority:</strong></span> &#35686;&#21578;&#12398;&#20778;&#20808;&#24230;&#12434;&#25351;&#23450;&#12375;&#12414;&#12377; (HIGH, MEDIUM, LOW, IGNORE) &#12290;&#12487;&#12501;&#12457;&#12523;&#12488;&#20516; :MEDIUM&#12290;</p><p>
              <span class="command"><strong>explanation:</strong></span>&#25147;&#12426;&#20516;&#12434;&#12481;&#12455;&#12483;&#12463;&#12375;&#12394;&#12369;&#12400;&#12394;&#12425;&#12394;&#12356;&#29702;&#30001;&#12434;&#12486;&#12461;&#12473;&#12488;&#12391;&#35500;&#26126;&#12375;&#12414;&#12377;&#12290;&#12487;&#12501;&#12457;&#12523;&#12488;&#20516; :""&#12290;</p></dd></dl></div><p>&#12371;&#12398;&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12434;&#20351;&#29992;&#12375;&#12390;&#12289;&#21628;&#20986;&#12375;&#24460;&#12395;&#25147;&#12426;&#20516;&#12434;&#12481;&#12455;&#12483;&#12463;&#12377;&#12409;&#12365;&#12513;&#12477;&#12483;&#12489;&#12434;&#34920;&#12377;&#12371;&#12392;&#12364;&#12391;&#12365;&#12414;&#12377;&#12290;</p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.DefaultAnnotation</strong></span></span></dt><dd><span class="command"><strong>[Target]</strong></span> Type, Package
    <div class="variablelist"><dl><dt><span class="term"><span class="command"><strong>[Parameter]</strong></span></span></dt><dd><p>
              <span class="command"><strong>value:</strong></span>&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12463;&#12521;&#12473;&#12398;class&#12458;&#12502;&#12472;&#12455;&#12463;&#12488;&#12290;&#35079;&#25968;&#12398;&#12463;&#12521;&#12473;&#12434;&#25351;&#23450;&#12377;&#12427;&#12371;&#12392;&#12364;&#12391;&#12365;&#12414;&#12377;&#12290;</p><p>
              <span class="command"><strong>priority:</strong></span>&#30465;&#30053;&#26178;&#12398;&#20778;&#20808;&#24230;&#12434;&#25351;&#23450;&#12375;&#12414;&#12377; (HIGH, MEDIUM, LOW, IGNORE) &#12290;&#12487;&#12501;&#12457;&#12523;&#12488;&#20516; :MEDIUM&#12290;</p></dd></dl></div><p>
Indicates that all members of the class or package should be annotated with the default
value of the supplied annotation classes. This would be used for behavior annotations
such as @NonNull, @CheckForNull, or @CheckReturnValue. In particular, you can use
@DefaultAnnotation(NonNull.class) on a class or package, and then use @Nullable only
on those parameters, methods or fields that you want to allow to be null.
      </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.DefaultAnnotationForFields</strong></span></span></dt><dd><span class="command"><strong>[Target]</strong></span> Type, Package
    <div class="variablelist"><dl><dt><span class="term"><span class="command"><strong>[Parameter]</strong></span></span></dt><dd><p>
              <span class="command"><strong>value:</strong></span>&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12463;&#12521;&#12473;&#12398;class&#12458;&#12502;&#12472;&#12455;&#12463;&#12488;&#12290;&#35079;&#25968;&#12398;&#12463;&#12521;&#12473;&#12434;&#25351;&#23450;&#12377;&#12427;&#12371;&#12392;&#12364;&#12391;&#12365;&#12414;&#12377;&#12290;</p><p>
              <span class="command"><strong>priority:</strong></span>&#30465;&#30053;&#26178;&#12398;&#20778;&#20808;&#24230;&#12434;&#25351;&#23450;&#12375;&#12414;&#12377; (HIGH, MEDIUM, LOW, IGNORE) &#12290;&#12487;&#12501;&#12457;&#12523;&#12488;&#20516; :MEDIUM&#12290;</p></dd></dl></div><p>
This is same as the DefaultAnnotation except it only applys to fields.
      </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.DefaultAnnotationForMethods</strong></span></span></dt><dd><span class="command"><strong>[Target]</strong></span> Type, Package
    <div class="variablelist"><dl><dt><span class="term"><span class="command"><strong>[Parameter]</strong></span></span></dt><dd><p>
              <span class="command"><strong>value:</strong></span>&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12463;&#12521;&#12473;&#12398;class&#12458;&#12502;&#12472;&#12455;&#12463;&#12488;&#12290;&#35079;&#25968;&#12398;&#12463;&#12521;&#12473;&#12434;&#25351;&#23450;&#12377;&#12427;&#12371;&#12392;&#12364;&#12391;&#12365;&#12414;&#12377;&#12290;</p><p>
              <span class="command"><strong>priority:</strong></span>&#30465;&#30053;&#26178;&#12398;&#20778;&#20808;&#24230;&#12434;&#25351;&#23450;&#12375;&#12414;&#12377; (HIGH, MEDIUM, LOW, IGNORE) &#12290;&#12487;&#12501;&#12457;&#12523;&#12488;&#20516; :MEDIUM&#12290;</p></dd></dl></div><p>
This is same as the DefaultAnnotation except it only applys to methods.
      </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.DefaultAnnotationForParameters</strong></span></span></dt><dd><span class="command"><strong>[Target]</strong></span> Type, Package
    <div class="variablelist"><dl><dt><span class="term"><span class="command"><strong>[Parameter]</strong></span></span></dt><dd><p>
              <span class="command"><strong>value:</strong></span>&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12463;&#12521;&#12473;&#12398;class&#12458;&#12502;&#12472;&#12455;&#12463;&#12488;&#12290;&#35079;&#25968;&#12398;&#12463;&#12521;&#12473;&#12434;&#25351;&#23450;&#12377;&#12427;&#12371;&#12392;&#12364;&#12391;&#12365;&#12414;&#12377;&#12290;</p><p>
              <span class="command"><strong>priority:</strong></span>&#30465;&#30053;&#26178;&#12398;&#20778;&#20808;&#24230;&#12434;&#25351;&#23450;&#12375;&#12414;&#12377; (HIGH, MEDIUM, LOW, IGNORE) &#12290;&#12487;&#12501;&#12457;&#12523;&#12488;&#20516; :MEDIUM&#12290;</p></dd></dl></div><p>
This is same as the DefaultAnnotation except it only applys to method parameters.
      </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.NonNull</strong></span></span></dt><dd><span class="command"><strong>[Target]</strong></span> Field, Method, Parameter
    <p>&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12434;&#12388;&#12369;&#12383;&#35201;&#32032;&#12399;&#12289; null &#12391;&#12354;&#12387;&#12390;&#12399;&#12356;&#12369;&#12414;&#12379;&#12435;&#12290;&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12434;&#12388;&#12369;&#12383;&#12501;&#12451;&#12540;&#12523;&#12489;&#12399;&#12289;&#27083;&#31689;&#23436;&#20102;&#24460; null &#12391;&#12354;&#12387;&#12390;&#12399;&#12356;&#12369;&#12414;&#12379;&#12435;&#12290;&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12434;&#12388;&#12369;&#12383;&#12513;&#12477;&#12483;&#12489;&#12399;&#12289; null &#12391;&#12399;&#12394;&#12356;&#20516;&#12434;&#25147;&#12426;&#20516;&#12392;&#12375;&#12394;&#12369;&#12428;&#12400;&#12394;&#12426;&#12414;&#12379;&#12435;&#12290;</p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.Nullable</strong></span></span></dt><dd><span class="command"><strong>[Target]</strong></span> Field, Method, Parameter
    <p>&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12434;&#12388;&#12369;&#12383;&#35201;&#32032;&#12399;&#12289; null &#12391;&#12354;&#12387;&#12390;&#12399;&#12356;&#12369;&#12414;&#12379;&#12435;&#12290;In general, this means developers will have to read the documentation to determine when a null value is acceptable and whether it is neccessary to check for a null value. FindBugs will treat the annotated items as though they had no annotation.</p><p>
In pratice this annotation is useful only for overriding an overarching NonNull
annotation.
      </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.OverrideMustInvoke</strong></span></span></dt><dd><span class="command"><strong>[Target]</strong></span> Method
    <div class="variablelist"><dl><dt><span class="term"><span class="command"><strong>[Parameter]</strong></span></span></dt><dd><p>
              <span class="command"><strong>value:</strong></span>Specify when the super invocation should be
              performed (FIRST, ANYTIME, LAST). Default value:ANYTIME.
            </p></dd></dl></div><p>
Used to annotate a method that, if overridden, must (or should) be invoke super
in the overriding method. Examples of such methods include finalize() and clone().
The argument to the method indicates when the super invocation should occur:
at any time, at the beginning of the overriding method, or at the end of the overriding method.
(This anotation is not implmemented in FindBugs as of September 8, 2006).
      </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.PossiblyNull</strong></span></span></dt><dd><p>
This annotation is deprecated. Use CheckForNull instead.
      </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.SuppressWarnings</strong></span></span></dt><dd><span class="command"><strong>[Target]</strong></span> Type, Field, Method, Parameter, Constructor, Package
    <div class="variablelist"><dl><dt><span class="term"><span class="command"><strong>[Parameter]</strong></span></span></dt><dd><p>
              <span class="command"><strong>value:</strong></span>The name of the warning. More than one name can be specified.
            </p><p>
              <span class="command"><strong>justification:</strong></span>Reason why the warning should be ignored. &#12487;&#12501;&#12457;&#12523;&#12488;&#20516; :""&#12290;</p></dd></dl></div><p>
The set of warnings that are to be suppressed by the compiler in the annotated element.
Duplicate names are permitted.  The second and successive occurrences of a name are ignored.
The presence of unrecognized warning names is <span class="emphasis"><em>not</em></span> an error: Compilers
must ignore any warning names they do not recognize. They are, however, free to emit a
warning if an annotation contains an unrecognized warning name. Compiler vendors should
document the warning names they support in conjunction with this annotation type. They
are encouraged to cooperate to ensure that the same names work across multiple compilers.
      </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.UnknownNullness</strong></span></span></dt><dd><span class="command"><strong>[Target]</strong></span> Field, Method, Parameter
    <p>
Used to indicate that the nullness of the target is unknown, or my vary in unknown ways in subclasses.
      </p></dd><dt><span class="term"><span class="command"><strong>edu.umd.cs.findbugs.annotations.UnknownNullness</strong></span></span></dt><dd><span class="command"><strong>[Target]</strong></span> Field, Method, Parameter
    <p>
Used to indicate that the nullness of the target is unknown, or my vary in unknown ways in subclasses.
      </p></dd></dl></div><p>&#12414;&#12383;&#12289; <span class="application">FindBugs</span> &#27425;&#12395;&#31034;&#12377;&#12450;&#12494;&#12486;&#12540;&#12471;&#12519;&#12531;&#12418;&#12469;&#12509;&#12540;&#12488;&#12375;&#12390;&#12356;&#12414;&#12377;&#12290; :</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">net.jcip.annotations.GuardedBy</li><li class="listitem">net.jcip.annotations.Immutable</li><li class="listitem">net.jcip.annotations.NotThreadSafe</li><li class="listitem">net.jcip.annotations.ThreadSafe</li></ul></div><p>
</p><p><a class="ulink" href="http://jcip.net/" target="_top">Java Concurrency in Practice</a> &#12398; <a class="ulink" href="http://jcip.net/annotations/doc/index.html" target="_top"> API &#12489;&#12461;&#12517;&#12513;&#12531;&#12488;</a> &#12434;&#21442;&#29031;&#12375;&#12390;&#12367;&#12384;&#12373;&#12356;&#12290;</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="analysisprops.html">&#25147;&#12427;</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="rejarForAnalysis.html">&#27425;&#12408;</a></td></tr><tr><td width="40%" align="left" valign="top">&#31532;9&#31456; &#20998;&#26512;&#12503;&#12525;&#12497;&#12486;&#12451;&#12540;&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">&#12507;&#12540;&#12512;</a></td><td width="40%" align="right" valign="top">&nbsp;&#31532;11&#31456; rejarForAnalysis &#12398;&#20351;&#29992;&#26041;&#27861;</td></tr></table></div></body></html>