| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2011, 2013 Stephan Herrmann and others. |
| 3 | * |
| 4 | * This program and the accompanying materials |
| 5 | * are made available under the terms of the Eclipse Public License 2.0 |
| 6 | * which accompanies this distribution, and is available at |
| 7 | * https://www.eclipse.org/legal/epl-2.0/ |
| 8 | * |
| 9 | * SPDX-License-Identifier: EPL-2.0 |
| 10 | * |
| 11 | * Contributors: |
| 12 | * Stephan Herrmann - initial API and implementation |
| 13 | * IBM Corporation - bug fixes |
| 14 | *******************************************************************************/ |
| 15 | package org.eclipse.jdt.annotation; |
| 16 | |
| 17 | import static java.lang.annotation.ElementType.TYPE_USE; |
| 18 | |
| 19 | import java.lang.annotation.Documented; |
| 20 | import java.lang.annotation.ElementType; |
| 21 | import java.lang.annotation.Retention; |
| 22 | import java.lang.annotation.RetentionPolicy; |
| 23 | import java.lang.annotation.Target; |
| 24 | |
| 25 | /** |
| 26 | * Qualifier for a reference type in a {@link ElementType#TYPE_USE TYPE_USE} position: |
| 27 | * The type that has this annotation explicitly includes the value <code>null</code>. |
| 28 | * <p> |
| 29 | * If annotation based null analysis is enabled using this annotation has two consequences: |
| 30 | * </p> |
| 31 | * <ol> |
| 32 | * <li>Binding a <code>null</code> value to an entity (field, local variable, method parameter or method return value) |
| 33 | * of this type is legal.</li> |
| 34 | * <li>Dereferencing an expression of this type is unsafe, i.e., a <code>NullPointerException</code> can occur at runtime.</li> |
| 35 | * </ol> |
| 36 | * <p> |
| 37 | * <b>Note:</b> Since org.eclipse.jdt.annotation 2.0.0, the |
| 38 | * <code>@Target</code> is <code>{TYPE_USE}</code>. For the old API, see |
| 39 | * <a href="http://help.eclipse.org/kepler/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/annotation/Nullable.html"> |
| 40 | * <code>@Nullable</code> in 1.1.0</a>. |
| 41 | * </p> |
| 42 | * @since 1.0 |
| 43 | */ |
| 44 | @Documented |
| 45 | @Retention(RetentionPolicy.CLASS) |
| 46 | @Target({ TYPE_USE }) |
| 47 | public @interface Nullable { |
| 48 | // marker annotation with no members |
| 49 | } |