Add targets for org.pkl.core.util.Nullable (#235)

Also, change `java.time.@Nullable Duration` to `@Nullable java.time.Duration` to reduce the chance
of false positive errors in IDEs.
This commit is contained in:
translatenix
2024-02-23 07:07:08 -08:00
committed by GitHub
parent 7f404fff49
commit 32bc75bf50
4 changed files with 12 additions and 6 deletions

View File

@@ -48,7 +48,7 @@ public final class EvaluatorBuilder {
private final Map<String, String> externalProperties = new HashMap<>();
private java.time.@Nullable Duration timeout;
private @Nullable java.time.Duration timeout;
private @Nullable Path moduleCacheDir = IoUtils.getDefaultModuleCacheDir();
@@ -343,7 +343,7 @@ public final class EvaluatorBuilder {
/**
* Sets an evaluation timeout to be enforced by the {@link Evaluator}'s {@code evaluate} methods.
*/
public EvaluatorBuilder setTimeout(java.time.@Nullable Duration timeout) {
public EvaluatorBuilder setTimeout(@Nullable java.time.Duration timeout) {
this.timeout = timeout;
return this;
}

View File

@@ -2169,7 +2169,7 @@ public final class AstBuilder extends AbstractAstBuilder<Object> {
return builder;
}
private FrameDescriptor.@Nullable Builder createFrameDescriptorBuilder(ObjectBodyContext ctx) {
private @Nullable FrameDescriptor.Builder createFrameDescriptorBuilder(ObjectBodyContext ctx) {
if (ctx.ps.isEmpty()) return null;
checkCommaSeparatedElements(ctx, ctx.ps, ctx.errs);

View File

@@ -67,7 +67,7 @@ public final class Project {
public static Project loadFromPath(
Path path,
SecurityManager securityManager,
java.time.@Nullable Duration timeout,
@Nullable java.time.Duration timeout,
StackFrameTransformer stackFrameTransformer,
Map<String, String> envVars) {
try (var evaluator =
@@ -90,7 +90,7 @@ public final class Project {
/** Convenience method to load a project with the default stack frame transformer. */
public static Project loadFromPath(
Path path, SecurityManager securityManager, java.time.@Nullable Duration timeout) {
Path path, SecurityManager securityManager, @Nullable java.time.Duration timeout) {
return loadFromPath(
path, securityManager, timeout, StackFrameTransformers.defaultTransformer, System.getenv());
}

View File

@@ -20,7 +20,13 @@ import static javax.annotation.meta.When.MAYBE;
import java.lang.annotation.*;
import javax.annotation.meta.TypeQualifierNickname;
@Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE})
@Target({
ElementType.TYPE_PARAMETER,
ElementType.TYPE_USE,
ElementType.PARAMETER,
ElementType.FIELD,
ElementType.METHOD
})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@javax.annotation.Nonnull(when = MAYBE)