Debian Codegraph @

debian/antlr4/org/antlr/v4/runtime/misc/Nullable.java

raw
1 /*
2 * [The "BSD license"]
3 * Copyright (c) 2012 Terence Parr
4 * Copyright (c) 2012 Sam Harwell
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 package org.antlr.v4.runtime.misc;
32
33 import java.lang.annotation.Documented;
34 import java.lang.annotation.ElementType;
35 import java.lang.annotation.Retention;
36 import java.lang.annotation.RetentionPolicy;
37 import java.lang.annotation.Target;
38
39 /**
40 * This annotation marks a field, parameter, local variable, or method (return
41 * value) as potentially having the value {@code null}. The specific semantics
42 * implied by this annotation depend on the kind of element the annotation is
43 * applied to.
44 *
45 * <ul>
46 * <li><strong>Field or Local Variable:</strong> Code reading the field or local
47 * variable may not assume that the value is never {@code null}.</li>
48 * <li><strong>Parameter:</strong> Code calling the method might pass
49 * {@code null} for this parameter. The documentation for the method should
50 * describe the behavior of the method in the event this parameter is
51 * {@code null}.
52 * </li>
53 * <li><strong>Method (Return Value):</strong> Code calling the method may not
54 * assume that the result of the method is never {@code null}. The documentation
55 * for the method should describe the meaning of a {@code null} reference being
56 * returned. Overriding methods may optionally use the {@link NotNull}
57 * annotation instead of this annotation for the method, indicating that the
58 * overriding method (and any method which overrides it) will never return a
59 * {@code null} reference.</li>
60 * </ul>
61 *
62 * <p>
63 * The {@link NullUsageProcessor} annotation processor validates certain usage
64 * scenarios for this annotation, with compile-time errors or warnings reported
65 * for misuse. For detailed information about the supported analysis, see the
66 * documentation for {@link NullUsageProcessor}.</p>
67 */
68 @Documented
69 @Retention(RetentionPolicy.CLASS)
70 @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
71 public @interface Nullable {
72 }