diff --git a/codegen/generators/base.rb b/codegen/generators/base.rb index 9f9a8468..5a0cc2c7 100644 --- a/codegen/generators/base.rb +++ b/codegen/generators/base.rb @@ -105,25 +105,23 @@ def property_type_from_ref(ref) class_name(ref) end - def property_type_from_type(parent_type_name, property_name, property, type:) + def property_type_from_type(parent_type_name, property_name, property) + type = property['type'] return array_type_for(type_for(parent_type_name, nil, property['items'])) if type == 'array' + return property_type_from_enum(enum_name(parent_type_name, property_name, property['enum'])) if property['enum'] - unless language_translations_for_data_types.key?(type) + property = select_language_translations_for_data_types(type, property) + unless property raise "No type mapping for JSONSchema type #{type}. Schema:\n#{JSON.pretty_generate(property)}" end - - if property['enum'] - property_type_from_enum(enum_name(parent_type_name, property_name, property['enum'])) - else - language_translations_for_data_types.fetch(type) - end + property end def type_for(parent_type_name, property_name, property) if property['$ref'] property_type_from_ref(property['$ref']) elsif property['type'] - property_type_from_type(parent_type_name, property_name, property, type: property['type']) + property_type_from_type(parent_type_name, property_name, property) else # Inline schema (not supported) raise "Property #{property_name} did not define 'type' or '$ref'" diff --git a/codegen/generators/cpp.rb b/codegen/generators/cpp.rb index cb80a86f..e201d945 100644 --- a/codegen/generators/cpp.rb +++ b/codegen/generators/cpp.rb @@ -21,12 +21,12 @@ def format_description(raw_description, indent_string: '') private - def language_translations_for_data_types + def select_language_translations_for_data_types(type, property) { 'integer' => 'std::size_t', 'string' => 'std::string', 'boolean' => 'bool' - } + }[type] end end end diff --git a/codegen/generators/dotnet.rb b/codegen/generators/dotnet.rb index 1e164c55..10af3cf7 100644 --- a/codegen/generators/dotnet.rb +++ b/codegen/generators/dotnet.rb @@ -21,12 +21,12 @@ def format_description(raw_description, indent_string: '') private - def language_translations_for_data_types + def select_language_translations_for_data_types(type, property) { 'integer' => 'long', 'string' => 'string', 'boolean' => 'bool' - } + }[type] end end end diff --git a/codegen/generators/go.rb b/codegen/generators/go.rb index 659d2b49..de899650 100644 --- a/codegen/generators/go.rb +++ b/codegen/generators/go.rb @@ -14,12 +14,12 @@ def property_type_from_ref(ref) private - def language_translations_for_data_types + def select_language_translations_for_data_types(type, property) { 'integer' => 'int64', 'string' => 'string', 'boolean' => 'bool' - } + }[type] end end end diff --git a/codegen/generators/java.rb b/codegen/generators/java.rb index 8c7ee3f4..806798e6 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: '') @@ -23,12 +23,20 @@ def format_description(raw_description, indent_string: '') private - def language_translations_for_data_types - { - 'integer' => 'Long', - 'string' => 'String', - 'boolean' => 'Boolean' - } + def select_language_translations_for_data_types(type, property) + if type == 'integer' + if property['maximum'] and property['maximum'] <= 2147483647 + 'Integer' + else + 'Long' + end + elsif type == 'string' + 'String' + elsif type == 'boolean' + 'Boolean' + else + nil + end end end end diff --git a/codegen/generators/markdown.rb b/codegen/generators/markdown.rb index f7389e25..d4cbe553 100644 --- a/codegen/generators/markdown.rb +++ b/codegen/generators/markdown.rb @@ -20,12 +20,12 @@ def property_type_from_ref(ref) private - def language_translations_for_data_types + def select_language_translations_for_data_types(type, property) { 'integer' => 'integer', 'string' => 'string', 'boolean' => 'boolean' - } + }[type] end end end diff --git a/codegen/generators/perl.rb b/codegen/generators/perl.rb index ff38bc58..11a59ae5 100644 --- a/codegen/generators/perl.rb +++ b/codegen/generators/perl.rb @@ -39,12 +39,12 @@ def default_value_for_string(property_name, enum) end end - def language_translations_for_data_types + def select_language_translations_for_data_types(type, property) { 'integer' => 'number', 'string' => 'string', 'boolean' => 'boolean' - } + }[type] end end end diff --git a/codegen/generators/php.rb b/codegen/generators/php.rb index 83984775..08bf852b 100644 --- a/codegen/generators/php.rb +++ b/codegen/generators/php.rb @@ -53,11 +53,11 @@ def nullable?(property_name, schema) end def scalar?(property) - property.key?('type') && language_translations_for_data_types.key?(property['type']) + property.key?('type') && select_language_translations_for_data_types(property['type'], property) end def scalar_type_for(property) - language_translations_for_data_types[property['type']] + select_language_translations_for_data_types(property['type'], property) end private @@ -68,12 +68,12 @@ def default_value(class_name, property_name, property, schema) super(class_name, property_name, property) end - def language_translations_for_data_types + def select_language_translations_for_data_types(type, property) { 'string' => 'string', 'integer' => 'int', 'boolean' => 'bool' - } + }[type] end def non_nullable_non_scalar_constructor(parent_type, property, property_name, schema, source) diff --git a/codegen/generators/python.rb b/codegen/generators/python.rb index ccb6a727..54257ba8 100644 --- a/codegen/generators/python.rb +++ b/codegen/generators/python.rb @@ -63,6 +63,12 @@ def format_description(raw_description, indent_string: ' ') %("""\n#{lines.join("\n")}\n#{indent_string}""") end + def select_language_translations_for_data_types(type, property) + language_translations_for_data_types[type] + end + + private + def language_translations_for_data_types { 'integer' => 'int', @@ -71,9 +77,7 @@ def language_translations_for_data_types 'array' => 'list' } end - - private - + def default_value(parent_type_name, property_name, property) if property['type'] == 'string' default_value_for_string(parent_type_name, property_name, property) @@ -109,10 +113,6 @@ def enum_name(parent_type_name, property_name, enum) end end - def property_type_from_ref(ref) - class_name(ref) - end - def class_name(ref) return ref if language_translations_for_data_types.values.include?(ref) diff --git a/codegen/generators/ruby.rb b/codegen/generators/ruby.rb index 59d99bfa..86f642c9 100644 --- a/codegen/generators/ruby.rb +++ b/codegen/generators/ruby.rb @@ -39,12 +39,12 @@ def default_value_for_string(parent_type_name, property_name, property) end end - def language_translations_for_data_types + def select_language_translations_for_data_types(type, property) { 'integer' => 'number', 'string' => 'string', 'boolean' => 'boolean' - } + }[type] end def line_as_comment(line) diff --git a/codegen/generators/typescript.rb b/codegen/generators/typescript.rb index a46c241f..da58dd02 100644 --- a/codegen/generators/typescript.rb +++ b/codegen/generators/typescript.rb @@ -10,12 +10,12 @@ def array_type_for(type_name) private - def language_translations_for_data_types + def select_language_translations_for_data_types(type, property) { 'integer' => 'number', 'string' => 'string', 'boolean' => 'boolean' - } + }[type] end end end diff --git a/codegen/templates/java.java.erb b/codegen/templates/java.java.erb index b29cf83b..8f8e1513 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 -%> @@ -81,7 +86,7 @@ public final class <%= class_name(key) %> { <%- unless (property['description'] || []).empty? -%> /** - <%= format_description(property['description'], indent_string: ' ') %> + <%= format_description(property['description'], indent_string: ' ') %> */ <%- end -%> public Optional<<%= type_for(class_name(key), property_name, property) -%>> get<%= capitalize(property_name) %>() { diff --git a/cpp/include/messages/cucumber/messages/pickle.hpp b/cpp/include/messages/cucumber/messages/pickle.hpp index 81776aab..28d1d07c 100644 --- a/cpp/include/messages/cucumber/messages/pickle.hpp +++ b/cpp/include/messages/cucumber/messages/pickle.hpp @@ -6,6 +6,7 @@ #include +#include #include #include @@ -34,6 +35,7 @@ struct pickle { std::string id; std::string uri; + std::optional location; std::string name; std::string language; std::vector steps; diff --git a/cpp/src/lib/messages/cucumber/messages/pickle.cpp b/cpp/src/lib/messages/cucumber/messages/pickle.cpp index e8fd1896..85f39d00 100644 --- a/cpp/src/lib/messages/cucumber/messages/pickle.cpp +++ b/cpp/src/lib/messages/cucumber/messages/pickle.cpp @@ -12,6 +12,7 @@ pickle::to_string() const cucumber::messages::to_string(oss, "id=", id); cucumber::messages::to_string(oss, ", uri=", uri); + cucumber::messages::to_string(oss, ", location=", location); cucumber::messages::to_string(oss, ", name=", name); cucumber::messages::to_string(oss, ", language=", language); cucumber::messages::to_string(oss, ", steps=", steps); @@ -26,6 +27,7 @@ pickle::to_json(json& j) const { cucumber::messages::to_json(j, camelize("id"), id); cucumber::messages::to_json(j, camelize("uri"), uri); + cucumber::messages::to_json(j, camelize("location"), location); cucumber::messages::to_json(j, camelize("name"), name); cucumber::messages::to_json(j, camelize("language"), language); cucumber::messages::to_json(j, camelize("steps"), steps); diff --git a/dotnet/Cucumber.Messages/generated/Pickle.cs b/dotnet/Cucumber.Messages/generated/Pickle.cs index 7373bbf9..9e5dcffc 100644 --- a/dotnet/Cucumber.Messages/generated/Pickle.cs +++ b/dotnet/Cucumber.Messages/generated/Pickle.cs @@ -35,6 +35,10 @@ public sealed class Pickle * The uri of the source file */ public string Uri { get; private set; } + /** + * The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. + */ + public Location Location { get; private set; } /** * The name of the pickle */ @@ -63,6 +67,7 @@ public sealed class Pickle public Pickle( string id, string uri, + Location location, string name, string language, List steps, @@ -74,6 +79,7 @@ List astNodeIds this.Id = id; RequireNonNull(uri, "Uri", "Pickle.Uri cannot be null"); this.Uri = uri; + this.Location = location; RequireNonNull(name, "Name", "Pickle.Name cannot be null"); this.Name = name; RequireNonNull(language, "Language", "Pickle.Language cannot be null"); @@ -94,6 +100,7 @@ public override bool Equals(Object o) return Id.Equals(that.Id) && Uri.Equals(that.Uri) && + Object.Equals(Location, that.Location) && Name.Equals(that.Name) && Language.Equals(that.Language) && Steps.Equals(that.Steps) && @@ -108,6 +115,8 @@ public override int GetHashCode() hash = hash * 31 + Id.GetHashCode(); if (Uri != null) hash = hash * 31 + Uri.GetHashCode(); + if (Location != null) + hash = hash * 31 + Location.GetHashCode(); if (Name != null) hash = hash * 31 + Name.GetHashCode(); if (Language != null) @@ -126,6 +135,7 @@ public override string ToString() return "Pickle{" + "id=" + Id + ", uri=" + Uri + + ", location=" + Location + ", name=" + Name + ", language=" + Language + ", steps=" + Steps + diff --git a/go/messages.go b/go/messages.go index eb28b944..63423371 100644 --- a/go/messages.go +++ b/go/messages.go @@ -218,6 +218,7 @@ type ParseError struct { type Pickle struct { Id string `json:"id"` Uri string `json:"uri"` + Location *Location `json:"location,omitempty"` Name string `json:"name"` Language string `json:"language"` Steps []*PickleStep `json:"steps"` diff --git a/java/.mvn/jvm.config b/java/.mvn/jvm.config new file mode 100644 index 00000000..32599cef --- /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 diff --git a/java/checkstyle-suppressions.xml b/java/checkstyle-suppressions.xml new file mode 100644 index 00000000..cbd3ba35 --- /dev/null +++ b/java/checkstyle-suppressions.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/java/pom.xml b/java/pom.xml index 0cce08e0..5d5af6f3 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -5,10 +5,10 @@ io.cucumber cucumber-parent - 4.5.0 + 5.0.0-SNAPSHOT messages - 30.1.1-SNAPSHOT + 31.0.0-SNAPSHOT jar Cucumber Messages JSON schema-based messages for Cucumber's inter-process communication @@ -53,6 +53,13 @@ + + + org.jspecify + jspecify + 1.0.0 + + com.fasterxml.jackson.core jackson-databind @@ -93,14 +100,6 @@ - - org.apache.maven.plugins - maven-resources-plugin - - UTF-8 - - - biz.aQute.bnd bnd-maven-plugin @@ -134,10 +133,19 @@ org.apache.maven.plugins - maven-compiler-plugin - - true - + maven-checkstyle-plugin + + + validate + validate + + check + + + checkstyle-suppressions.xml + + + org.apache.maven.plugins 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..fe0388ef 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"); @@ -87,7 +88,7 @@ public AttachmentContentEncoding getContentEncoding() { } /** - * Suggested file name of the attachment. (Provided by the user as an argument to `attach`) + * Suggested file name of the attachment. (Provided by the user as an argument to `attach`) */ public Optional getFileName() { return Optional.ofNullable(fileName); @@ -108,21 +109,21 @@ public Optional getSource() { } /** - * The identifier of the test case attempt if the attachment was created during the execution of a test step + * The identifier of the test case attempt if the attachment was created during the execution of a test step */ public Optional getTestCaseStartedId() { return Optional.ofNullable(testCaseStartedId); } /** - * The identifier of the test step if the attachment was created during the execution of a test step + * The identifier of the test step if the attachment was created during the execution of a test step */ public Optional getTestStepId() { return Optional.ofNullable(testStepId); } /** - * A URL where the attachment can be retrieved. This field should not be set by Cucumber. + * A URL where the attachment can be retrieved. This field should not be set by Cucumber. * It should be set by a program that reads a message stream and does the following for * each Attachment message: *

