• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.annotations;
18 
19 import static java.lang.annotation.ElementType.PACKAGE;
20 import static java.lang.annotation.ElementType.TYPE;
21 
22 import java.lang.annotation.Documented;
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 import java.lang.annotation.Target;
26 
27 /**
28  * Denotes that all parameters, fields or methods within a class or method by
29  * default can not be null. This can be overridden by adding specific
30  * {@link com.android.annotations.Nullable} annotations on fields, parameters or
31  * methods that should not use the default.
32  * <p/>
33  * NOTE: Eclipse does not yet handle defaults well (in particular, if
34  * you add this on a class which implements Comparable, then it will insist
35  * that your compare method is changing the nullness of the compare parameter,
36  * so you'll need to add @Nullable on it, which also is not right (since
37  * the method should have implied @NonNull and you do not need to check
38  * the parameter.). For now, it's best to individually annotate methods,
39  * parameters and fields.
40  * <p/>
41  * This is a marker annotation and it has no specific attributes.
42  */
43 @Documented
44 @Retention(RetentionPolicy.CLASS)
45 @Target({PACKAGE, TYPE})
46 public @interface NonNullByDefault {
47 }
48