Initial commit
[fonbot.git] / src / org / eclipse / jdt / annotation / NonNullByDefault.java
1 /*******************************************************************************
2 * Copyright (c) 2011 Stephan Herrmann and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Stephan Herrmann - initial API and implementation
10 * IBM Corporation - bug fixes
11 *******************************************************************************/
12 package org.eclipse.jdt.annotation;
13
14 import static java.lang.annotation.ElementType.CONSTRUCTOR;
15 import static java.lang.annotation.ElementType.METHOD;
16 import static java.lang.annotation.ElementType.PACKAGE;
17 import static java.lang.annotation.ElementType.TYPE;
18
19 import java.lang.annotation.Documented;
20 import java.lang.annotation.Retention;
21 import java.lang.annotation.RetentionPolicy;
22 import java.lang.annotation.Target;
23
24 /**
25 * This annotation can be applied to a package, type, method or constructor in order to
26 * define that all contained entities for which a null annotation is otherwise lacking
27 * should be considered as {@link NonNull @NonNull}.
28 * <dl>
29 * <dt>Canceling a default</dt>
30 * <dd>By using a <code>@NonNullByDefault</code> annotation with the argument <code>false</code>,
31 * a default from any enclosing scope can be canceled for the element being annotated.
32 * <dt>Nested defaults</dt>
33 * <dd>If a <code>@NonNullByDefault</code>
34 * annotation is used within the scope of another <code>@NonNullByDefault</code>
35 * annotation or a project-wide default setting, the innermost annotation defines the
36 * default applicable at any given position (depending on the parameter {@link #value()}).</dd>
37 * </dl>
38 * Note that for applying an annotation to a package, a file by the name
39 * <code>package-info.java</code> is used.
40 *
41 * @since 1.0
42 */
43 @Documented
44 @Retention(RetentionPolicy.CLASS)
45 @Target({ PACKAGE, TYPE, METHOD, CONSTRUCTOR })
46 public @interface NonNullByDefault {
47 /**
48 * When parameterized with <code>false</code>, the annotation specifies that the current element should not apply
49 * any default to un-annotated types.
50 */
51 boolean value() default true;
52 }
This page took 0.022529 seconds and 4 git commands to generate.