@@ -139,21 +140,21 @@ public Optional getUrl() { } /** - * Not used; implementers should instead populate `testRunHookStartedId` if an attachment was created during the execution of a test run hook + * Not used; implementers should instead populate `testRunHookStartedId` if an attachment was created during the execution of a test run hook */ public Optional getTestRunStartedId() { return Optional.ofNullable(testRunStartedId); } /** - * The identifier of the test run hook execution if the attachment was created during the execution of a test run hook + * The identifier of the test run hook execution if the attachment was created during the execution of a test run hook */ public Optional getTestRunHookStartedId() { return Optional.ofNullable(testRunHookStartedId); } /** - * When the attachment was created + * When the attachment was created */ public Optional getTimestamp() { return Optional.ofNullable(timestamp); 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..0f5740e7 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; @@ -40,14 +41,14 @@ public String getName() { } /** - * Link to the build + * Link to the build */ public Optional getUrl() { return Optional.ofNullable(url); } /** - * The build number. Some CI servers use non-numeric build numbers, which is why this is a string + * The build number. Some CI servers use non-numeric build numbers, which is why this is a string */ public Optional getBuildNumber() { return Optional.ofNullable(buildNumber); 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..bc244f86 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,14 +15,14 @@ * of message is used. */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Duration { private final Long seconds; - private final Long nanos; + private final Integer nanos; public Duration( Long seconds, - Long nanos + Integer nanos ) { this.seconds = requireNonNull(seconds, "Duration.seconds cannot be null"); this.nanos = requireNonNull(nanos, "Duration.nanos cannot be null"); @@ -37,7 +38,7 @@ public Long getSeconds() { * that count forward in time. Must be from 0 to 999,999,999 * inclusive. */ - public Long getNanos() { + public Integer getNanos() { return 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..f5118b58 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; @@ -37,14 +38,14 @@ public String getType() { } /** - * The message of exception that caused this result. E.g. expected: "a" but was: "b" + * The message of exception that caused this result. E.g. expected: "a" but was: "b" */ public Optional getMessage() { return Optional.ofNullable(message); } /** - * The stringified stack trace of the exception that caused this result + * The stringified stack trace of the exception that caused this result */ public Optional getStackTrace() { return Optional.ofNullable(stackTrace); 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..9c081af0 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,24 +19,24 @@ * "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")); } /** - * The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier) + * The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier) * of the source, typically a file path relative to the root directory */ public Optional getUri() { @@ -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..43f66aef 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Group.java +++ b/java/src/generated/java/io/cucumber/messages/types/Group.java @@ -1,37 +1,38 @@ 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 Integer start; + private final @Nullable String value; public Group( - java.util.List children, - Long start, - String value + List children, + @Nullable Integer 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; } - public Optional getStart() { + public Optional getStart() { return Optional.ofNullable(start); } 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..684cebf2 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,24 +14,24 @@ * 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 Integer line; + private final @Nullable Integer column; public Location( - Long line, - Long column + Integer line, + @Nullable Integer column ) { this.line = requireNonNull(line, "Location.line cannot be null"); this.column = column; } - public Long getLine() { + public Integer getLine() { return line; } - public Optional getColumn() { + public Optional getColumn() { return Optional.ofNullable(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..bfc5ef28 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,35 @@ * 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 @Nullable Location location; 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, + @Nullable Location location, 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.location = location; 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")); } /** @@ -64,6 +68,13 @@ public String getUri() { return uri; } + /** + * The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. + */ + public Optional getLocation() { + return Optional.ofNullable(location); + } + /** * The name of the pickle */ @@ -81,7 +92,7 @@ public String getLanguage() { /** * One or more steps */ - public java.util.List getSteps() { + public List getSteps() { return steps; } @@ -89,7 +100,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 +109,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; } @@ -110,6 +121,7 @@ public boolean equals(Object o) { return id.equals(that.id) && uri.equals(that.uri) && + Objects.equals(location, that.location) && name.equals(that.name) && language.equals(that.language) && steps.equals(that.steps) && @@ -122,6 +134,7 @@ public int hashCode() { return Objects.hash( id, uri, + location, name, language, steps, @@ -135,6 +148,7 @@ public String toString() { return "Pickle{" + "id=" + id + ", uri=" + uri + + ", location=" + location + ", name=" + name + ", language=" + language + ", steps=" + steps + 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..c9925ca2 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; } @@ -55,7 +56,7 @@ public String getId() { } /** - * The context in which the step was specified: context (Given), action (When) or outcome (Then). + * The context in which the step was specified: context (Given), action (When) or outcome (Then). *

* Note that the keywords `But` and `And` inherit their meaning from prior steps and the `*` 'keyword' doesn't have specific meaning (hence Unknown) */ 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..812c6940 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; @@ -34,7 +35,7 @@ public String getName() { } /** - * The product version + * The product version */ public Optional getVersion() { return Optional.ofNullable(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..201d88b3 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"); @@ -56,7 +57,7 @@ public String getKeyword() { } /** - * The test phase signalled by the keyword: Context definition (Given), Action performance (When), Outcome assertion (Then). Other keywords signal Continuation (And and But) from a prior keyword. Please note that all translations which a dialect maps to multiple keywords (`*` is in this category for all dialects), map to 'Unknown'. + * The test phase signalled by the keyword: Context definition (Given), Action performance (When), Outcome assertion (Then). Other keywords signal Continuation (And and But) from a prior keyword. Please note that all translations which a dialect maps to multiple keywords (`*` is in this category for all dialects), map to 'Unknown'. */ public Optional getKeywordType() { return Optional.ofNullable(keywordType); 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..946af5d2 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,12 +44,12 @@ public String getPickleId() { return pickleId; } - public java.util.List getTestSteps() { + public List getTestSteps() { return testSteps; } /** - * Identifier for the test run that this test case belongs to + * Identifier for the test run that this test case belongs to */ public Optional getTestRunStartedId() { return Optional.ofNullable(testRunStartedId); 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..3ba5ad2b 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"); @@ -54,7 +55,7 @@ public String getTestCaseId() { } /** - * An identifier for the worker process running this test case, if test cases are being run in parallel. The identifier will be unique per worker, but no particular format is defined - it could be an index, uuid, machine name etc - and as such should be assumed that it's not human readable. + * An identifier for the worker process running this test case, if test cases are being run in parallel. The identifier will be unique per worker, but no particular format is defined - it could be an index, uuid, machine name etc - and as such should be assumed that it's not human readable. */ public Optional getWorkerId() { return Optional.ofNullable(workerId); 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..c72674b4 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"); @@ -34,7 +35,7 @@ public TestRunFinished( } /** - * An informative message about the test run. Typically additional information about failure, but not necessarily. + * An informative message about the test run. Typically additional information about failure, but not necessarily. */ public Optional getMessage() { return Optional.ofNullable(message); @@ -55,7 +56,7 @@ public Timestamp getTimestamp() { } /** - * Any exception thrown during the test run, if any. Does not include exceptions thrown while executing steps. + * Any exception thrown during the test run, if any. Does not include exceptions thrown while executing steps. */ public Optional getException() { return Optional.ofNullable(exception); 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..e7f874b7 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"); @@ -55,7 +56,7 @@ public String getHookId() { } /** - * An identifier for the worker process running this hook, if parallel workers are in use. The identifier will be unique per worker, but no particular format is defined - it could be an index, uuid, machine name etc - and as such should be assumed that it's not human readable. + * An identifier for the worker process running this hook, if parallel workers are in use. The identifier will be unique per worker, but no particular format is defined - it could be an index, uuid, machine name etc - and as such should be assumed that it's not human readable. */ public Optional getWorkerId() { return Optional.ofNullable(workerId); 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..afebe4f8 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,30 +18,30 @@ * * 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); } /** - * Pointer to the `Hook` (if derived from a Hook) + * Pointer to the `Hook` (if derived from a Hook) */ public Optional getHookId() { return Optional.ofNullable(hookId); @@ -51,27 +52,27 @@ public String getId() { } /** - * Pointer to the `PickleStep` (if derived from a `PickleStep`) + * Pointer to the `PickleStep` (if derived from a `PickleStep`) */ public Optional getPickleStepId() { return Optional.ofNullable(pickleStepId); } /** - * Pointer to all the matching `StepDefinition`s (if derived from a `PickleStep`). + * Pointer to all the matching `StepDefinition`s (if derived from a `PickleStep`). *

* Each element represents a matching step definition. */ - public Optional> getStepDefinitionIds() { + public Optional> getStepDefinitionIds() { return Optional.ofNullable(stepDefinitionIds); } /** - * A list of list of StepMatchArgument (if derived from a `PickleStep`). + * A list of list of StepMatchArgument (if derived from a `PickleStep`). *

* 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..3f0fbf0a 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; @@ -35,7 +36,7 @@ public Duration getDuration() { } /** - * An arbitrary bit of information that explains this result. If there was an exception, this should include a stringified representation of it including type, message and stack trace (the exact format will vary by platform). + * An arbitrary bit of information that explains this result. If there was an exception, this should include a stringified representation of it including type, message and stack trace (the exact format will vary by platform). */ public Optional getMessage() { return Optional.ofNullable(message); @@ -46,7 +47,7 @@ public TestStepResultStatus getStatus() { } /** - * Exception thrown while executing this step, if any. + * Exception thrown while executing this step, if any. */ public Optional getException() { return Optional.ofNullable(exception); 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..e7446a7d 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Timestamp.java +++ b/java/src/generated/java/io/cucumber/messages/types/Timestamp.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 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; + private final Integer nanos; public Timestamp( Long seconds, - Long nanos + Integer nanos ) { this.seconds = requireNonNull(seconds, "Timestamp.seconds cannot be null"); this.nanos = requireNonNull(nanos, "Timestamp.nanos cannot be null"); @@ -39,7 +40,7 @@ public Long getSeconds() { * that count forward in time. Must be from 0 to 999,999,999 * inclusive. */ - public Long getNanos() { + public Integer getNanos() { return 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/Convertor.java b/java/src/main/java/io/cucumber/messages/Convertor.java index fcff908f..88d39865 100644 --- a/java/src/main/java/io/cucumber/messages/Convertor.java +++ b/java/src/main/java/io/cucumber/messages/Convertor.java @@ -30,12 +30,12 @@ private static String extractStackTrace(Throwable throwable) { public static Timestamp toMessage(java.time.Instant instant) { requireNonNull(instant, "instant may not be null"); - return new Timestamp(instant.getEpochSecond(), (long) instant.getNano()); + return new Timestamp(instant.getEpochSecond(), instant.getNano()); } public static Duration toMessage(java.time.Duration duration) { requireNonNull(duration, "duration may not be null"); - return new Duration(duration.getSeconds(), (long) duration.getNano()); + return new Duration(duration.getSeconds(), duration.getNano()); } public static java.time.Instant toInstant(Timestamp timestamp) { diff --git a/java/src/main/java/io/cucumber/messages/LocationComparator.java b/java/src/main/java/io/cucumber/messages/LocationComparator.java index 057b0087..63e5714d 100644 --- a/java/src/main/java/io/cucumber/messages/LocationComparator.java +++ b/java/src/main/java/io/cucumber/messages/LocationComparator.java @@ -17,8 +17,8 @@ public int compare(Location a, Location b) { if (c != 0) { return c; } - Long aColumn = a.getColumn().orElse(null); - Long bColumn = b.getColumn().orElse(null); + Integer aColumn = a.getColumn().orElse(null); + Integer bColumn = b.getColumn().orElse(null); // null first. return aColumn == null ? bColumn == null ? 0 : -1 : bColumn == null ? 1 : aColumn.compareTo(bColumn); } diff --git a/java/src/main/java/io/cucumber/messages/MessageToNdjsonWriter.java b/java/src/main/java/io/cucumber/messages/MessageToNdjsonWriter.java index 80e0d858..79882d3c 100644 --- a/java/src/main/java/io/cucumber/messages/MessageToNdjsonWriter.java +++ b/java/src/main/java/io/cucumber/messages/MessageToNdjsonWriter.java @@ -11,6 +11,7 @@ import static java.util.Objects.requireNonNull; public final class MessageToNdjsonWriter implements AutoCloseable { + private final Writer writer; private final Serializer serializer; 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/DurationComparatorTest.java b/java/src/test/java/io/cucumber/messages/DurationComparatorTest.java index 3c6f0adb..db72b3c2 100644 --- a/java/src/test/java/io/cucumber/messages/DurationComparatorTest.java +++ b/java/src/test/java/io/cucumber/messages/DurationComparatorTest.java @@ -11,36 +11,36 @@ class DurationComparatorTest { @Test void isEqual(){ - Duration a = new Duration(3L, 14L); - Duration b = new Duration(3L, 14L); + Duration a = new Duration(3L, 14); + Duration b = new Duration(3L, 14); assertThat(comparator.compare(a, b)).isZero(); } @Test void isSmallerOnSeconds(){ - Duration a = new Duration(2L, 14L); - Duration b = new Duration(3L, 14L); + Duration a = new Duration(2L, 14); + Duration b = new Duration(3L, 14); assertThat(comparator.compare(a, b)).isNegative(); } @Test void isSmallerOnNanos(){ - Duration a = new Duration(3L, 13L); - Duration b = new Duration(3L, 14L); + Duration a = new Duration(3L, 13); + Duration b = new Duration(3L, 14); assertThat(comparator.compare(a, b)).isNegative(); } @Test void isLargerOnSeconds(){ - Duration a = new Duration(4L, 14L); - Duration b = new Duration(3L, 14L); + Duration a = new Duration(4L, 14); + Duration b = new Duration(3L, 14); assertThat(comparator.compare(a, b)).isPositive(); } @Test void isLargerOnNanos(){ - Duration a = new Duration(3L, 15L); - Duration b = new Duration(3L, 14L); + Duration a = new Duration(3L, 15); + Duration b = new Duration(3L, 14); assertThat(comparator.compare(a, b)).isPositive(); } } diff --git a/java/src/test/java/io/cucumber/messages/Jackson.java b/java/src/test/java/io/cucumber/messages/Jackson.java index fad8130c..c88de08e 100644 --- a/java/src/test/java/io/cucumber/messages/Jackson.java +++ b/java/src/test/java/io/cucumber/messages/Jackson.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.cfg.ConstructorDetector; @@ -16,7 +15,7 @@ final class Jackson { public static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder() .addModule(new Jdk8Module()) .addModule(new ParameterNamesModule(Mode.PROPERTIES)) - .serializationInclusion(Include.NON_ABSENT) + .defaultPropertyInclusion(construct(NON_ABSENT, NON_ABSENT)) .constructorDetector(ConstructorDetector.USE_PROPERTIES_BASED) .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) diff --git a/java/src/test/java/io/cucumber/messages/JacksonTest.java b/java/src/test/java/io/cucumber/messages/JacksonTest.java index a8fc6f73..b7560bd3 100644 --- a/java/src/test/java/io/cucumber/messages/JacksonTest.java +++ b/java/src/test/java/io/cucumber/messages/JacksonTest.java @@ -29,7 +29,7 @@ void serialize_enums_using_value() throws JsonProcessingException { @Test void can_deserialize_envelope() throws JsonProcessingException { - Envelope source = Envelope.of(new TestRunStarted(new Timestamp(3L, 14L), UUID.randomUUID().toString())); + Envelope source = Envelope.of(new TestRunStarted(new Timestamp(3L, 14), UUID.randomUUID().toString())); String json = OBJECT_MAPPER.writeValueAsString(source); assertEquals(source, OBJECT_MAPPER.readValue(json, Envelope.class)); } diff --git a/java/src/test/java/io/cucumber/messages/LocationComparatorTest.java b/java/src/test/java/io/cucumber/messages/LocationComparatorTest.java index 7ae5d503..1de66e64 100644 --- a/java/src/test/java/io/cucumber/messages/LocationComparatorTest.java +++ b/java/src/test/java/io/cucumber/messages/LocationComparatorTest.java @@ -6,54 +6,55 @@ import static org.assertj.core.api.Assertions.assertThat; class LocationComparatorTest { - + final LocationComparator comparator = new LocationComparator(); - + @Test - void isEqual(){ - Location a = new Location(3L, 14L); - Location b = new Location(3L, 14L); + void isEqual() { + Location a = new Location(3, 14); + Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isZero(); } - + @Test - void isSmallerOnLine(){ - Location a = new Location(2L, 14L); - Location b = new Location(3L, 14L); + void isSmallerOnLine() { + Location a = new Location(2, 14); + Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isNegative(); } - + @Test - void isSmallerOnColum(){ - Location a = new Location(3L, 13L); - Location b = new Location(3L, 14L); + void isSmallerOnColum() { + Location a = new Location(3, 13); + Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isNegative(); } + @Test - void isSmallerAbsentColumn(){ - Location a = new Location(3L, null); - Location b = new Location(3L, 14L); + void isSmallerAbsentColumn() { + Location a = new Location(3, null); + Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isNegative(); } - + @Test - void isLargerOnLine(){ - Location a = new Location(4L, 14L); - Location b = new Location(3L, 14L); + void isLargerOnLine() { + Location a = new Location(4, 14); + Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isPositive(); } - + @Test - void isLargerOnColumn(){ - Location a = new Location(3L, 15L); - Location b = new Location(3L, 14L); + void isLargerOnColumn() { + Location a = new Location(3, 15); + Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isPositive(); } - + @Test - void isLargerAbsentColumn(){ - Location a = new Location(3L, 15L); - Location b = new Location(3L, null); + void isLargerAbsentColumn() { + Location a = new Location(3, 15); + Location b = new Location(3, null); assertThat(comparator.compare(a, b)).isPositive(); } } 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); diff --git a/java/src/test/java/io/cucumber/messages/NdjsonSerializationTest.java b/java/src/test/java/io/cucumber/messages/NdjsonSerializationTest.java index 1cccd4c5..92243585 100644 --- a/java/src/test/java/io/cucumber/messages/NdjsonSerializationTest.java +++ b/java/src/test/java/io/cucumber/messages/NdjsonSerializationTest.java @@ -27,7 +27,7 @@ static MessageToNdjsonWriter createMessageWriter(OutputStream output) { } static Iterable createMessageIterable(InputStream input) { - return new NdjsonToMessageIterable(input, (json) -> Jackson.OBJECT_MAPPER.readValue(json, Envelope.class)); + return new NdjsonToMessageIterable(input, json -> Jackson.OBJECT_MAPPER.readValue(json, Envelope.class)); } @Test diff --git a/java/src/test/java/io/cucumber/messages/TimestampComparatorTest.java b/java/src/test/java/io/cucumber/messages/TimestampComparatorTest.java index c3def5c7..63e88806 100644 --- a/java/src/test/java/io/cucumber/messages/TimestampComparatorTest.java +++ b/java/src/test/java/io/cucumber/messages/TimestampComparatorTest.java @@ -11,36 +11,36 @@ class TimestampComparatorTest { @Test void isEqual(){ - Timestamp a = new Timestamp(3L, 14L); - Timestamp b = new Timestamp(3L, 14L); + Timestamp a = new Timestamp(3L, 14); + Timestamp b = new Timestamp(3L, 14); assertThat(comparator.compare(a, b)).isZero(); } @Test void isSmallerOnSeconds(){ - Timestamp a = new Timestamp(2L, 14L); - Timestamp b = new Timestamp(3L, 14L); + Timestamp a = new Timestamp(2L, 14); + Timestamp b = new Timestamp(3L, 14); assertThat(comparator.compare(a, b)).isNegative(); } @Test void isSmallerOnNanos(){ - Timestamp a = new Timestamp(3L, 13L); - Timestamp b = new Timestamp(3L, 14L); + Timestamp a = new Timestamp(3L, 13); + Timestamp b = new Timestamp(3L, 14); assertThat(comparator.compare(a, b)).isNegative(); } @Test void isLargerOnSeconds(){ - Timestamp a = new Timestamp(4L, 14L); - Timestamp b = new Timestamp(3L, 14L); + Timestamp a = new Timestamp(4L, 14); + Timestamp b = new Timestamp(3L, 14); assertThat(comparator.compare(a, b)).isPositive(); } @Test void isLargerOnNanos(){ - Timestamp a = new Timestamp(3L, 15L); - Timestamp b = new Timestamp(3L, 14L); + Timestamp a = new Timestamp(3L, 15); + Timestamp b = new Timestamp(3L, 14); assertThat(comparator.compare(a, b)).isPositive(); } } diff --git a/javascript/src/messages.ts b/javascript/src/messages.ts index 0288237e..17cb2046 100644 --- a/javascript/src/messages.ts +++ b/javascript/src/messages.ts @@ -421,6 +421,9 @@ export class Pickle { uri: string = '' + @Type(() => Location) + location?: Location + name: string = '' language: string = '' diff --git a/jsonschema/messages.md b/jsonschema/messages.md index bd278929..59f1ff6b 100644 --- a/jsonschema/messages.md +++ b/jsonschema/messages.md @@ -1120,6 +1120,13 @@ A unique id for the pickle The uri of the source file +#### Pickle.location + +* Type: [Location](#location) +* Required: no + +The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. + #### Pickle.name * Type: string diff --git a/jsonschema/relations.md b/jsonschema/relations.md index 06e51abc..28a9f18f 100644 --- a/jsonschema/relations.md +++ b/jsonschema/relations.md @@ -95,6 +95,7 @@ Meta ||..o| Ci: "has a" Ci ||..o| Git: "has a" ParameterType ||..o| SourceReference: "has a" ParseError ||..|| SourceReference: "has a" +Pickle ||..o| Location: "has a" Pickle ||..|{ PickleStep: "has" Pickle ||..|{ PickleTag: "has" PickleStep ||..o| PickleStepArgument: "has a" diff --git a/jsonschema/src/Duration.json b/jsonschema/src/Duration.json index 676f74f7..c3ad4dc7 100644 --- a/jsonschema/src/Duration.json +++ b/jsonschema/src/Duration.json @@ -13,7 +13,9 @@ }, "nanos": { "description": "Non-negative fractions of a second at nanosecond resolution. Negative\nsecond values with fractions must still have non-negative nanos values\nthat count forward in time. Must be from 0 to 999,999,999\ninclusive.", - "type": "integer" + "type": "integer", + "minimum": 0, + "maximum": 999999999 } }, "type": "object" diff --git a/jsonschema/src/Location.json b/jsonschema/src/Location.json index 85ce1ec0..074d32ae 100644 --- a/jsonschema/src/Location.json +++ b/jsonschema/src/Location.json @@ -5,10 +5,14 @@ "description": "Points to a line and a column in a text file", "properties": { "line": { - "type": "integer" + "type": "integer", + "minimum": 1, + "maximum": 2147483647 }, "column": { - "type": "integer" + "type": "integer", + "minimum": 1, + "maximum": 2147483647 } }, "required": [ diff --git a/jsonschema/src/Pickle.json b/jsonschema/src/Pickle.json index b31716b4..5824636d 100644 --- a/jsonschema/src/Pickle.json +++ b/jsonschema/src/Pickle.json @@ -156,6 +156,10 @@ "description": "The uri of the source file", "type": "string" }, + "location": { + "description": "The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row.", + "$ref": "./Location.json" + }, "name": { "description": "The name of the pickle", "type": "string" diff --git a/jsonschema/src/TestCase.json b/jsonschema/src/TestCase.json index 575f87aa..3aa4b448 100644 --- a/jsonschema/src/TestCase.json +++ b/jsonschema/src/TestCase.json @@ -18,7 +18,9 @@ "type": "array" }, "start": { - "type": "integer" + "type": "integer", + "minimum": 0, + "maximum": 2147483647 }, "value": { "type": "string" diff --git a/jsonschema/src/TestCaseStarted.json b/jsonschema/src/TestCaseStarted.json index 12600c43..2fd04b89 100644 --- a/jsonschema/src/TestCaseStarted.json +++ b/jsonschema/src/TestCaseStarted.json @@ -11,7 +11,8 @@ "properties": { "attempt": { "description": "The first attempt should have value 0, and for each retry the value\nshould increase by 1.", - "type": "integer" + "type": "integer", + "minimum": 0 }, "id": { "description": "Because a `TestCase` can be run multiple times (in case of a retry),\nwe use this field to group messages relating to the same attempt.", diff --git a/jsonschema/src/Timestamp.json b/jsonschema/src/Timestamp.json index 0b877148..81395aa4 100644 --- a/jsonschema/src/Timestamp.json +++ b/jsonschema/src/Timestamp.json @@ -13,7 +13,9 @@ }, "nanos": { "description": "Non-negative fractions of a second at nanosecond resolution. Negative\nsecond values with fractions must still have non-negative nanos values\nthat count forward in time. Must be from 0 to 999,999,999\ninclusive.", - "type": "integer" + "type": "integer", + "minimum": 0, + "maximum": 999999999 } }, "type": "object" diff --git a/perl/lib/Cucumber/Messages.pm b/perl/lib/Cucumber/Messages.pm index 1cbff56c..a9f04516 100644 --- a/perl/lib/Cucumber/Messages.pm +++ b/perl/lib/Cucumber/Messages.pm @@ -2719,6 +2719,7 @@ use Scalar::Util qw( blessed ); my %types = ( id => 'string', uri => 'string', + location => 'Cucumber::Messages::Location', name => 'string', language => 'string', steps => '[]Cucumber::Messages::PickleStep', @@ -2758,6 +2759,16 @@ has uri => ); +=head4 location + +The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. +=cut + +has location => + (is => 'ro', + ); + + =head4 name The name of the pickle diff --git a/php/src-generated/Pickle.php b/php/src-generated/Pickle.php index 94a88571..466d0802 100644 --- a/php/src-generated/Pickle.php +++ b/php/src-generated/Pickle.php @@ -48,6 +48,11 @@ public function __construct( */ public readonly string $uri = '', + /** + * The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. + */ + public readonly ?Location $location = null, + /** * The name of the pickle */ @@ -87,6 +92,7 @@ public static function fromArray(array $arr): self { self::ensureId($arr); self::ensureUri($arr); + self::ensureLocation($arr); self::ensureName($arr); self::ensureLanguage($arr); self::ensureSteps($arr); @@ -96,6 +102,7 @@ public static function fromArray(array $arr): self return new self( (string) $arr['id'], (string) $arr['uri'], + isset($arr['location']) ? Location::fromArray($arr['location']) : null, (string) $arr['name'], (string) $arr['language'], array_values(array_map(fn (array $member) => PickleStep::fromArray($member), $arr['steps'])), @@ -130,6 +137,16 @@ private static function ensureUri(array $arr): void } } + /** + * @psalm-assert array{location?: array} $arr + */ + private static function ensureLocation(array $arr): void + { + if (array_key_exists('location', $arr) && !is_array($arr['location'])) { + throw new SchemaViolationException('Property \'location\' was not array'); + } + } + /** * @psalm-assert array{name: string|int|bool} $arr */ diff --git a/python/src/cucumber_messages/_messages.py b/python/src/cucumber_messages/_messages.py index be330f76..102833b0 100644 --- a/python/src/cucumber_messages/_messages.py +++ b/python/src/cucumber_messages/_messages.py @@ -398,6 +398,7 @@ class Pickle: """ uri: str # The uri of the source file + location: Optional[Location] = None # The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. @dataclass diff --git a/ruby/lib/cucumber/messages/pickle.rb b/ruby/lib/cucumber/messages/pickle.rb index 175f3b77..6d689e8d 100644 --- a/ruby/lib/cucumber/messages/pickle.rb +++ b/ruby/lib/cucumber/messages/pickle.rb @@ -29,6 +29,11 @@ class Pickle < Message ## attr_reader :uri + ## + # The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. + ## + attr_reader :location + ## # The name of the pickle ## @@ -60,6 +65,7 @@ class Pickle < Message def initialize( id: '', uri: '', + location: nil, name: '', language: '', steps: [], @@ -68,6 +74,7 @@ def initialize( ) @id = id @uri = uri + @location = location @name = name @language = language @steps = steps @@ -89,6 +96,7 @@ def self.from_h(hash) new( id: hash[:id], uri: hash[:uri], + location: Location.from_h(hash[:location]), name: hash[:name], language: hash[:language], steps: hash[:steps]&.map { |item| PickleStep.from_h(item) },