mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-22 00:19:11 +07:00
Fixes IDEA-303569 @TypeQualifierDefault + @Nonnull does not work well when it comes to varargs & enhanced for GitOrigin-RevId: dbfd9e1a6ea1ea275e62f6eccc5b1d1c9170bd27
35 lines
882 B
Java
35 lines
882 B
Java
import javax.annotation.*;
|
|
import javax.annotation.meta.*;
|
|
import java.lang.annotation.*;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import typeUse.Nullable;
|
|
|
|
import javax.annotation.Nonnull;
|
|
import javax.annotation.meta.TypeQualifierDefault;
|
|
import java.lang.annotation.*;
|
|
|
|
@ObjectUtil.NotNullByDefault
|
|
final class ObjectUtil {
|
|
@SafeVarargs
|
|
public static <T> T[] deepCheckNotNull(@Nullable T @Nullable... varargs) {
|
|
if (varargs == null) {
|
|
throw new NullPointerException();
|
|
}
|
|
|
|
for (T element : varargs) {
|
|
if (element == null) {
|
|
throw new NullPointerException();
|
|
}
|
|
}
|
|
return varargs;
|
|
}
|
|
|
|
@Documented
|
|
@TypeQualifierDefault({ ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE_USE })
|
|
@Retention(RetentionPolicy.CLASS)
|
|
@Target(ElementType.TYPE)
|
|
@Nonnull
|
|
public @interface NotNullByDefault {
|
|
}
|
|
} |