pkl-core: Migrate nullness to JSpecify (#1601)

Replace pkl-core's local nullness annotations with JSpecify annotations.
Enable NullAway checking for pkl-core packages except org.pkl.core.ast
and org.pkl.core.stdlib.

Notable code changes:
- Add a dedicated late-init constructor to VmTyped
- Move VmExceptionBuilder's fallback message derivation from withCause()
to build()
- Split VmException rendering between builder-provided messages and
string-backed messages
- Initialize MessageTransport handlers with default throwing handlers
- Update JSON helper collection types to allow nullable values JSON
arrays and objects can contain JSON null,
so the Java Map/List element types need to model nullable elements
explicitly
- Make public command transform APIs accept nullable transformed values 
   Command transforms can produce null for optional/default handling,
so the BiFunction and options-map element types now model that
explicitly
- Make ExecutorSpiException accept nullable message and cause 
Existing call sites can pass nullable causes from Throwable.getCause()
- Remove JSR-305 semantics from `@LateInit`
   JSpecify does not support the same type-qualifier-nickname pattern,
so `@LateInit` is now documentation plus a NullAway
constructor-initialization exemption

Out of scope:
- NullAway checking of org.pkl.core.ast and org.pkl.core.stdlib
- IntelliJ warnings related to `@LateInit` fields
- Removing the JSR-305 dependency, since concurrency annotations are
still in use
This commit is contained in:
odenix
2026-05-21 22:57:20 +02:00
committed by GitHub
parent 63ef60f3c4
commit 3dc93cbd4a
261 changed files with 709 additions and 723 deletions
+16
View File
@@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import net.ltgt.gradle.errorprone.errorprone
import net.ltgt.gradle.nullaway.nullaway
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
@@ -21,6 +23,7 @@ plugins {
id("pklJavaLibrary")
id("pklPublishLibrary")
id("pklNativeLifecycle")
id("pklJSpecify")
idea
}
@@ -57,6 +60,7 @@ dependencies {
add("generatorImplementation", libs.javaPoet)
add("generatorImplementation", libs.truffleApi)
add("generatorImplementation", libs.jspecify)
javaExecutableConfiguration(project(":pkl-cli", "javaExecutable"))
}
@@ -107,6 +111,18 @@ tasks.processResources {
tasks.compileJava { options.generatedSourceOutputDirectory.set(file("generated/truffle")) }
tasks.withType<JavaCompile>().configureEach {
options.errorprone.nullaway {
// Do not require LateInit fields to be initialized at construction time.
// Unfortunately, IntelliJ doesn't currently understand this,
// and therefore emits many warnings related to LateInit.
excludedFieldAnnotations.add("org.pkl.core.util.LateInit")
// For now, don't analyze code that deals with Truffle ASTs.
unannotatedSubPackages.addAll("org.pkl.core.ast", "org.pkl.core.stdlib")
}
}
tasks.compileKotlin { enabled = false }
tasks.test {
@@ -39,6 +39,7 @@ import javax.lang.model.element.Modifier;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
import org.jspecify.annotations.Nullable;
/**
* Generates a subclass of {@code org.pkl.core.stdlib.registry.ExternalMemberRegistry} for each
@@ -114,6 +115,7 @@ public final class MemberRegistryGenerator extends AbstractProcessor {
Comparator.comparing(
(TypeElement element) -> {
var enclosingElement = element.getEnclosingElement();
assert enclosingElement != null;
return enclosingElement.getKind() == ElementKind.PACKAGE
? ""
: enclosingElement.getSimpleName().toString();
@@ -155,6 +157,7 @@ public final class MemberRegistryGenerator extends AbstractProcessor {
for (var nodeClass : nodeClasses) {
var enclosingClass = nodeClass.getEnclosingElement();
assert enclosingClass != null;
var pklClassName = getAnnotatedPklName(enclosingClass);
if (pklClassName == null) {
@@ -226,7 +229,7 @@ public final class MemberRegistryGenerator extends AbstractProcessor {
writeJavaFile(REGISTRY_PACKAGE_NAME, registryFactoryClass.build());
}
private String getAnnotatedPklName(Element element) {
private @Nullable String getAnnotatedPklName(Element element) {
for (var annotation : element.getAnnotationMirrors()) {
var annotationName = annotation.getAnnotationType().asElement().getSimpleName().toString();
@@ -0,0 +1,4 @@
@NullMarked
package org.pkl.core.generator;
import org.jspecify.annotations.NullMarked;
@@ -22,6 +22,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.graalvm.polyglot.Context;
import org.jspecify.annotations.Nullable;
import org.pkl.core.evaluatorSettings.TraceMode;
import org.pkl.core.http.HttpClient;
import org.pkl.core.http.HttpClientInitException;
@@ -36,7 +37,6 @@ import org.pkl.core.runtime.VmContext;
import org.pkl.core.runtime.VmException;
import org.pkl.core.runtime.VmImportAnalyzer;
import org.pkl.core.runtime.VmUtils;
import org.pkl.core.util.Nullable;
/** Utility library for static analysis of Pkl programs. */
public class Analyzer {
@@ -21,7 +21,7 @@ import java.util.Map;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.Function;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/**
* A specification parsed from a valid {@code pkl:Command} submodule.
@@ -144,7 +144,7 @@ public record CommandSpec(
@Nullable String helpText,
boolean showAsRequired,
BiFunction<String, URI, Object> transformEach,
BiFunction<List<Object>, URI, Object> transformAll,
BiFunction<List<Object>, URI, @Nullable Object> transformAll,
@Nullable CompletionCandidates completionCandidates,
@Nullable String shortName,
String metavar,
@@ -227,7 +227,7 @@ public record CommandSpec(
String name,
@Nullable String helpText,
BiFunction<String, URI, Object> transformEach,
BiFunction<List<Object>, URI, Object> transformAll,
BiFunction<List<Object>, URI, @Nullable Object> transformAll,
@Nullable CompletionCandidates completionCandidates,
boolean repeated)
implements Option {
@@ -239,7 +239,7 @@ public record CommandSpec(
/** A function used to transform command {@link State} as arguments are parsed. */
public interface ApplyFunction {
State apply(Map<String, Object> options, @Nullable State parent);
State apply(Map<String, @Nullable Object> options, @Nullable State parent);
}
/**
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package org.pkl.core;
import java.util.Map;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/** A container of properties. */
public interface Composite extends Value {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,8 +19,8 @@ import static org.pkl.core.DataSizeUnit.*;
import java.io.Serial;
import java.util.Objects;
import org.jspecify.annotations.Nullable;
import org.pkl.core.util.MathUtils;
import org.pkl.core.util.Nullable;
/** Java representation of a {@code pkl.base#DataSize} value. */
public final class DataSize implements Value {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
*/
package org.pkl.core;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/**
* The unit of a {@link DataSize}. In Pkl, data size units are represented as String {@link
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,8 +19,8 @@ import static org.pkl.core.DurationUnit.*;
import java.io.Serial;
import java.util.Objects;
import org.jspecify.annotations.Nullable;
import org.pkl.core.util.DurationUtils;
import org.pkl.core.util.Nullable;
/** Java representation of a {@code pkl.base#Duration} value. */
public final class Duration implements Value {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@ package org.pkl.core;
import java.time.temporal.ChronoUnit;
import java.util.concurrent.TimeUnit;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/**
* The unit of a {@link Duration}. In Pkl, duration units are represented as String {@link
@@ -19,6 +19,7 @@ import com.oracle.truffle.api.TruffleOptions;
import java.nio.file.Path;
import java.util.*;
import java.util.regex.Pattern;
import org.jspecify.annotations.Nullable;
import org.pkl.core.SecurityManagers.StandardBuilder;
import org.pkl.core.evaluatorSettings.PklEvaluatorSettings.ExternalReader;
import org.pkl.core.evaluatorSettings.TraceMode;
@@ -33,7 +34,6 @@ import org.pkl.core.resource.ResourceReader;
import org.pkl.core.resource.ResourceReaders;
import org.pkl.core.runtime.LoggerImpl;
import org.pkl.core.util.IoUtils;
import org.pkl.core.util.Nullable;
/** A builder for an {@link Evaluator}. Can be reused to build multiple evaluators. */
@SuppressWarnings({"UnusedReturnValue", "unused"})
@@ -56,7 +56,7 @@ public final class EvaluatorBuilder {
private final Map<String, String> externalProperties = new HashMap<>();
private @Nullable java.time.Duration timeout;
private java.time.@Nullable Duration timeout;
private @Nullable Path moduleCacheDir = IoUtils.getDefaultModuleCacheDir();
@@ -386,7 +386,7 @@ public final class EvaluatorBuilder {
/**
* Sets an evaluation timeout to be enforced by the {@link Evaluator}'s {@code evaluate} methods.
*/
public EvaluatorBuilder setTimeout(@Nullable java.time.Duration timeout) {
public EvaluatorBuilder setTimeout(java.time.@Nullable Duration timeout) {
this.timeout = timeout;
return this;
}
@@ -30,6 +30,7 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import org.graalvm.polyglot.Context;
import org.jspecify.annotations.Nullable;
import org.msgpack.core.MessageBufferPacker;
import org.msgpack.core.MessagePack;
import org.pkl.core.ast.ConstantValueNode;
@@ -61,7 +62,6 @@ import org.pkl.core.runtime.VmValue;
import org.pkl.core.runtime.VmValueRenderer;
import org.pkl.core.util.ErrorMessages;
import org.pkl.core.util.IoUtils;
import org.pkl.core.util.Nullable;
public final class EvaluatorImpl implements Evaluator {
private final StackFrameTransformer frameTransformer;
@@ -307,7 +307,7 @@ public final class EvaluatorImpl implements Evaluator {
reservedFlagShortNames,
(fileOutput) -> new FileOutputImpl(this, fileOutput));
run.accept(commandRunner.parse(module));
return null;
return true; // return value is not used; returning null would violate nullness
});
}
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ import java.io.Serializable;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/** Common base class for TypeAlias, PClass, PClass.Property, and PClass.Method. */
public abstract class Member implements Serializable {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +17,8 @@ package org.pkl.core;
import java.net.URI;
import java.util.*;
import org.jspecify.annotations.Nullable;
import org.pkl.core.util.LateInit;
import org.pkl.core.util.Nullable;
/** Describes the property, method and class members of a module. */
public final class ModuleSchema {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@ package org.pkl.core;
import java.io.File;
import java.net.URI;
import java.nio.file.Path;
import org.jspecify.annotations.Nullable;
import org.pkl.core.runtime.VmUtils;
import org.pkl.core.util.Nullable;
/**
* A representation for a Pkl module's source URI, and optionally its source text.
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@ package org.pkl.core;
import java.io.Serial;
import java.util.*;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/** Java representation of a {@code pkl.base#Class} value. */
public final class PClass extends Member implements Value {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ import java.io.Serializable;
import java.net.URI;
import java.util.*;
import java.util.regex.Pattern;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/** Information about a Pkl class and its Java representation. */
@SuppressWarnings("rawtypes")
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ import java.io.Serial;
import java.net.URI;
import java.util.Map;
import java.util.Objects;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/** Java representation of a Pkl module. */
public final class PModule extends PObject {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@ package org.pkl.core;
import java.io.Serial;
import java.util.Map;
import java.util.Objects;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/** Java representation of a Pkl object. */
public class PObject implements Composite {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +18,12 @@ package org.pkl.core;
import java.io.Serial;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.pkl.core.util.Nullable;
import java.util.Objects;
import org.jspecify.annotations.Nullable;
/** Java representation of a {@code pkl.base#Pair} value. */
public final class Pair<F, S> implements Value, Iterable<Object> {
public final class Pair<F extends @Nullable Object, S extends @Nullable Object>
implements Value, Iterable<@Nullable Object> {
@Serial private static final long serialVersionUID = 0L;
private final F first;
@@ -44,7 +46,7 @@ public final class Pair<F, S> implements Value, Iterable<Object> {
}
@Override
public Iterator<Object> iterator() {
public Iterator<@Nullable Object> iterator() {
return new Iterator<>() {
int pos = 0;
@@ -54,7 +56,7 @@ public final class Pair<F, S> implements Value, Iterable<Object> {
}
@Override
public Object next() {
public @Nullable Object next() {
return switch (pos++) {
case 0 -> first;
case 1 -> second;
@@ -83,12 +85,12 @@ public final class Pair<F, S> implements Value, Iterable<Object> {
public boolean equals(@Nullable Object obj) {
if (this == obj) return true;
if (!(obj instanceof Pair<?, ?> other)) return false;
return first.equals(other.first) && second.equals(other.second);
return Objects.equals(first, other.first) && Objects.equals(second, other.second);
}
@Override
public int hashCode() {
return first.hashCode() * 31 + second.hashCode();
return Objects.hashCode(first) * 31 + Objects.hashCode(second);
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,16 +15,18 @@
*/
package org.pkl.core;
import org.jspecify.annotations.Nullable;
public class PklException extends RuntimeException {
public PklException(String message, Throwable cause) {
public PklException(@Nullable String message, @Nullable Throwable cause) {
super(message, cause);
}
public PklException(String message) {
public PklException(@Nullable String message) {
super(message);
}
public PklException(Throwable cause) {
public PklException(@Nullable Throwable cause) {
super(cause);
}
}
@@ -21,7 +21,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
import org.pkl.core.util.properties.PropertiesUtils;
// To instantiate this class, use ValueRenderers.properties().
@@ -18,7 +18,7 @@ package org.pkl.core;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Path;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/**
* Enforces a security model during {@link Evaluator evaluation}.
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ import java.nio.file.Path;
import java.util.Collection;
import java.util.List;
import java.util.regex.Pattern;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/**
* Parent interface to builder classes for configuring a {@link SecurityManager}.
@@ -45,8 +45,7 @@ public interface SecurityManagerBuilder<B extends SecurityManagerBuilder<B>> {
B setRootDir(@Nullable Path rootDir);
@Nullable
Path getRootDir();
@Nullable Path getRootDir();
SecurityManager build();
}
@@ -23,9 +23,9 @@ import java.nio.file.Path;
import java.util.*;
import java.util.function.Function;
import java.util.regex.Pattern;
import org.jspecify.annotations.Nullable;
import org.pkl.core.util.ErrorMessages;
import org.pkl.core.util.IoUtils;
import org.pkl.core.util.Nullable;
/** A provider for {@link SecurityManager}s. */
public final class SecurityManagers {
@@ -273,7 +273,7 @@ public final class SecurityManagers {
private final List<Pattern> allowedResources = new ArrayList<>();
private Path rootDir;
private @Nullable Path rootDir;
private StandardBuilder() {}
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@ package org.pkl.core;
import java.util.List;
import java.util.Objects;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/** An element of a Pkl stack trace. */
// better name would be `StackTraceElement`
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@ package org.pkl.core;
import java.util.ArrayList;
import java.util.List;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/**
* The results of testing a Pkl test module.
@@ -301,7 +301,7 @@ public record TestResults(
* @param message The message of the underlying exception.
* @param exception The exception thrown by Pkl
*/
public record Error(String message, PklException exception) {}
public record Error(@Nullable String message, PklException exception) {}
/**
* Indicates that an assertion failed.
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@ package org.pkl.core;
import java.io.Serial;
import java.util.List;
import java.util.Set;
import org.jspecify.annotations.Nullable;
import org.pkl.core.util.LateInit;
import org.pkl.core.util.Nullable;
/** Java representation of a {@code pkl.base#TypeAlias} value. */
public final class TypeAlias extends Member implements Value {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
/** Visitor for data models generated by [Evaluator]. */
public interface ValueVisitor {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +17,8 @@ package org.pkl.core;
import java.util.*;
import java.util.regex.*;
import org.jspecify.annotations.Nullable;
import org.pkl.core.util.LateInit;
import org.pkl.core.util.Nullable;
/**
* A <a href="https://semver.org/spec/v2.0.0.html">semantic version</a>.
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ import java.io.UncheckedIOException;
import java.io.Writer;
import java.util.*;
import java.util.regex.Pattern;
import org.pkl.core.util.Nullable;
import org.jspecify.annotations.Nullable;
import org.pkl.core.util.yaml.snake.YamlUtils;
import org.snakeyaml.engine.v2.api.ConstructNode;
import org.snakeyaml.engine.v2.api.DumpSettings;
@@ -18,10 +18,10 @@ package org.pkl.core.ast;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.member.DefaultPropertyBodyNode;
import org.pkl.core.runtime.VmExceptionBuilder;
import org.pkl.core.runtime.VmLanguage;
import org.pkl.core.util.Nullable;
public abstract class MemberNode extends PklRootNode {
@Child protected ExpressionNode bodyNode;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,9 +22,9 @@ import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.NodeInfo;
import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.type.VmTypeMismatchException;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
@NodeInfo(language = "Pkl")
@TypeSystemReference(VmTypes.class)
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@ package org.pkl.core.ast.builder;
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.source.SourceSection;
import java.util.List;
import org.jspecify.annotations.Nullable;
import org.pkl.core.runtime.VmExceptionBuilder;
import org.pkl.core.util.Nullable;
import org.pkl.parser.BaseParserVisitor;
import org.pkl.parser.Span;
import org.pkl.parser.syntax.DocComment;
@@ -33,6 +33,7 @@ import java.util.function.BiFunction;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.graalvm.collections.EconomicMap;
import org.jspecify.annotations.Nullable;
import org.pkl.core.PClassInfo;
import org.pkl.core.PklBugException;
import org.pkl.core.SecurityManagerException;
@@ -183,7 +184,6 @@ import org.pkl.core.stdlib.registry.MemberRegistryFactory;
import org.pkl.core.util.CollectionUtils;
import org.pkl.core.util.EconomicMaps;
import org.pkl.core.util.IoUtils;
import org.pkl.core.util.Nullable;
import org.pkl.core.util.Pair;
import org.pkl.parser.Span;
import org.pkl.parser.syntax.Annotation;
@@ -2694,7 +2694,7 @@ public class AstBuilder extends AbstractAstBuilder<Object> {
return builder;
}
private @Nullable FrameDescriptor.Builder createFrameDescriptorBuilder(ObjectBody body) {
private FrameDescriptor.@Nullable Builder createFrameDescriptorBuilder(ObjectBody body) {
if (body.getParameters().isEmpty()) return null;
var builder = FrameDescriptor.newBuilder(body.getParameters().size());
@@ -2746,7 +2746,7 @@ public class AstBuilder extends AbstractAstBuilder<Object> {
.withMemberName(symbolTable.getCurrentScope().getQualifiedName());
}
private @Nullable SymbolTable.Scope getParentLexicalScope() {
private SymbolTable.@Nullable Scope getParentLexicalScope() {
var parent = symbolTable.getCurrentScope().getLexicalScope().getParent();
if (parent != null) return parent.getLexicalScope();
return null;
@@ -21,13 +21,13 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.builder.ImportsAndReadsParser.Entry;
import org.pkl.core.module.ModuleKey;
import org.pkl.core.module.ResolvedModuleKey;
import org.pkl.core.runtime.VmExceptionBuilder;
import org.pkl.core.runtime.VmUtils;
import org.pkl.core.util.IoUtils;
import org.pkl.core.util.Nullable;
import org.pkl.parser.Parser;
import org.pkl.parser.ParserError;
import org.pkl.parser.syntax.Expr;
@@ -19,6 +19,7 @@ import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.FrameDescriptor.Builder;
import java.util.*;
import java.util.function.Function;
import org.jspecify.annotations.Nullable;
import org.pkl.core.TypeParameter;
import org.pkl.core.ast.ConstantNode;
import org.pkl.core.ast.ExpressionNode;
@@ -28,7 +29,6 @@ import org.pkl.core.runtime.Identifier;
import org.pkl.core.runtime.ModuleInfo;
import org.pkl.core.runtime.VmDataSize;
import org.pkl.core.runtime.VmDuration;
import org.pkl.core.util.Nullable;
import org.pkl.parser.Lexer;
public final class SymbolTable {
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.builder;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +21,9 @@ import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.NodeInfo;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
@NodeInfo(shortName = "==")
@NodeChild(value = "leftNode", type = ExpressionNode.class)
@@ -21,9 +21,9 @@ import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.NodeInfo;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.runtime.VmValue;
import org.pkl.core.util.Nullable;
@NodeInfo(shortName = "!=")
@NodeChild(value = "leftNode", type = ExpressionNode.class)
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.expression.binary;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,11 +23,11 @@ import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.type.TypeNode;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
public abstract class GeneratorForNode extends GeneratorMemberNode {
private final FrameDescriptor generatorDescriptor;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,12 +26,12 @@ import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.expression.literal.AmendFunctionNode;
import org.pkl.core.ast.expression.literal.ObjectLiteralNode;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
/** An object literal node that contains at least one for- or when-expression. */
@ImportStatic(BaseModule.class)
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.expression.generator;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import com.oracle.truffle.api.frame.*;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.nodes.IndirectCallNode;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.PklNode;
import org.pkl.core.ast.PklRootNode;
@@ -31,7 +32,6 @@ import org.pkl.core.ast.member.FunctionNode;
import org.pkl.core.ast.member.Lambda;
import org.pkl.core.ast.type.TypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
public final class AmendFunctionNode extends PklNode {
private final boolean isCustomThisScope;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +17,11 @@ package org.pkl.core.ast.expression.literal;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.type.TypeNode;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
public final class CheckIsAnnotationClassNode extends ExpressionNode {
@Child private UnresolvedTypeNode unresolvedTypeNode;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,11 +22,11 @@ import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.graalvm.collections.UnmodifiableEconomicMap;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.member.ObjectMember;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
/**
* Object literal that contains entries (and possibly properties) but not elements. Additionally,
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,12 +25,12 @@ import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.source.SourceSection;
import org.graalvm.collections.UnmodifiableEconomicMap;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.member.ObjectMember;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.EconomicMaps;
import org.pkl.core.util.Nullable;
/**
* Object literal that contains both elements and entries (and possibly properties). Example: `new
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,12 +21,12 @@ import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.graalvm.collections.UnmodifiableEconomicMap;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.member.ObjectMember;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.EconomicMaps;
import org.pkl.core.util.Nullable;
/**
* Object literal that contains elements (and possibly properties) but not entries. Example: `new
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,13 +24,13 @@ import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.source.SourceSection;
import org.graalvm.collections.EconomicMap;
import org.graalvm.collections.UnmodifiableEconomicMap;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.member.ObjectMember;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.runtime.VmException.ProgramValue;
import org.pkl.core.util.EconomicMaps;
import org.pkl.core.util.Nullable;
/**
* Object literal that contains entries (and possibly properties) but not elements. Additionally, at
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,12 +19,12 @@ import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.member.FunctionNode;
import org.pkl.core.ast.member.UnresolvedFunctionNode;
import org.pkl.core.runtime.VmFunction;
import org.pkl.core.runtime.VmUtils;
import org.pkl.core.util.Nullable;
public final class FunctionLiteralNode extends ExpressionNode {
private @Child UnresolvedFunctionNode unresolvedFunctionNode;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.type.TypeNode;
import org.pkl.core.ast.type.UnresolvedTypeNode;
@@ -28,7 +29,6 @@ import org.pkl.core.runtime.VmClass;
import org.pkl.core.runtime.VmFunction;
import org.pkl.core.runtime.VmLanguage;
import org.pkl.core.runtime.VmUtils;
import org.pkl.core.util.Nullable;
// IDEA: don't materialize frames when all members are constants
@NodeChild(value = "parentNode", type = ExpressionNode.class)
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,11 +23,11 @@ import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.source.SourceSection;
import org.graalvm.collections.UnmodifiableEconomicMap;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.member.ObjectMember;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
/** Object literal that contains properties but not elements or entries. */
// IDEA: don't materialize frame when all members are constants
@@ -26,13 +26,13 @@ import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.source.SourceSection;
import org.graalvm.collections.EconomicMap;
import org.graalvm.collections.UnmodifiableEconomicMap;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.member.ObjectMember;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.runtime.VmException.ProgramValue;
import org.pkl.core.util.EconomicMaps;
import org.pkl.core.util.Nullable;
/**
* Base class for object literal nodes specialized for a certain mix of property/entry/element
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.expression.literal;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,11 +23,11 @@ import com.oracle.truffle.api.nodes.DirectCallNode;
import com.oracle.truffle.api.nodes.IndirectCallNode;
import com.oracle.truffle.api.nodes.NodeInfo;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.MemberLookupMode;
import org.pkl.core.ast.member.ClassProperty;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
@NodeInfo(shortName = ".")
@ImportStatic(BaseModule.class)
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.expression.member;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.expression;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.expression.primary;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.expression.ternary;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,13 +22,13 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import org.jspecify.annotations.Nullable;
import org.pkl.core.SecurityManagerException;
import org.pkl.core.externalreader.ExternalReaderProcessException;
import org.pkl.core.module.ModuleKey;
import org.pkl.core.packages.PackageLoadError;
import org.pkl.core.runtime.VmContext;
import org.pkl.core.util.IoUtils;
import org.pkl.core.util.Nullable;
public abstract class AbstractReadNode extends UnaryExpressionNode {
protected final ModuleKey currentModule;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,9 @@ public class ReadGlobMemberBodyNode extends ExpressionNode {
private Object readResource(VmObjectLike mapping, String path) {
@SuppressWarnings("unchecked")
var globElements = (Map<String, ResolvedGlobElement>) mapping.getExtraStorage();
var resourceUri = VmUtils.getMapValue(globElements, path).uri();
var globElement = VmUtils.getMapValue(globElements, path);
assert globElement != null;
var resourceUri = globElement.uri();
var resource = VmContext.get(this).getResourceManager().read(resourceUri, this).orElse(null);
if (resource == null) {
CompilerDirectives.transferToInterpreter();
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.expression.unary;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.frame;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -18,8 +18,8 @@ package org.pkl.core.ast.internal;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.util.Nullable;
/** Ensures that `childNode` isn't optimized away. */
@NodeChild(value = "childNode", type = ExpressionNode.class)
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.internal;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.lambda;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -18,10 +18,10 @@ package org.pkl.core.ast.member;
import com.oracle.truffle.api.source.SourceSection;
import java.util.ArrayList;
import java.util.List;
import org.jspecify.annotations.Nullable;
import org.pkl.core.runtime.Identifier;
import org.pkl.core.runtime.VmClass;
import org.pkl.core.runtime.VmTyped;
import org.pkl.core.util.Nullable;
public abstract class ClassMember extends Member {
protected final SourceSection @Nullable [] docComment;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,12 @@ import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.source.SourceSection;
import java.util.List;
import org.jspecify.annotations.Nullable;
import org.pkl.core.PClass;
import org.pkl.core.TypeParameter;
import org.pkl.core.ast.VmModifier;
import org.pkl.core.ast.type.TypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
public final class ClassMethod extends ClassMember {
private final List<TypeParameter> typeParameters;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import com.oracle.truffle.api.source.SourceSection;
import java.util.ArrayList;
import java.util.List;
import org.graalvm.collections.EconomicMap;
import org.jspecify.annotations.Nullable;
import org.pkl.core.PClassInfo;
import org.pkl.core.TypeParameter;
import org.pkl.core.ast.ExpressionNode;
@@ -30,7 +31,6 @@ import org.pkl.core.ast.type.TypeNode;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.LateInit;
import org.pkl.core.util.Nullable;
@NodeInfo(shortName = "class")
public final class ClassNode extends ExpressionNode {
@@ -102,12 +102,8 @@ public final class ClassNode extends ExpressionNode {
prototype.setExtraStorage(moduleInfo);
prototype.addProperties(prototypeMembers);
} else {
prototype =
new VmTyped(
frame.materialize(),
null, // initialized later by VmClass
null, // initialized later by VmClass
prototypeMembers);
// parent and clazz will be initialized later by VmClass
prototype = new VmTyped(frame.materialize(), null, prototypeMembers);
}
var annotations = new ArrayList<VmTyped>(annotationNodes.length);
@@ -17,11 +17,11 @@ package org.pkl.core.ast.member;
import com.oracle.truffle.api.source.SourceSection;
import java.util.List;
import org.jspecify.annotations.Nullable;
import org.pkl.core.Member.SourceLocation;
import org.pkl.core.PClass;
import org.pkl.core.ast.VmModifier;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
public final class ClassProperty extends ClassMember {
private final @Nullable PropertyTypeNode typeNode;
@@ -18,10 +18,10 @@ package org.pkl.core.ast.member;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.runtime.Identifier;
import org.pkl.core.runtime.VmUtils;
import org.pkl.core.util.Nullable;
/**
* Property body for properties that don't have an explicit body. Returns the default value for the
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.IndirectCallNode;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.expression.primary.GetReceiverNode;
import org.pkl.core.runtime.VmDynamic;
@@ -29,7 +30,6 @@ import org.pkl.core.runtime.VmLanguage;
import org.pkl.core.runtime.VmListing;
import org.pkl.core.runtime.VmMapping;
import org.pkl.core.runtime.VmUtils;
import org.pkl.core.util.Nullable;
/** Equivalent of {@link TypedPropertyNode} for elements/entries. */
public abstract class ElementOrEntryNode extends RegularMemberNode {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.source.SourceSection;
import java.util.List;
import org.jspecify.annotations.Nullable;
import org.pkl.core.Member.SourceLocation;
import org.pkl.core.PClass;
import org.pkl.core.PType;
@@ -31,7 +32,6 @@ import org.pkl.core.ast.VmModifier;
import org.pkl.core.ast.type.TypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.CollectionUtils;
import org.pkl.core.util.Nullable;
import org.pkl.core.util.Pair;
public final class FunctionNode extends RegularMemberNode {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
package org.pkl.core.ast.member;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.VmModifier;
import org.pkl.core.util.Nullable;
public class Lambda extends Member {
public Lambda(SourceSection sourceSection, String qualifiedName) {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +18,10 @@ package org.pkl.core.ast.member;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.PklRootNode;
import org.pkl.core.ast.type.TypeNode;
import org.pkl.core.runtime.VmLanguage;
import org.pkl.core.util.Nullable;
/** Performs a typecast on a Mapping entry value, or a Listing element. */
public final class ListingOrMappingTypeCastNode extends PklRootNode {
@@ -18,12 +18,12 @@ package org.pkl.core.ast.member;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.type.TypeNode;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.VmLanguage;
import org.pkl.core.util.LateInit;
import org.pkl.core.util.Nullable;
public final class LocalTypedPropertyNode extends RegularMemberNode {
private final VmLanguage language;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,9 +16,9 @@
package org.pkl.core.ast.member;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.VmModifier;
import org.pkl.core.runtime.Identifier;
import org.pkl.core.util.Nullable;
public abstract class Member {
protected final SourceSection sourceSection;
@@ -19,13 +19,13 @@ import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.RootCallTarget;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ConstantNode;
import org.pkl.core.ast.MemberNode;
import org.pkl.core.ast.VmModifier;
import org.pkl.core.runtime.Identifier;
import org.pkl.core.runtime.VmDynamic;
import org.pkl.core.runtime.VmUtils;
import org.pkl.core.util.Nullable;
public final class ObjectMember extends Member {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,12 @@ import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.type.TypeNode;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.LateInit;
import org.pkl.core.util.Nullable;
public final class ObjectMethodNode extends RegularMemberNode {
private final VmLanguage language;
@@ -19,12 +19,12 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.PType;
import org.pkl.core.ast.PklRootNode;
import org.pkl.core.ast.type.TypeNode;
import org.pkl.core.ast.type.TypeNode.UnknownTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
public final class PropertyTypeNode extends PklRootNode {
private final String qualifiedPropertyName;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,10 +17,10 @@ package org.pkl.core.ast.member;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.MemberNode;
import org.pkl.core.runtime.VmLanguage;
import org.pkl.core.util.Nullable;
/** A {@code MemberNode} that belongs to a single {@link Member}. */
public abstract class RegularMemberNode extends MemberNode {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +18,10 @@ package org.pkl.core.ast.member;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.MemberNode;
import org.pkl.core.runtime.VmLanguage;
import org.pkl.core.util.Nullable;
/** A {@code MemberNode} that is shared between multiple {@linkplain Member members}. */
public class SharedMemberNode extends MemberNode {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,13 +21,13 @@ import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import java.util.ArrayList;
import java.util.List;
import org.jspecify.annotations.Nullable;
import org.pkl.core.TypeParameter;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.VmTypeAlias;
import org.pkl.core.runtime.VmTyped;
import org.pkl.core.runtime.VmUtils;
import org.pkl.core.util.Nullable;
public final class TypeAliasNode extends ExpressionNode {
private final SourceSection headerSection;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,10 +22,10 @@ import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.DirectCallNode;
import com.oracle.truffle.api.nodes.IndirectCallNode;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.expression.primary.GetOwnerNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
/** A property definition that does not have a type annotation but should be type-checked. */
public abstract class TypeCheckedPropertyNode extends RegularMemberNode {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,12 @@ package org.pkl.core.ast.member;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.PklNode;
import org.pkl.core.runtime.Identifier;
import org.pkl.core.runtime.VmClass;
import org.pkl.core.runtime.VmLanguage;
import org.pkl.core.util.Nullable;
public abstract class UnresolvedClassMemberNode extends PklNode {
protected final SourceSection headerSection;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,11 +18,11 @@ package org.pkl.core.ast.member;
import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.PklNode;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
public final class UnresolvedFunctionNode extends PklNode {
private final VmLanguage language;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,12 @@ import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import java.util.List;
import org.jspecify.annotations.Nullable;
import org.pkl.core.TypeParameter;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.VmModifier;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
public final class UnresolvedMethodNode extends UnresolvedClassMemberNode {
private final int parameterCount;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,11 +19,11 @@ import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.ast.VmModifier;
import org.pkl.core.ast.type.UnresolvedTypeNode;
import org.pkl.core.runtime.*;
import org.pkl.core.util.Nullable;
public final class UnresolvedPropertyNode extends UnresolvedClassMemberNode {
private final SourceSection propertyNameSection;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,9 @@ package org.pkl.core.ast.member;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.runtime.VmLanguage;
import org.pkl.core.util.Nullable;
public final class UntypedObjectMemberNode extends RegularMemberNode {
public UntypedObjectMemberNode(
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.member;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.repl;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,9 +19,9 @@ import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.PklRootNode;
import org.pkl.core.runtime.VmLanguage;
import org.pkl.core.util.Nullable;
/** Root node for a mixin used as default value for type `Mixin<Foo>`. */
public final class IdentityMixinNode extends PklRootNode {
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +17,11 @@ package org.pkl.core.ast.type;
import com.oracle.truffle.api.nodes.IndirectCallNode;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.runtime.Identifier;
import org.pkl.core.runtime.VmObjectLike;
import org.pkl.core.runtime.VmTyped;
import org.pkl.core.util.Nullable;
public abstract class ResolveDeclaredTypeNode extends ExpressionNode {
@Child private IndirectCallNode callNode = IndirectCallNode.create();
@@ -33,6 +33,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
import org.pkl.core.PType;
import org.pkl.core.PType.StringLiteral;
import org.pkl.core.PklBugException;
@@ -52,8 +54,6 @@ import org.pkl.core.util.EconomicMaps;
import org.pkl.core.util.EconomicSets;
import org.pkl.core.util.LateInit;
import org.pkl.core.util.MutableBoolean;
import org.pkl.core.util.Nonnull;
import org.pkl.core.util.Nullable;
public abstract class TypeNode extends PklNode {
@@ -2689,7 +2689,7 @@ public abstract class TypeNode extends PklNode {
}
@Override
public @Nonnull VmTypeAlias getVmTypeAlias() {
public @NonNull VmTypeAlias getVmTypeAlias() {
return typeAlias;
}
@@ -19,9 +19,9 @@ import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.NodeInfo;
import com.oracle.truffle.api.source.SourceSection;
import org.jspecify.annotations.Nullable;
import org.pkl.core.ast.ExpressionNode;
import org.pkl.core.runtime.VmLanguage;
import org.pkl.core.util.Nullable;
@NodeInfo(shortName = "is")
public final class TypeTestNode extends ExpressionNode {
@@ -22,6 +22,7 @@ import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.source.SourceSection;
import java.util.*;
import java.util.stream.Collectors;
import org.jspecify.annotations.Nullable;
import org.pkl.core.StackFrame;
import org.pkl.core.ValueFormatter;
import org.pkl.core.ast.type.TypeNode.UnionTypeNode;
@@ -29,7 +30,6 @@ import org.pkl.core.runtime.*;
import org.pkl.core.runtime.VmException.ProgramValue;
import org.pkl.core.util.AnsiStringBuilder;
import org.pkl.core.util.ErrorMessages;
import org.pkl.core.util.Nullable;
/**
* Indicates that a type check failed. [TypeNode]s use this exception instead of [VmException] to
@@ -1,4 +1,4 @@
@NonnullByDefault
@NullMarked
package org.pkl.core.ast.type;
import org.pkl.core.util.NonnullByDefault;
import org.jspecify.annotations.NullMarked;
@@ -29,6 +29,7 @@ import java.util.function.BiFunction;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.jspecify.annotations.Nullable;
import org.pkl.core.Duration;
import org.pkl.core.PNull;
import org.pkl.core.PObject;
@@ -39,7 +40,6 @@ import org.pkl.core.Value;
import org.pkl.core.util.ErrorMessages;
import org.pkl.core.util.GlobResolver;
import org.pkl.core.util.GlobResolver.InvalidGlobPatternException;
import org.pkl.core.util.Nullable;
/** Java version of {@code pkl.EvaluatorSettings}. */
public record PklEvaluatorSettings(

Some files were not shown because too many files have changed in this diff Show More