diff --git a/codegen/generators/java.rb b/codegen/generators/java.rb index 8c7ee3f4..4e7761ac 100644 --- a/codegen/generators/java.rb +++ b/codegen/generators/java.rb @@ -5,7 +5,7 @@ module Generator # Automatic Code generation overrides for the Java programming language class Java < Base def array_type_for(type_name) - "java.util.List<#{type_name}>" + "List<#{type_name}>" end def format_description(raw_description, indent_string: '') diff --git a/codegen/templates/java.java.erb b/codegen/templates/java.java.erb index b29cf83b..330a8bf1 100644 --- a/codegen/templates/java.java.erb +++ b/codegen/templates/java.java.erb @@ -2,11 +2,12 @@ <%= class_name(key) %>.java package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -17,10 +18,12 @@ import static java.util.Objects.requireNonNull; <%- end -%> */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class <%= class_name(key) %> { - <%- schema['properties'].each do |property_name, property| -%> - private final <%= type_for(class_name(key), property_name, property) -%> <%= property_name %>; + <%- schema['properties'].each do |property_name, property| + nullable = !(schema['required'] || []).index(property_name) + -%> + private final <% if nullable -%>@Nullable <%- end -%><%= type_for(class_name(key), property_name, property) -%> <%= property_name %>; <%- end -%> <%- if (schema['required'] || []).empty? -%> <%- schema['properties'].each do |(property_name, property)| -%> @@ -30,7 +33,7 @@ public final class <%= class_name(key) %> { <%- schema['properties'].each_with_index do |(property_name_2, _property_2), index| -%> <%- if property_name_2 == property_name -%> <%- if property['items'] -%> - unmodifiableList(new ArrayList<>(requireNonNull(<%= property_name %>, "<%= class_name(key) %>.<%= property_name %> cannot be null")))<%= index < schema['properties'].length - 1 ? ',' : '' %> + List.copyOf(requireNonNull(<%= property_name %>, "<%= class_name(key) %>.<%= property_name %> cannot be null"))<%= index < schema['properties'].length - 1 ? ',' : '' %> <%- else -%> requireNonNull(<%= property_name %>, "<%= class_name(key) %>.<%= property_name %> cannot be null")<%= index < schema['properties'].length - 1 ? ',' : '' %> <%- end -%> @@ -44,8 +47,10 @@ public final class <%= class_name(key) %> { <%- end -%> public <%= class_name(key) %>( - <%- schema['properties'].each_with_index do |(property_name, property), index| -%> - <%= type_for(class_name(key), property_name, property) -%> <%= property_name %><%= index < schema['properties'].length-1 ? ',' : ''%> + <%- schema['properties'].each_with_index do |(property_name, property), index| + nullable = !(schema['required'] || []).index(property_name) + -%> + <% if nullable -%>@Nullable <%- end -%><%= type_for(class_name(key), property_name, property) -%> <%= property_name %><%= index < schema['properties'].length-1 ? ',' : ''%> <%- end -%> ) { <%- schema['properties'].each do |(property_name, property)| @@ -53,13 +58,13 @@ public final class <%= class_name(key) %> { -%> <%- if required -%> <%- if property['items'] -%> - this.<%= property_name %> = unmodifiableList(new ArrayList<>(requireNonNull(<%= property_name %>, "<%= class_name(key) %>.<%= property_name %> cannot be null"))); + this.<%= property_name %> = List.copyOf(requireNonNull(<%= property_name %>, "<%= class_name(key) %>.<%= property_name %> cannot be null")); <%- else -%> this.<%= property_name %> = requireNonNull(<%= property_name %>, "<%= class_name(key) %>.<%= property_name %> cannot be null"); <%- end -%> <%- else -%> <%- if property['items'] -%> - this.<%= property_name %> = <%= property_name %> == null ? null : unmodifiableList(new ArrayList<>(<%= property_name %>)); + this.<%= property_name %> = <%= property_name %> == null ? null : List.copyOf(<%= property_name %>); <%- else -%> this.<%= property_name %> = <%= property_name %>; <%- end -%> diff --git a/java/.mvn/jvm.config b/java/.mvn/jvm.config new file mode 100644 index 00000000..8488a4fc --- /dev/null +++ b/java/.mvn/jvm.config @@ -0,0 +1,10 @@ +--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED +--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED +--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \ No newline at end of file diff --git a/java/pom.xml b/java/pom.xml index 0cce08e0..b9798ce8 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -5,7 +5,7 @@ io.cucumber cucumber-parent - 4.5.0 + 5.0.0-SNAPSHOT messages 30.1.1-SNAPSHOT @@ -53,6 +53,13 @@ + + + org.jspecify + jspecify + 1.0.0 + + com.fasterxml.jackson.core jackson-databind diff --git a/java/src/generated/java/io/cucumber/messages/types/Attachment.java b/java/src/generated/java/io/cucumber/messages/types/Attachment.java index 240d0cdc..ea5e0999 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Attachment.java +++ b/java/src/generated/java/io/cucumber/messages/types/Attachment.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -23,32 +24,32 @@ * is captured in `TestResult`. */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Attachment { private final String body; private final AttachmentContentEncoding contentEncoding; - private final String fileName; + private final @Nullable String fileName; private final String mediaType; - private final Source source; - private final String testCaseStartedId; - private final String testStepId; - private final String url; - private final String testRunStartedId; - private final String testRunHookStartedId; - private final Timestamp timestamp; + private final @Nullable Source source; + private final @Nullable String testCaseStartedId; + private final @Nullable String testStepId; + private final @Nullable String url; + private final @Nullable String testRunStartedId; + private final @Nullable String testRunHookStartedId; + private final @Nullable Timestamp timestamp; public Attachment( String body, AttachmentContentEncoding contentEncoding, - String fileName, + @Nullable String fileName, String mediaType, - Source source, - String testCaseStartedId, - String testStepId, - String url, - String testRunStartedId, - String testRunHookStartedId, - Timestamp timestamp + @Nullable Source source, + @Nullable String testCaseStartedId, + @Nullable String testStepId, + @Nullable String url, + @Nullable String testRunStartedId, + @Nullable String testRunHookStartedId, + @Nullable Timestamp timestamp ) { this.body = requireNonNull(body, "Attachment.body cannot be null"); this.contentEncoding = requireNonNull(contentEncoding, "Attachment.contentEncoding cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/Background.java b/java/src/generated/java/io/cucumber/messages/types/Background.java index d60acc2b..4ed728a3 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Background.java +++ b/java/src/generated/java/io/cucumber/messages/types/Background.java @@ -1,23 +1,24 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the Background message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Background { private final Location location; private final String keyword; private final String name; private final String description; - private final java.util.List steps; + private final List steps; private final String id; public Background( @@ -25,14 +26,14 @@ public Background( String keyword, String name, String description, - java.util.List steps, + List steps, String id ) { this.location = requireNonNull(location, "Background.location cannot be null"); this.keyword = requireNonNull(keyword, "Background.keyword cannot be null"); this.name = requireNonNull(name, "Background.name cannot be null"); this.description = requireNonNull(description, "Background.description cannot be null"); - this.steps = unmodifiableList(new ArrayList<>(requireNonNull(steps, "Background.steps cannot be null"))); + this.steps = List.copyOf(requireNonNull(steps, "Background.steps cannot be null")); this.id = requireNonNull(id, "Background.id cannot be null"); } @@ -55,7 +56,7 @@ public String getDescription() { return description; } - public java.util.List getSteps() { + public List getSteps() { return steps; } diff --git a/java/src/generated/java/io/cucumber/messages/types/Ci.java b/java/src/generated/java/io/cucumber/messages/types/Ci.java index 73f31cdf..54f83d3f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Ci.java +++ b/java/src/generated/java/io/cucumber/messages/types/Ci.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,18 +14,18 @@ * CI environment */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Ci { private final String name; - private final String url; - private final String buildNumber; - private final Git git; + private final @Nullable String url; + private final @Nullable String buildNumber; + private final @Nullable Git git; public Ci( String name, - String url, - String buildNumber, - Git git + @Nullable String url, + @Nullable String buildNumber, + @Nullable Git git ) { this.name = requireNonNull(name, "Ci.name cannot be null"); this.url = url; diff --git a/java/src/generated/java/io/cucumber/messages/types/Comment.java b/java/src/generated/java/io/cucumber/messages/types/Comment.java index 8df2ee6f..211ddece 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Comment.java +++ b/java/src/generated/java/io/cucumber/messages/types/Comment.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,7 +14,7 @@ * A comment in a Gherkin document */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Comment { private final Location location; private final String text; diff --git a/java/src/generated/java/io/cucumber/messages/types/DataTable.java b/java/src/generated/java/io/cucumber/messages/types/DataTable.java index b5f7eeb9..0b049234 100644 --- a/java/src/generated/java/io/cucumber/messages/types/DataTable.java +++ b/java/src/generated/java/io/cucumber/messages/types/DataTable.java @@ -1,34 +1,35 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the DataTable message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class DataTable { private final Location location; - private final java.util.List rows; + private final List rows; public DataTable( Location location, - java.util.List rows + List rows ) { this.location = requireNonNull(location, "DataTable.location cannot be null"); - this.rows = unmodifiableList(new ArrayList<>(requireNonNull(rows, "DataTable.rows cannot be null"))); + this.rows = List.copyOf(requireNonNull(rows, "DataTable.rows cannot be null")); } public Location getLocation() { return location; } - public java.util.List getRows() { + public List getRows() { return rows; } diff --git a/java/src/generated/java/io/cucumber/messages/types/DocString.java b/java/src/generated/java/io/cucumber/messages/types/DocString.java index 9ab2184b..9e0cb80a 100644 --- a/java/src/generated/java/io/cucumber/messages/types/DocString.java +++ b/java/src/generated/java/io/cucumber/messages/types/DocString.java @@ -1,26 +1,27 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the DocString message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class DocString { private final Location location; - private final String mediaType; + private final @Nullable String mediaType; private final String content; private final String delimiter; public DocString( Location location, - String mediaType, + @Nullable String mediaType, String content, String delimiter ) { diff --git a/java/src/generated/java/io/cucumber/messages/types/Duration.java b/java/src/generated/java/io/cucumber/messages/types/Duration.java index fd790661..f9423b84 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Duration.java +++ b/java/src/generated/java/io/cucumber/messages/types/Duration.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -14,7 +15,7 @@ * of message is used. */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Duration { private final Long seconds; private final Long nanos; diff --git a/java/src/generated/java/io/cucumber/messages/types/Envelope.java b/java/src/generated/java/io/cucumber/messages/types/Envelope.java index b7534ed4..7157200f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Envelope.java +++ b/java/src/generated/java/io/cucumber/messages/types/Envelope.java @@ -1,38 +1,39 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the Envelope message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Envelope { - private final Attachment attachment; - private final GherkinDocument gherkinDocument; - private final Hook hook; - private final Meta meta; - private final ParameterType parameterType; - private final ParseError parseError; - private final Pickle pickle; - private final Suggestion suggestion; - private final Source source; - private final StepDefinition stepDefinition; - private final TestCase testCase; - private final TestCaseFinished testCaseFinished; - private final TestCaseStarted testCaseStarted; - private final TestRunFinished testRunFinished; - private final TestRunStarted testRunStarted; - private final TestStepFinished testStepFinished; - private final TestStepStarted testStepStarted; - private final TestRunHookStarted testRunHookStarted; - private final TestRunHookFinished testRunHookFinished; - private final UndefinedParameterType undefinedParameterType; + private final @Nullable Attachment attachment; + private final @Nullable GherkinDocument gherkinDocument; + private final @Nullable Hook hook; + private final @Nullable Meta meta; + private final @Nullable ParameterType parameterType; + private final @Nullable ParseError parseError; + private final @Nullable Pickle pickle; + private final @Nullable Suggestion suggestion; + private final @Nullable Source source; + private final @Nullable StepDefinition stepDefinition; + private final @Nullable TestCase testCase; + private final @Nullable TestCaseFinished testCaseFinished; + private final @Nullable TestCaseStarted testCaseStarted; + private final @Nullable TestRunFinished testRunFinished; + private final @Nullable TestRunStarted testRunStarted; + private final @Nullable TestStepFinished testStepFinished; + private final @Nullable TestStepStarted testStepStarted; + private final @Nullable TestRunHookStarted testRunHookStarted; + private final @Nullable TestRunHookFinished testRunHookFinished; + private final @Nullable UndefinedParameterType undefinedParameterType; public static Envelope of(Attachment attachment) { return new Envelope( @@ -535,26 +536,26 @@ public static Envelope of(UndefinedParameterType undefinedParameterType) { } public Envelope( - Attachment attachment, - GherkinDocument gherkinDocument, - Hook hook, - Meta meta, - ParameterType parameterType, - ParseError parseError, - Pickle pickle, - Suggestion suggestion, - Source source, - StepDefinition stepDefinition, - TestCase testCase, - TestCaseFinished testCaseFinished, - TestCaseStarted testCaseStarted, - TestRunFinished testRunFinished, - TestRunStarted testRunStarted, - TestStepFinished testStepFinished, - TestStepStarted testStepStarted, - TestRunHookStarted testRunHookStarted, - TestRunHookFinished testRunHookFinished, - UndefinedParameterType undefinedParameterType + @Nullable Attachment attachment, + @Nullable GherkinDocument gherkinDocument, + @Nullable Hook hook, + @Nullable Meta meta, + @Nullable ParameterType parameterType, + @Nullable ParseError parseError, + @Nullable Pickle pickle, + @Nullable Suggestion suggestion, + @Nullable Source source, + @Nullable StepDefinition stepDefinition, + @Nullable TestCase testCase, + @Nullable TestCaseFinished testCaseFinished, + @Nullable TestCaseStarted testCaseStarted, + @Nullable TestRunFinished testRunFinished, + @Nullable TestRunStarted testRunStarted, + @Nullable TestStepFinished testStepFinished, + @Nullable TestStepStarted testStepStarted, + @Nullable TestRunHookStarted testRunHookStarted, + @Nullable TestRunHookFinished testRunHookFinished, + @Nullable UndefinedParameterType undefinedParameterType ) { this.attachment = attachment; this.gherkinDocument = gherkinDocument; diff --git a/java/src/generated/java/io/cucumber/messages/types/Examples.java b/java/src/generated/java/io/cucumber/messages/types/Examples.java index 9b480497..8d8643f7 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Examples.java +++ b/java/src/generated/java/io/cucumber/messages/types/Examples.java @@ -1,44 +1,45 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the Examples message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Examples { private final Location location; - private final java.util.List tags; + private final List tags; private final String keyword; private final String name; private final String description; - private final TableRow tableHeader; - private final java.util.List tableBody; + private final @Nullable TableRow tableHeader; + private final List tableBody; private final String id; public Examples( Location location, - java.util.List tags, + List tags, String keyword, String name, String description, - TableRow tableHeader, - java.util.List tableBody, + @Nullable TableRow tableHeader, + List tableBody, String id ) { this.location = requireNonNull(location, "Examples.location cannot be null"); - this.tags = unmodifiableList(new ArrayList<>(requireNonNull(tags, "Examples.tags cannot be null"))); + this.tags = List.copyOf(requireNonNull(tags, "Examples.tags cannot be null")); this.keyword = requireNonNull(keyword, "Examples.keyword cannot be null"); this.name = requireNonNull(name, "Examples.name cannot be null"); this.description = requireNonNull(description, "Examples.description cannot be null"); this.tableHeader = tableHeader; - this.tableBody = unmodifiableList(new ArrayList<>(requireNonNull(tableBody, "Examples.tableBody cannot be null"))); + this.tableBody = List.copyOf(requireNonNull(tableBody, "Examples.tableBody cannot be null")); this.id = requireNonNull(id, "Examples.id cannot be null"); } @@ -49,7 +50,7 @@ public Location getLocation() { return location; } - public java.util.List getTags() { + public List getTags() { return tags; } @@ -69,7 +70,7 @@ public Optional getTableHeader() { return Optional.ofNullable(tableHeader); } - public java.util.List getTableBody() { + public List getTableBody() { return tableBody; } diff --git a/java/src/generated/java/io/cucumber/messages/types/Exception.java b/java/src/generated/java/io/cucumber/messages/types/Exception.java index 3b3e9cb8..97b6602f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Exception.java +++ b/java/src/generated/java/io/cucumber/messages/types/Exception.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,16 +14,16 @@ * A simplified representation of an exception */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Exception { private final String type; - private final String message; - private final String stackTrace; + private final @Nullable String message; + private final @Nullable String stackTrace; public Exception( String type, - String message, - String stackTrace + @Nullable String message, + @Nullable String stackTrace ) { this.type = requireNonNull(type, "Exception.type cannot be null"); this.message = message; diff --git a/java/src/generated/java/io/cucumber/messages/types/Feature.java b/java/src/generated/java/io/cucumber/messages/types/Feature.java index 896b64fe..cfbcb073 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Feature.java +++ b/java/src/generated/java/io/cucumber/messages/types/Feature.java @@ -1,42 +1,43 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the Feature message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Feature { private final Location location; - private final java.util.List tags; + private final List tags; private final String language; private final String keyword; private final String name; private final String description; - private final java.util.List children; + private final List children; public Feature( Location location, - java.util.List tags, + List tags, String language, String keyword, String name, String description, - java.util.List children + List children ) { this.location = requireNonNull(location, "Feature.location cannot be null"); - this.tags = unmodifiableList(new ArrayList<>(requireNonNull(tags, "Feature.tags cannot be null"))); + this.tags = List.copyOf(requireNonNull(tags, "Feature.tags cannot be null")); this.language = requireNonNull(language, "Feature.language cannot be null"); this.keyword = requireNonNull(keyword, "Feature.keyword cannot be null"); this.name = requireNonNull(name, "Feature.name cannot be null"); this.description = requireNonNull(description, "Feature.description cannot be null"); - this.children = unmodifiableList(new ArrayList<>(requireNonNull(children, "Feature.children cannot be null"))); + this.children = List.copyOf(requireNonNull(children, "Feature.children cannot be null")); } /** @@ -49,7 +50,7 @@ public Location getLocation() { /** * All the tags placed above the `Feature` keyword */ - public java.util.List getTags() { + public List getTags() { return tags; } @@ -84,7 +85,7 @@ public String getDescription() { /** * Zero or more children */ - public java.util.List getChildren() { + public List getChildren() { return children; } diff --git a/java/src/generated/java/io/cucumber/messages/types/FeatureChild.java b/java/src/generated/java/io/cucumber/messages/types/FeatureChild.java index 6e77210a..7b0bff9d 100644 --- a/java/src/generated/java/io/cucumber/messages/types/FeatureChild.java +++ b/java/src/generated/java/io/cucumber/messages/types/FeatureChild.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,11 +14,11 @@ * A child node of a `Feature` node */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class FeatureChild { - private final Rule rule; - private final Background background; - private final Scenario scenario; + private final @Nullable Rule rule; + private final @Nullable Background background; + private final @Nullable Scenario scenario; public static FeatureChild of(Rule rule) { return new FeatureChild( @@ -44,9 +45,9 @@ public static FeatureChild of(Scenario scenario) { } public FeatureChild( - Rule rule, - Background background, - Scenario scenario + @Nullable Rule rule, + @Nullable Background background, + @Nullable Scenario scenario ) { this.rule = rule; this.background = background; diff --git a/java/src/generated/java/io/cucumber/messages/types/GherkinDocument.java b/java/src/generated/java/io/cucumber/messages/types/GherkinDocument.java index bbc0e2a7..41f86ca0 100644 --- a/java/src/generated/java/io/cucumber/messages/types/GherkinDocument.java +++ b/java/src/generated/java/io/cucumber/messages/types/GherkinDocument.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -18,20 +19,20 @@ * "rich" output, resembling the original Gherkin document. */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class GherkinDocument { - private final String uri; - private final Feature feature; - private final java.util.List comments; + private final @Nullable String uri; + private final @Nullable Feature feature; + private final List comments; public GherkinDocument( - String uri, - Feature feature, - java.util.List comments + @Nullable String uri, + @Nullable Feature feature, + List comments ) { this.uri = uri; this.feature = feature; - this.comments = unmodifiableList(new ArrayList<>(requireNonNull(comments, "GherkinDocument.comments cannot be null"))); + this.comments = List.copyOf(requireNonNull(comments, "GherkinDocument.comments cannot be null")); } /** @@ -49,7 +50,7 @@ public Optional getFeature() { /** * All the comments in the Gherkin document */ - public java.util.List getComments() { + public List getComments() { return comments; } diff --git a/java/src/generated/java/io/cucumber/messages/types/Git.java b/java/src/generated/java/io/cucumber/messages/types/Git.java index e2bc6976..0612b121 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Git.java +++ b/java/src/generated/java/io/cucumber/messages/types/Git.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -14,18 +15,18 @@ * variables. */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Git { private final String remote; private final String revision; - private final String branch; - private final String tag; + private final @Nullable String branch; + private final @Nullable String tag; public Git( String remote, String revision, - String branch, - String tag + @Nullable String branch, + @Nullable String tag ) { this.remote = requireNonNull(remote, "Git.remote cannot be null"); this.revision = requireNonNull(revision, "Git.revision cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/Group.java b/java/src/generated/java/io/cucumber/messages/types/Group.java index e4550c86..e3bb24d8 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Group.java +++ b/java/src/generated/java/io/cucumber/messages/types/Group.java @@ -1,33 +1,34 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the Group message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Group { - private final java.util.List children; - private final Long start; - private final String value; + private final List children; + private final @Nullable Long start; + private final @Nullable String value; public Group( - java.util.List children, - Long start, - String value + List children, + @Nullable Long start, + @Nullable String value ) { - this.children = unmodifiableList(new ArrayList<>(requireNonNull(children, "Group.children cannot be null"))); + this.children = List.copyOf(requireNonNull(children, "Group.children cannot be null")); this.start = start; this.value = value; } - public java.util.List getChildren() { + public List getChildren() { return children; } diff --git a/java/src/generated/java/io/cucumber/messages/types/Hook.java b/java/src/generated/java/io/cucumber/messages/types/Hook.java index e1f20a47..bfebb165 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Hook.java +++ b/java/src/generated/java/io/cucumber/messages/types/Hook.java @@ -1,30 +1,31 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the Hook message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Hook { private final String id; - private final String name; + private final @Nullable String name; private final SourceReference sourceReference; - private final String tagExpression; - private final HookType type; + private final @Nullable String tagExpression; + private final @Nullable HookType type; public Hook( String id, - String name, + @Nullable String name, SourceReference sourceReference, - String tagExpression, - HookType type + @Nullable String tagExpression, + @Nullable HookType type ) { this.id = requireNonNull(id, "Hook.id cannot be null"); this.name = name; diff --git a/java/src/generated/java/io/cucumber/messages/types/JavaMethod.java b/java/src/generated/java/io/cucumber/messages/types/JavaMethod.java index 88b01510..1377fcf9 100644 --- a/java/src/generated/java/io/cucumber/messages/types/JavaMethod.java +++ b/java/src/generated/java/io/cucumber/messages/types/JavaMethod.java @@ -1,30 +1,31 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the JavaMethod message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class JavaMethod { private final String className; private final String methodName; - private final java.util.List methodParameterTypes; + private final List methodParameterTypes; public JavaMethod( String className, String methodName, - java.util.List methodParameterTypes + List methodParameterTypes ) { this.className = requireNonNull(className, "JavaMethod.className cannot be null"); this.methodName = requireNonNull(methodName, "JavaMethod.methodName cannot be null"); - this.methodParameterTypes = unmodifiableList(new ArrayList<>(requireNonNull(methodParameterTypes, "JavaMethod.methodParameterTypes cannot be null"))); + this.methodParameterTypes = List.copyOf(requireNonNull(methodParameterTypes, "JavaMethod.methodParameterTypes cannot be null")); } public String getClassName() { @@ -35,7 +36,7 @@ public String getMethodName() { return methodName; } - public java.util.List getMethodParameterTypes() { + public List getMethodParameterTypes() { return methodParameterTypes; } diff --git a/java/src/generated/java/io/cucumber/messages/types/JavaStackTraceElement.java b/java/src/generated/java/io/cucumber/messages/types/JavaStackTraceElement.java index 1f5b2789..0e27e62e 100644 --- a/java/src/generated/java/io/cucumber/messages/types/JavaStackTraceElement.java +++ b/java/src/generated/java/io/cucumber/messages/types/JavaStackTraceElement.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the JavaStackTraceElement message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class JavaStackTraceElement { private final String className; private final String fileName; diff --git a/java/src/generated/java/io/cucumber/messages/types/Location.java b/java/src/generated/java/io/cucumber/messages/types/Location.java index 0367481c..690c4522 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Location.java +++ b/java/src/generated/java/io/cucumber/messages/types/Location.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,14 +14,14 @@ * Points to a line and a column in a text file */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Location { private final Long line; - private final Long column; + private final @Nullable Long column; public Location( Long line, - Long column + @Nullable Long column ) { this.line = requireNonNull(line, "Location.line cannot be null"); this.column = column; diff --git a/java/src/generated/java/io/cucumber/messages/types/Meta.java b/java/src/generated/java/io/cucumber/messages/types/Meta.java index c9a64cfb..7965eb93 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Meta.java +++ b/java/src/generated/java/io/cucumber/messages/types/Meta.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -14,14 +15,14 @@ * this for various purposes. */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Meta { private final String protocolVersion; private final Product implementation; private final Product runtime; private final Product os; private final Product cpu; - private final Ci ci; + private final @Nullable Ci ci; public Meta( String protocolVersion, @@ -29,7 +30,7 @@ public Meta( Product runtime, Product os, Product cpu, - Ci ci + @Nullable Ci ci ) { this.protocolVersion = requireNonNull(protocolVersion, "Meta.protocolVersion cannot be null"); this.implementation = requireNonNull(implementation, "Meta.implementation cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/ParameterType.java b/java/src/generated/java/io/cucumber/messages/types/ParameterType.java index cad33d8f..d9787469 100644 --- a/java/src/generated/java/io/cucumber/messages/types/ParameterType.java +++ b/java/src/generated/java/io/cucumber/messages/types/ParameterType.java @@ -1,35 +1,36 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the ParameterType message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class ParameterType { private final String name; - private final java.util.List regularExpressions; + private final List regularExpressions; private final Boolean preferForRegularExpressionMatch; private final Boolean useForSnippets; private final String id; - private final SourceReference sourceReference; + private final @Nullable SourceReference sourceReference; public ParameterType( String name, - java.util.List regularExpressions, + List regularExpressions, Boolean preferForRegularExpressionMatch, Boolean useForSnippets, String id, - SourceReference sourceReference + @Nullable SourceReference sourceReference ) { this.name = requireNonNull(name, "ParameterType.name cannot be null"); - this.regularExpressions = unmodifiableList(new ArrayList<>(requireNonNull(regularExpressions, "ParameterType.regularExpressions cannot be null"))); + this.regularExpressions = List.copyOf(requireNonNull(regularExpressions, "ParameterType.regularExpressions cannot be null")); this.preferForRegularExpressionMatch = requireNonNull(preferForRegularExpressionMatch, "ParameterType.preferForRegularExpressionMatch cannot be null"); this.useForSnippets = requireNonNull(useForSnippets, "ParameterType.useForSnippets cannot be null"); this.id = requireNonNull(id, "ParameterType.id cannot be null"); @@ -43,7 +44,7 @@ public String getName() { return name; } - public java.util.List getRegularExpressions() { + public List getRegularExpressions() { return regularExpressions; } diff --git a/java/src/generated/java/io/cucumber/messages/types/ParseError.java b/java/src/generated/java/io/cucumber/messages/types/ParseError.java index 4b7ce6d1..7a0b5a22 100644 --- a/java/src/generated/java/io/cucumber/messages/types/ParseError.java +++ b/java/src/generated/java/io/cucumber/messages/types/ParseError.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the ParseError message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class ParseError { private final SourceReference source; private final String message; diff --git a/java/src/generated/java/io/cucumber/messages/types/Pickle.java b/java/src/generated/java/io/cucumber/messages/types/Pickle.java index 84a20684..4dc39810 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Pickle.java +++ b/java/src/generated/java/io/cucumber/messages/types/Pickle.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -22,32 +23,32 @@ * Each `PickleStep` of a `Pickle` is matched with a `StepDefinition` to create a `TestCase` */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Pickle { private final String id; private final String uri; private final String name; private final String language; - private final java.util.List steps; - private final java.util.List tags; - private final java.util.List astNodeIds; + private final List steps; + private final List tags; + private final List astNodeIds; public Pickle( String id, String uri, String name, String language, - java.util.List steps, - java.util.List tags, - java.util.List astNodeIds + List steps, + List tags, + List astNodeIds ) { this.id = requireNonNull(id, "Pickle.id cannot be null"); this.uri = requireNonNull(uri, "Pickle.uri cannot be null"); this.name = requireNonNull(name, "Pickle.name cannot be null"); this.language = requireNonNull(language, "Pickle.language cannot be null"); - this.steps = unmodifiableList(new ArrayList<>(requireNonNull(steps, "Pickle.steps cannot be null"))); - this.tags = unmodifiableList(new ArrayList<>(requireNonNull(tags, "Pickle.tags cannot be null"))); - this.astNodeIds = unmodifiableList(new ArrayList<>(requireNonNull(astNodeIds, "Pickle.astNodeIds cannot be null"))); + this.steps = List.copyOf(requireNonNull(steps, "Pickle.steps cannot be null")); + this.tags = List.copyOf(requireNonNull(tags, "Pickle.tags cannot be null")); + this.astNodeIds = List.copyOf(requireNonNull(astNodeIds, "Pickle.astNodeIds cannot be null")); } /** @@ -81,7 +82,7 @@ public String getLanguage() { /** * One or more steps */ - public java.util.List getSteps() { + public List getSteps() { return steps; } @@ -89,7 +90,7 @@ public java.util.List getSteps() { * One or more tags. If this pickle is constructed from a Gherkin document, * It includes inherited tags from the `Feature` as well. */ - public java.util.List getTags() { + public List getTags() { return tags; } @@ -98,7 +99,7 @@ public java.util.List getTags() { * id of the pickle. A pickle constructed from `Examples` will have the first * id originating from the `Scenario` AST node, and the second from the `TableRow` AST node. */ - public java.util.List getAstNodeIds() { + public List getAstNodeIds() { return astNodeIds; } diff --git a/java/src/generated/java/io/cucumber/messages/types/PickleDocString.java b/java/src/generated/java/io/cucumber/messages/types/PickleDocString.java index c88ae770..56c8d9a6 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleDocString.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleDocString.java @@ -1,23 +1,24 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the PickleDocString message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class PickleDocString { - private final String mediaType; + private final @Nullable String mediaType; private final String content; public PickleDocString( - String mediaType, + @Nullable String mediaType, String content ) { this.mediaType = mediaType; diff --git a/java/src/generated/java/io/cucumber/messages/types/PickleStep.java b/java/src/generated/java/io/cucumber/messages/types/PickleStep.java index 7da8c955..4795afc6 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleStep.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleStep.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,23 +14,23 @@ * An executable step */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class PickleStep { - private final PickleStepArgument argument; - private final java.util.List astNodeIds; + private final @Nullable PickleStepArgument argument; + private final List astNodeIds; private final String id; - private final PickleStepType type; + private final @Nullable PickleStepType type; private final String text; public PickleStep( - PickleStepArgument argument, - java.util.List astNodeIds, + @Nullable PickleStepArgument argument, + List astNodeIds, String id, - PickleStepType type, + @Nullable PickleStepType type, String text ) { this.argument = argument; - this.astNodeIds = unmodifiableList(new ArrayList<>(requireNonNull(astNodeIds, "PickleStep.astNodeIds cannot be null"))); + this.astNodeIds = List.copyOf(requireNonNull(astNodeIds, "PickleStep.astNodeIds cannot be null")); this.id = requireNonNull(id, "PickleStep.id cannot be null"); this.type = type; this.text = requireNonNull(text, "PickleStep.text cannot be null"); @@ -43,7 +44,7 @@ public Optional getArgument() { * References the IDs of the source of the step. For Gherkin, this can be * the ID of a Step, and possibly also the ID of a TableRow */ - public java.util.List getAstNodeIds() { + public List getAstNodeIds() { return astNodeIds; } diff --git a/java/src/generated/java/io/cucumber/messages/types/PickleStepArgument.java b/java/src/generated/java/io/cucumber/messages/types/PickleStepArgument.java index b0d9a3a0..56e78d50 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleStepArgument.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleStepArgument.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,10 +14,10 @@ * An optional argument */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class PickleStepArgument { - private final PickleDocString docString; - private final PickleTable dataTable; + private final @Nullable PickleDocString docString; + private final @Nullable PickleTable dataTable; public static PickleStepArgument of(PickleDocString docString) { return new PickleStepArgument( @@ -33,8 +34,8 @@ public static PickleStepArgument of(PickleTable dataTable) { } public PickleStepArgument( - PickleDocString docString, - PickleTable dataTable + @Nullable PickleDocString docString, + @Nullable PickleTable dataTable ) { this.docString = docString; this.dataTable = dataTable; diff --git a/java/src/generated/java/io/cucumber/messages/types/PickleTable.java b/java/src/generated/java/io/cucumber/messages/types/PickleTable.java index 4348926c..fddb36ee 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTable.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTable.java @@ -1,27 +1,28 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the PickleTable message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class PickleTable { - private final java.util.List rows; + private final List rows; public PickleTable( - java.util.List rows + List rows ) { - this.rows = unmodifiableList(new ArrayList<>(requireNonNull(rows, "PickleTable.rows cannot be null"))); + this.rows = List.copyOf(requireNonNull(rows, "PickleTable.rows cannot be null")); } - public java.util.List getRows() { + public List getRows() { return rows; } diff --git a/java/src/generated/java/io/cucumber/messages/types/PickleTableCell.java b/java/src/generated/java/io/cucumber/messages/types/PickleTableCell.java index a68d11db..d977d51e 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTableCell.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTableCell.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the PickleTableCell message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class PickleTableCell { private final String value; diff --git a/java/src/generated/java/io/cucumber/messages/types/PickleTableRow.java b/java/src/generated/java/io/cucumber/messages/types/PickleTableRow.java index ede8b485..f875b185 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTableRow.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTableRow.java @@ -1,27 +1,28 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the PickleTableRow message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class PickleTableRow { - private final java.util.List cells; + private final List cells; public PickleTableRow( - java.util.List cells + List cells ) { - this.cells = unmodifiableList(new ArrayList<>(requireNonNull(cells, "PickleTableRow.cells cannot be null"))); + this.cells = List.copyOf(requireNonNull(cells, "PickleTableRow.cells cannot be null")); } - public java.util.List getCells() { + public List getCells() { return cells; } diff --git a/java/src/generated/java/io/cucumber/messages/types/PickleTag.java b/java/src/generated/java/io/cucumber/messages/types/PickleTag.java index 837bb357..2bfed83a 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTag.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTag.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,7 +14,7 @@ * A tag */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class PickleTag { private final String name; private final String astNodeId; diff --git a/java/src/generated/java/io/cucumber/messages/types/Product.java b/java/src/generated/java/io/cucumber/messages/types/Product.java index 46596178..46a32295 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Product.java +++ b/java/src/generated/java/io/cucumber/messages/types/Product.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,14 +14,14 @@ * Used to describe various properties of Meta */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Product { private final String name; - private final String version; + private final @Nullable String version; public Product( String name, - String version + @Nullable String version ) { this.name = requireNonNull(name, "Product.name cannot be null"); this.version = version; diff --git a/java/src/generated/java/io/cucumber/messages/types/Rule.java b/java/src/generated/java/io/cucumber/messages/types/Rule.java index 27132844..2971a80b 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Rule.java +++ b/java/src/generated/java/io/cucumber/messages/types/Rule.java @@ -1,41 +1,42 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the Rule message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Rule { private final Location location; - private final java.util.List tags; + private final List tags; private final String keyword; private final String name; private final String description; - private final java.util.List children; + private final List children; private final String id; public Rule( Location location, - java.util.List tags, + List tags, String keyword, String name, String description, - java.util.List children, + List children, String id ) { this.location = requireNonNull(location, "Rule.location cannot be null"); - this.tags = unmodifiableList(new ArrayList<>(requireNonNull(tags, "Rule.tags cannot be null"))); + this.tags = List.copyOf(requireNonNull(tags, "Rule.tags cannot be null")); this.keyword = requireNonNull(keyword, "Rule.keyword cannot be null"); this.name = requireNonNull(name, "Rule.name cannot be null"); this.description = requireNonNull(description, "Rule.description cannot be null"); - this.children = unmodifiableList(new ArrayList<>(requireNonNull(children, "Rule.children cannot be null"))); + this.children = List.copyOf(requireNonNull(children, "Rule.children cannot be null")); this.id = requireNonNull(id, "Rule.id cannot be null"); } @@ -49,7 +50,7 @@ public Location getLocation() { /** * All the tags placed above the `Rule` keyword */ - public java.util.List getTags() { + public List getTags() { return tags; } @@ -65,7 +66,7 @@ public String getDescription() { return description; } - public java.util.List getChildren() { + public List getChildren() { return children; } diff --git a/java/src/generated/java/io/cucumber/messages/types/RuleChild.java b/java/src/generated/java/io/cucumber/messages/types/RuleChild.java index a5da34ad..fdc56204 100644 --- a/java/src/generated/java/io/cucumber/messages/types/RuleChild.java +++ b/java/src/generated/java/io/cucumber/messages/types/RuleChild.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,10 +14,10 @@ * A child node of a `Rule` node */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class RuleChild { - private final Background background; - private final Scenario scenario; + private final @Nullable Background background; + private final @Nullable Scenario scenario; public static RuleChild of(Background background) { return new RuleChild( @@ -33,8 +34,8 @@ public static RuleChild of(Scenario scenario) { } public RuleChild( - Background background, - Scenario scenario + @Nullable Background background, + @Nullable Scenario scenario ) { this.background = background; this.scenario = scenario; diff --git a/java/src/generated/java/io/cucumber/messages/types/Scenario.java b/java/src/generated/java/io/cucumber/messages/types/Scenario.java index 319bb4b0..45d32421 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Scenario.java +++ b/java/src/generated/java/io/cucumber/messages/types/Scenario.java @@ -1,44 +1,45 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the Scenario message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Scenario { private final Location location; - private final java.util.List tags; + private final List tags; private final String keyword; private final String name; private final String description; - private final java.util.List steps; - private final java.util.List examples; + private final List steps; + private final List examples; private final String id; public Scenario( Location location, - java.util.List tags, + List tags, String keyword, String name, String description, - java.util.List steps, - java.util.List examples, + List steps, + List examples, String id ) { this.location = requireNonNull(location, "Scenario.location cannot be null"); - this.tags = unmodifiableList(new ArrayList<>(requireNonNull(tags, "Scenario.tags cannot be null"))); + this.tags = List.copyOf(requireNonNull(tags, "Scenario.tags cannot be null")); this.keyword = requireNonNull(keyword, "Scenario.keyword cannot be null"); this.name = requireNonNull(name, "Scenario.name cannot be null"); this.description = requireNonNull(description, "Scenario.description cannot be null"); - this.steps = unmodifiableList(new ArrayList<>(requireNonNull(steps, "Scenario.steps cannot be null"))); - this.examples = unmodifiableList(new ArrayList<>(requireNonNull(examples, "Scenario.examples cannot be null"))); + this.steps = List.copyOf(requireNonNull(steps, "Scenario.steps cannot be null")); + this.examples = List.copyOf(requireNonNull(examples, "Scenario.examples cannot be null")); this.id = requireNonNull(id, "Scenario.id cannot be null"); } @@ -49,7 +50,7 @@ public Location getLocation() { return location; } - public java.util.List getTags() { + public List getTags() { return tags; } @@ -65,11 +66,11 @@ public String getDescription() { return description; } - public java.util.List getSteps() { + public List getSteps() { return steps; } - public java.util.List getExamples() { + public List getExamples() { return examples; } diff --git a/java/src/generated/java/io/cucumber/messages/types/Snippet.java b/java/src/generated/java/io/cucumber/messages/types/Snippet.java index 4eb7b97e..31bf59d1 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Snippet.java +++ b/java/src/generated/java/io/cucumber/messages/types/Snippet.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the Snippet message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Snippet { private final String language; private final String code; diff --git a/java/src/generated/java/io/cucumber/messages/types/Source.java b/java/src/generated/java/io/cucumber/messages/types/Source.java index d8794597..e659ebdf 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Source.java +++ b/java/src/generated/java/io/cucumber/messages/types/Source.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,7 +14,7 @@ * A source file, typically a Gherkin document or Java/Ruby/JavaScript source code */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Source { private final String uri; private final String data; diff --git a/java/src/generated/java/io/cucumber/messages/types/SourceReference.java b/java/src/generated/java/io/cucumber/messages/types/SourceReference.java index 9d7ef52f..323772d7 100644 --- a/java/src/generated/java/io/cucumber/messages/types/SourceReference.java +++ b/java/src/generated/java/io/cucumber/messages/types/SourceReference.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -14,12 +15,12 @@ * [Location](#io.cucumber.messages.Location) within that file. */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class SourceReference { - private final String uri; - private final JavaMethod javaMethod; - private final JavaStackTraceElement javaStackTraceElement; - private final Location location; + private final @Nullable String uri; + private final @Nullable JavaMethod javaMethod; + private final @Nullable JavaStackTraceElement javaStackTraceElement; + private final @Nullable Location location; public static SourceReference of(String uri) { return new SourceReference( @@ -58,10 +59,10 @@ public static SourceReference of(Location location) { } public SourceReference( - String uri, - JavaMethod javaMethod, - JavaStackTraceElement javaStackTraceElement, - Location location + @Nullable String uri, + @Nullable JavaMethod javaMethod, + @Nullable JavaStackTraceElement javaStackTraceElement, + @Nullable Location location ) { this.uri = uri; this.javaMethod = javaMethod; diff --git a/java/src/generated/java/io/cucumber/messages/types/Step.java b/java/src/generated/java/io/cucumber/messages/types/Step.java index baf3ba6d..92c027cf 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Step.java +++ b/java/src/generated/java/io/cucumber/messages/types/Step.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,23 +14,23 @@ * A step */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Step { private final Location location; private final String keyword; - private final StepKeywordType keywordType; + private final @Nullable StepKeywordType keywordType; private final String text; - private final DocString docString; - private final DataTable dataTable; + private final @Nullable DocString docString; + private final @Nullable DataTable dataTable; private final String id; public Step( Location location, String keyword, - StepKeywordType keywordType, + @Nullable StepKeywordType keywordType, String text, - DocString docString, - DataTable dataTable, + @Nullable DocString docString, + @Nullable DataTable dataTable, String id ) { this.location = requireNonNull(location, "Step.location cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/StepDefinition.java b/java/src/generated/java/io/cucumber/messages/types/StepDefinition.java index 0fe8976b..fe53dadd 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepDefinition.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepDefinition.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the StepDefinition message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class StepDefinition { private final String id; private final StepDefinitionPattern pattern; diff --git a/java/src/generated/java/io/cucumber/messages/types/StepDefinitionPattern.java b/java/src/generated/java/io/cucumber/messages/types/StepDefinitionPattern.java index 5464e397..74ce9cf5 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepDefinitionPattern.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepDefinitionPattern.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the StepDefinitionPattern message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class StepDefinitionPattern { private final String source; private final StepDefinitionPatternType type; diff --git a/java/src/generated/java/io/cucumber/messages/types/StepMatchArgument.java b/java/src/generated/java/io/cucumber/messages/types/StepMatchArgument.java index 89ac5af0..e8787abb 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepMatchArgument.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepMatchArgument.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -18,14 +19,14 @@ * This message closely matches the `Argument` class in the `cucumber-expressions` library. */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class StepMatchArgument { private final Group group; - private final String parameterTypeName; + private final @Nullable String parameterTypeName; public StepMatchArgument( Group group, - String parameterTypeName + @Nullable String parameterTypeName ) { this.group = requireNonNull(group, "StepMatchArgument.group cannot be null"); this.parameterTypeName = parameterTypeName; diff --git a/java/src/generated/java/io/cucumber/messages/types/StepMatchArgumentsList.java b/java/src/generated/java/io/cucumber/messages/types/StepMatchArgumentsList.java index 2d4d99c6..dee66b89 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepMatchArgumentsList.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepMatchArgumentsList.java @@ -1,27 +1,28 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the StepMatchArgumentsList message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class StepMatchArgumentsList { - private final java.util.List stepMatchArguments; + private final List stepMatchArguments; public StepMatchArgumentsList( - java.util.List stepMatchArguments + List stepMatchArguments ) { - this.stepMatchArguments = unmodifiableList(new ArrayList<>(requireNonNull(stepMatchArguments, "StepMatchArgumentsList.stepMatchArguments cannot be null"))); + this.stepMatchArguments = List.copyOf(requireNonNull(stepMatchArguments, "StepMatchArgumentsList.stepMatchArguments cannot be null")); } - public java.util.List getStepMatchArguments() { + public List getStepMatchArguments() { return stepMatchArguments; } diff --git a/java/src/generated/java/io/cucumber/messages/types/Suggestion.java b/java/src/generated/java/io/cucumber/messages/types/Suggestion.java index 50277c06..e0037e40 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Suggestion.java +++ b/java/src/generated/java/io/cucumber/messages/types/Suggestion.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,20 +14,20 @@ * A suggested fragment of code to implement an undefined step */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Suggestion { private final String id; private final String pickleStepId; - private final java.util.List snippets; + private final List snippets; public Suggestion( String id, String pickleStepId, - java.util.List snippets + List snippets ) { this.id = requireNonNull(id, "Suggestion.id cannot be null"); this.pickleStepId = requireNonNull(pickleStepId, "Suggestion.pickleStepId cannot be null"); - this.snippets = unmodifiableList(new ArrayList<>(requireNonNull(snippets, "Suggestion.snippets cannot be null"))); + this.snippets = List.copyOf(requireNonNull(snippets, "Suggestion.snippets cannot be null")); } /** @@ -46,7 +47,7 @@ public String getPickleStepId() { /** * A collection of code snippets that could implement the undefined step */ - public java.util.List getSnippets() { + public List getSnippets() { return snippets; } diff --git a/java/src/generated/java/io/cucumber/messages/types/TableCell.java b/java/src/generated/java/io/cucumber/messages/types/TableCell.java index 1a15df7e..6d0a7cae 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TableCell.java +++ b/java/src/generated/java/io/cucumber/messages/types/TableCell.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,7 +14,7 @@ * A cell in a `TableRow` */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TableCell { private final Location location; private final String value; diff --git a/java/src/generated/java/io/cucumber/messages/types/TableRow.java b/java/src/generated/java/io/cucumber/messages/types/TableRow.java index 731a300b..8739e416 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TableRow.java +++ b/java/src/generated/java/io/cucumber/messages/types/TableRow.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,19 +14,19 @@ * A row in a table */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TableRow { private final Location location; - private final java.util.List cells; + private final List cells; private final String id; public TableRow( Location location, - java.util.List cells, + List cells, String id ) { this.location = requireNonNull(location, "TableRow.location cannot be null"); - this.cells = unmodifiableList(new ArrayList<>(requireNonNull(cells, "TableRow.cells cannot be null"))); + this.cells = List.copyOf(requireNonNull(cells, "TableRow.cells cannot be null")); this.id = requireNonNull(id, "TableRow.id cannot be null"); } @@ -39,7 +40,7 @@ public Location getLocation() { /** * Cells in the row */ - public java.util.List getCells() { + public List getCells() { return cells; } diff --git a/java/src/generated/java/io/cucumber/messages/types/Tag.java b/java/src/generated/java/io/cucumber/messages/types/Tag.java index 6848068c..302c1618 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Tag.java +++ b/java/src/generated/java/io/cucumber/messages/types/Tag.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,7 +14,7 @@ * A tag */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Tag { private final Location location; private final String name; diff --git a/java/src/generated/java/io/cucumber/messages/types/TestCase.java b/java/src/generated/java/io/cucumber/messages/types/TestCase.java index 59e7e783..ffe16ecd 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCase.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCase.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -13,22 +14,22 @@ * A `TestCase` contains a sequence of `TestStep`s. */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestCase { private final String id; private final String pickleId; - private final java.util.List testSteps; - private final String testRunStartedId; + private final List testSteps; + private final @Nullable String testRunStartedId; public TestCase( String id, String pickleId, - java.util.List testSteps, - String testRunStartedId + List testSteps, + @Nullable String testRunStartedId ) { this.id = requireNonNull(id, "TestCase.id cannot be null"); this.pickleId = requireNonNull(pickleId, "TestCase.pickleId cannot be null"); - this.testSteps = unmodifiableList(new ArrayList<>(requireNonNull(testSteps, "TestCase.testSteps cannot be null"))); + this.testSteps = List.copyOf(requireNonNull(testSteps, "TestCase.testSteps cannot be null")); this.testRunStartedId = testRunStartedId; } @@ -43,7 +44,7 @@ public String getPickleId() { return pickleId; } - public java.util.List getTestSteps() { + public List getTestSteps() { return testSteps; } diff --git a/java/src/generated/java/io/cucumber/messages/types/TestCaseFinished.java b/java/src/generated/java/io/cucumber/messages/types/TestCaseFinished.java index 2d1255da..d7e37771 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCaseFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCaseFinished.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the TestCaseFinished message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestCaseFinished { private final String testCaseStartedId; private final Timestamp timestamp; diff --git a/java/src/generated/java/io/cucumber/messages/types/TestCaseStarted.java b/java/src/generated/java/io/cucumber/messages/types/TestCaseStarted.java index de4bddee..51492528 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCaseStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCaseStarted.java @@ -1,29 +1,30 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the TestCaseStarted message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestCaseStarted { private final Long attempt; private final String id; private final String testCaseId; - private final String workerId; + private final @Nullable String workerId; private final Timestamp timestamp; public TestCaseStarted( Long attempt, String id, String testCaseId, - String workerId, + @Nullable String workerId, Timestamp timestamp ) { this.attempt = requireNonNull(attempt, "TestCaseStarted.attempt cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java b/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java index 6dbed4ed..5cfbd3d5 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java @@ -1,30 +1,31 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the TestRunFinished message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestRunFinished { - private final String message; + private final @Nullable String message; private final Boolean success; private final Timestamp timestamp; - private final Exception exception; - private final String testRunStartedId; + private final @Nullable Exception exception; + private final @Nullable String testRunStartedId; public TestRunFinished( - String message, + @Nullable String message, Boolean success, Timestamp timestamp, - Exception exception, - String testRunStartedId + @Nullable Exception exception, + @Nullable String testRunStartedId ) { this.message = message; this.success = requireNonNull(success, "TestRunFinished.success cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/TestRunHookFinished.java b/java/src/generated/java/io/cucumber/messages/types/TestRunHookFinished.java index e016428d..7f43fef8 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunHookFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunHookFinished.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the TestRunHookFinished message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestRunHookFinished { private final String testRunHookStartedId; private final TestStepResult result; diff --git a/java/src/generated/java/io/cucumber/messages/types/TestRunHookStarted.java b/java/src/generated/java/io/cucumber/messages/types/TestRunHookStarted.java index f2068d12..7cfe193b 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunHookStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunHookStarted.java @@ -1,29 +1,30 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the TestRunHookStarted message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestRunHookStarted { private final String id; private final String testRunStartedId; private final String hookId; - private final String workerId; + private final @Nullable String workerId; private final Timestamp timestamp; public TestRunHookStarted( String id, String testRunStartedId, String hookId, - String workerId, + @Nullable String workerId, Timestamp timestamp ) { this.id = requireNonNull(id, "TestRunHookStarted.id cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java b/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java index 8406acba..bd3566e8 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java @@ -1,24 +1,25 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the TestRunStarted message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestRunStarted { private final Timestamp timestamp; - private final String id; + private final @Nullable String id; public TestRunStarted( Timestamp timestamp, - String id + @Nullable String id ) { this.timestamp = requireNonNull(timestamp, "TestRunStarted.timestamp cannot be null"); this.id = id; diff --git a/java/src/generated/java/io/cucumber/messages/types/TestStep.java b/java/src/generated/java/io/cucumber/messages/types/TestStep.java index de20a1a0..a7d5ba9b 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStep.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStep.java @@ -1,10 +1,11 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -17,26 +18,26 @@ * * For `AMBIGUOUS` steps, there will be multiple entries in `stepDefinitionIds` and `stepMatchArgumentsLists`. The first entry in the stepMatchArgumentsLists holds the list of arguments for the first matching step definition, the second entry for the second, etc */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestStep { - private final String hookId; + private final @Nullable String hookId; private final String id; - private final String pickleStepId; - private final java.util.List stepDefinitionIds; - private final java.util.List stepMatchArgumentsLists; + private final @Nullable String pickleStepId; + private final @Nullable List stepDefinitionIds; + private final @Nullable List stepMatchArgumentsLists; public TestStep( - String hookId, + @Nullable String hookId, String id, - String pickleStepId, - java.util.List stepDefinitionIds, - java.util.List stepMatchArgumentsLists + @Nullable String pickleStepId, + @Nullable List stepDefinitionIds, + @Nullable List stepMatchArgumentsLists ) { this.hookId = hookId; this.id = requireNonNull(id, "TestStep.id cannot be null"); this.pickleStepId = pickleStepId; - this.stepDefinitionIds = stepDefinitionIds == null ? null : unmodifiableList(new ArrayList<>(stepDefinitionIds)); - this.stepMatchArgumentsLists = stepMatchArgumentsLists == null ? null : unmodifiableList(new ArrayList<>(stepMatchArgumentsLists)); + this.stepDefinitionIds = stepDefinitionIds == null ? null : List.copyOf(stepDefinitionIds); + this.stepMatchArgumentsLists = stepMatchArgumentsLists == null ? null : List.copyOf(stepMatchArgumentsLists); } /** @@ -62,7 +63,7 @@ public Optional getPickleStepId() { *

