Skip to content

Commit

Permalink
Annotate javax.lang.model.util.Types. (#94)
Browse files Browse the repository at this point in the history
adapted from
typetools/jdk@7f2fadb

Co-authored-by: Suzanne Millstein <[email protected]>
  • Loading branch information
cpovirk and smillst authored Oct 7, 2024
1 parent 3e9473d commit 3e19ce2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/java.compiler/share/classes/javax/lang/model/util/Types.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

package javax.lang.model.util;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

import java.util.List;
import javax.lang.model.element.*;
import javax.lang.model.type.*;
Expand Down Expand Up @@ -53,6 +56,7 @@
* @see javax.annotation.processing.ProcessingEnvironment#getTypeUtils
* @since 1.6
*/
@NullMarked
public interface Types {

/**
Expand All @@ -79,7 +83,7 @@ public interface Types {
* @param t the type to map to an element
* @return the element corresponding to the given type
*/
Element asElement(TypeMirror t);
@Nullable Element asElement(TypeMirror t);

/**
* Tests whether two {@code TypeMirror} objects represent the same type.
Expand Down Expand Up @@ -271,8 +275,8 @@ public interface Types {
* @throws IllegalArgumentException if bounds are not valid
* @jls 4.5.1 Type Arguments of Parameterized Types
*/
WildcardType getWildcardType(TypeMirror extendsBound,
TypeMirror superBound);
WildcardType getWildcardType(@Nullable TypeMirror extendsBound,
@Nullable TypeMirror superBound);

/**
* {@return the type corresponding to a type element and
Expand Down Expand Up @@ -332,7 +336,7 @@ WildcardType getWildcardType(TypeMirror extendsBound,
* type arguments are given, or if an inappropriate type
* argument, type element, or containing type is provided
*/
DeclaredType getDeclaredType(DeclaredType containing,
DeclaredType getDeclaredType(@Nullable DeclaredType containing,
TypeElement typeElem, TypeMirror... typeArgs);

/**
Expand Down

0 comments on commit 3e19ce2

Please sign in to comment.