mirror of
https://github.com/apple/pkl.git
synced 2026-05-25 16:19:20 +02:00
Make codegen default to jspecify NonNull annotations (#1607)
With JSpecify now a dependency of pkl-config-java, this moves the non-null annotation to jspecify's. This makes it simpler for users to do nullness checks, as tooling already understands JSpecify nullness annotations.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@file:Suppress("unused")
|
||||
@file:Suppress("unused", "CanConvertToMultiDollarString")
|
||||
|
||||
package org.pkl.codegen.java
|
||||
|
||||
@@ -172,7 +172,7 @@ class JavaCodeGenerator(
|
||||
val annotation = codegenOptions.nonNullAnnotation
|
||||
val className =
|
||||
if (annotation == null) {
|
||||
ClassName.get("org.pkl.config.java.mapper", "NonNull")
|
||||
ClassName.get("org.jspecify.annotations", "NonNull")
|
||||
} else {
|
||||
toClassName(annotation)
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.lang.StringBuilder;
|
||||
import java.util.Objects;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.pkl.config.java.mapper.Named;
|
||||
import org.pkl.config.java.mapper.NonNull;
|
||||
import org.pkl.core.DataSize;
|
||||
import org.pkl.core.Duration;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.lang.StringBuilder;
|
||||
import java.util.Objects;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.pkl.config.java.mapper.Named;
|
||||
import org.pkl.config.java.mapper.NonNull;
|
||||
import org.pkl.core.Duration;
|
||||
|
||||
public final class Mod {
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.lang.StringBuilder;
|
||||
import java.util.Objects;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.pkl.config.java.mapper.Named;
|
||||
import org.pkl.config.java.mapper.NonNull;
|
||||
|
||||
/**
|
||||
* module comment.
|
||||
|
||||
@@ -11,8 +11,8 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.pkl.config.java.mapper.Named;
|
||||
import org.pkl.config.java.mapper.NonNull;
|
||||
import org.pkl.core.DataSize;
|
||||
import org.pkl.core.DataSizeUnit;
|
||||
import org.pkl.core.Duration;
|
||||
|
||||
Reference in New Issue
Block a user