* Each element represents a matching step definition. */ - public Optional> getStepDefinitionIds() { + public Optional> getStepDefinitionIds() { return Optional.ofNullable(stepDefinitionIds); } @@ -71,7 +72,7 @@ public Optional> getStepDefinitionIds() { *

* Each element represents the arguments for a matching step definition. */ - public Optional> getStepMatchArgumentsLists() { + public Optional> getStepMatchArgumentsLists() { return Optional.ofNullable(stepMatchArgumentsLists); } diff --git a/java/src/generated/java/io/cucumber/messages/types/TestStepFinished.java b/java/src/generated/java/io/cucumber/messages/types/TestStepFinished.java index b4937c3e..f9b4f733 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStepFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStepFinished.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the TestStepFinished message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestStepFinished { private final String testCaseStartedId; private final String testStepId; diff --git a/java/src/generated/java/io/cucumber/messages/types/TestStepResult.java b/java/src/generated/java/io/cucumber/messages/types/TestStepResult.java index 0bcdbfd9..87579828 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStepResult.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStepResult.java @@ -1,28 +1,29 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the TestStepResult message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestStepResult { private final Duration duration; - private final String message; + private final @Nullable String message; private final TestStepResultStatus status; - private final Exception exception; + private final @Nullable Exception exception; public TestStepResult( Duration duration, - String message, + @Nullable String message, TestStepResultStatus status, - Exception exception + @Nullable Exception exception ) { this.duration = requireNonNull(duration, "TestStepResult.duration cannot be null"); this.message = message; diff --git a/java/src/generated/java/io/cucumber/messages/types/TestStepStarted.java b/java/src/generated/java/io/cucumber/messages/types/TestStepStarted.java index bad56760..15f4c4ca 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStepStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStepStarted.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the TestStepStarted message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestStepStarted { private final String testCaseStartedId; private final String testStepId; diff --git a/java/src/generated/java/io/cucumber/messages/types/Timestamp.java b/java/src/generated/java/io/cucumber/messages/types/Timestamp.java index 7a550315..38d05fb9 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Timestamp.java +++ b/java/src/generated/java/io/cucumber/messages/types/Timestamp.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the Timestamp message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Timestamp { private final Long seconds; private final Long nanos; diff --git a/java/src/generated/java/io/cucumber/messages/types/UndefinedParameterType.java b/java/src/generated/java/io/cucumber/messages/types/UndefinedParameterType.java index e0e962c7..5bbd51b5 100644 --- a/java/src/generated/java/io/cucumber/messages/types/UndefinedParameterType.java +++ b/java/src/generated/java/io/cucumber/messages/types/UndefinedParameterType.java @@ -1,17 +1,18 @@ package io.cucumber.messages.types; -import java.util.ArrayList; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * Represents the UndefinedParameterType message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class UndefinedParameterType { private final String expression; private final String name; diff --git a/java/src/main/java/io/cucumber/messages/NdjsonToMessageIterable.java b/java/src/main/java/io/cucumber/messages/NdjsonToMessageIterable.java index eeb5e3c0..c4bcc33a 100644 --- a/java/src/main/java/io/cucumber/messages/NdjsonToMessageIterable.java +++ b/java/src/main/java/io/cucumber/messages/NdjsonToMessageIterable.java @@ -1,6 +1,7 @@ package io.cucumber.messages; import io.cucumber.messages.types.Envelope; +import org.jspecify.annotations.Nullable; import java.io.BufferedReader; import java.io.IOException; @@ -41,8 +42,8 @@ private NdjsonToMessageIterable(BufferedReader reader, Deserializer deserializer @Override public Iterator iterator() { - return new Iterator() { - private Envelope next; + return new Iterator<>() { + private @Nullable Envelope next; @Override public boolean hasNext() { @@ -50,7 +51,7 @@ public boolean hasNext() { String line = reader.readLine(); if (line == null) return false; - if (line.trim().equals("")) { + if (line.trim().isEmpty()) { return hasNext(); } try { diff --git a/java/src/main/java/io/cucumber/messages/TestStepResultStatusComparator.java b/java/src/main/java/io/cucumber/messages/TestStepResultStatusComparator.java index d9bf8b15..223411e9 100644 --- a/java/src/main/java/io/cucumber/messages/TestStepResultStatusComparator.java +++ b/java/src/main/java/io/cucumber/messages/TestStepResultStatusComparator.java @@ -7,6 +7,7 @@ /** * Orders test step results from least to most severe. */ +@SuppressWarnings("EnumOrdinal") public final class TestStepResultStatusComparator implements Comparator { @Override public int compare(TestStepResultStatus a, TestStepResultStatus b) { diff --git a/java/src/main/java/io/cucumber/messages/package-info.java b/java/src/main/java/io/cucumber/messages/package-info.java new file mode 100644 index 00000000..07ecc506 --- /dev/null +++ b/java/src/main/java/io/cucumber/messages/package-info.java @@ -0,0 +1,4 @@ +@NullMarked +package io.cucumber.messages; + +import org.jspecify.annotations.NullMarked; \ No newline at end of file diff --git a/java/src/main/java/io/cucumber/messages/types/package-info.java b/java/src/main/java/io/cucumber/messages/types/package-info.java new file mode 100644 index 00000000..891ab52c --- /dev/null +++ b/java/src/main/java/io/cucumber/messages/types/package-info.java @@ -0,0 +1,4 @@ +@NullMarked +package io.cucumber.messages.types; + +import org.jspecify.annotations.NullMarked; \ No newline at end of file diff --git a/java/src/test/java/io/cucumber/messages/MessagesTest.java b/java/src/test/java/io/cucumber/messages/MessagesTest.java index cd47a0d9..1a67432d 100644 --- a/java/src/test/java/io/cucumber/messages/MessagesTest.java +++ b/java/src/test/java/io/cucumber/messages/MessagesTest.java @@ -8,6 +8,7 @@ public class MessagesTest { @Test + @SuppressWarnings("NullAway") void is_invalid_when_required_fields_are_missing() { assertThrows(NullPointerException.class, () -> { new Attachment(null, null, null, null, null, null, null, null, null, null, null);