Skip to content

Commit 7f2fadb

Browse files
authored
Annotated javax.lang.model.util.Types for nullness. (typetools#179)
1 parent 27bb756 commit 7f2fadb

File tree

1 file changed

+7
-4
lines changed
  • src/java.compiler/share/classes/javax/lang/model/util

1 file changed

+7
-4
lines changed

src/java.compiler/share/classes/javax/lang/model/util/Types.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525

2626
package javax.lang.model.util;
2727

28+
import org.checkerframework.checker.nullness.qual.Nullable;
2829
import org.checkerframework.dataflow.qual.Pure;
30+
import org.checkerframework.framework.qual.AnnotatedFor;
2931
import java.lang.annotation.Annotation;
3032
import java.lang.annotation.AnnotationTypeMismatchException;
3133
import java.lang.annotation.IncompleteAnnotationException;
@@ -45,6 +47,7 @@
4547
* @see javax.annotation.processing.ProcessingEnvironment#getTypeUtils
4648
* @since 1.6
4749
*/
50+
@AnnotatedFor("nullness")
4851
public interface Types {
4952

5053
/**
@@ -56,7 +59,7 @@ public interface Types {
5659
* @param t the type to map to an element
5760
* @return the element corresponding to the given type
5861
*/
59-
Element asElement(TypeMirror t);
62+
@Nullable Element asElement(TypeMirror t);
6063

6164
/**
6265
* Tests whether two {@code TypeMirror} objects represent the same type.
@@ -235,8 +238,8 @@ public interface Types {
235238
* @param superBound the super (lower) bound, or {@code null} if none
236239
* @throws IllegalArgumentException if bounds are not valid
237240
*/
238-
WildcardType getWildcardType(TypeMirror extendsBound,
239-
TypeMirror superBound);
241+
WildcardType getWildcardType(@Nullable TypeMirror extendsBound,
242+
@Nullable TypeMirror superBound);
240243

241244
/**
242245
* {@return the type corresponding to a type element and
@@ -292,7 +295,7 @@ WildcardType getWildcardType(TypeMirror extendsBound,
292295
* type arguments are given, or if an inappropriate type
293296
* argument, type element, or containing type is provided
294297
*/
295-
DeclaredType getDeclaredType(DeclaredType containing,
298+
DeclaredType getDeclaredType(@Nullable DeclaredType containing,
296299
TypeElement typeElem, TypeMirror... typeArgs);
297300

298301
/**

0 commit comments

Comments
 (0)