From 487d19f1bfd5cb92e3e92ab4c0e8af0e7fcf57f6 Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Thu, 17 Jul 2025 18:24:30 +0200 Subject: [PATCH 01/16] Add location to pickle --- .../messages/cucumber/messages/pickle.hpp | 2 ++ .../lib/messages/cucumber/messages/pickle.cpp | 2 ++ dotnet/Cucumber.Messages/generated/Pickle.cs | 14 ++++++++++++-- go/messages.go | 1 + .../io/cucumber/messages/types/Pickle.java | 19 ++++++++++++++++--- javascript/src/messages.ts | 3 +++ jsonschema/messages.md | 1 + jsonschema/src/Pickle.json | 4 ++++ perl/lib/Cucumber/Messages.pm | 11 +++++++++++ php/src-generated/Pickle.php | 17 +++++++++++++++++ python/src/cucumber_messages/_messages.py | 1 + ruby/lib/cucumber/messages/pickle.rb | 12 ++++++++++-- 12 files changed, 80 insertions(+), 7 deletions(-) diff --git a/cpp/include/messages/cucumber/messages/pickle.hpp b/cpp/include/messages/cucumber/messages/pickle.hpp index 36be3345..3eae05c5 100644 --- a/cpp/include/messages/cucumber/messages/pickle.hpp +++ b/cpp/include/messages/cucumber/messages/pickle.hpp @@ -8,6 +8,7 @@ #include #include +#include namespace cucumber::messages { @@ -41,6 +42,7 @@ struct pickle std::vector steps; std::vector tags; std::vector ast_node_ids; + std::optional location; std::string to_string() const; diff --git a/cpp/src/lib/messages/cucumber/messages/pickle.cpp b/cpp/src/lib/messages/cucumber/messages/pickle.cpp index e8fd1896..5dd05bcb 100644 --- a/cpp/src/lib/messages/cucumber/messages/pickle.cpp +++ b/cpp/src/lib/messages/cucumber/messages/pickle.cpp @@ -17,6 +17,7 @@ pickle::to_string() const cucumber::messages::to_string(oss, ", steps=", steps); cucumber::messages::to_string(oss, ", tags=", tags); cucumber::messages::to_string(oss, ", ast_node_ids=", ast_node_ids); + cucumber::messages::to_string(oss, ", location=", location); return oss.str(); } @@ -31,6 +32,7 @@ pickle::to_json(json& j) const cucumber::messages::to_json(j, camelize("steps"), steps); cucumber::messages::to_json(j, camelize("tags"), tags); cucumber::messages::to_json(j, camelize("ast_node_ids"), ast_node_ids); + cucumber::messages::to_json(j, camelize("location"), location); } std::string diff --git a/dotnet/Cucumber.Messages/generated/Pickle.cs b/dotnet/Cucumber.Messages/generated/Pickle.cs index e96855e6..352db6c8 100644 --- a/dotnet/Cucumber.Messages/generated/Pickle.cs +++ b/dotnet/Cucumber.Messages/generated/Pickle.cs @@ -60,6 +60,10 @@ public sealed class Pickle * id originating from the `Scenario` AST node, and the second from the `TableRow` AST node. */ public List AstNodeIds { 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; } public Pickle( @@ -69,7 +73,8 @@ public Pickle( string language, List steps, List tags, - List astNodeIds + List astNodeIds, + Location location ) { RequireNonNull(id, "Id", "Pickle.Id cannot be null"); @@ -86,6 +91,7 @@ List astNodeIds this.Tags = new List(tags); RequireNonNull>(astNodeIds, "AstNodeIds", "Pickle.AstNodeIds cannot be null"); this.AstNodeIds = new List(astNodeIds); + this.Location = location; } public override bool Equals(Object o) @@ -100,7 +106,8 @@ public override bool Equals(Object o) Language.Equals(that.Language) && Steps.Equals(that.Steps) && Tags.Equals(that.Tags) && - AstNodeIds.Equals(that.AstNodeIds); + AstNodeIds.Equals(that.AstNodeIds) && + Object.Equals(Location, that.Location); } public override int GetHashCode() @@ -120,6 +127,8 @@ public override int GetHashCode() hash = hash * 31 + Tags.GetHashCode(); if (AstNodeIds != null) hash = hash * 31 + AstNodeIds.GetHashCode(); + if (Location != null) + hash = hash * 31 + Location.GetHashCode(); return hash; } @@ -133,6 +142,7 @@ public override string ToString() ", steps=" + Steps + ", tags=" + Tags + ", astNodeIds=" + AstNodeIds + + ", location=" + Location + '}'; } diff --git a/go/messages.go b/go/messages.go index 7fb60c88..c4a0e79c 100644 --- a/go/messages.go +++ b/go/messages.go @@ -222,6 +222,7 @@ type Pickle struct { Steps []*PickleStep `json:"steps"` Tags []*PickleTag `json:"tags"` AstNodeIds []string `json:"astNodeIds"` + Location *Location `json:"location,omitempty"` } type PickleDocString struct { 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 4ef811c3..3a8772dc 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Pickle.java +++ b/java/src/generated/java/io/cucumber/messages/types/Pickle.java @@ -34,6 +34,7 @@ public final class Pickle { private final java.util.List steps; private final java.util.List tags; private final java.util.List astNodeIds; + private final Location location; public Pickle( String id, @@ -42,7 +43,8 @@ public Pickle( String language, java.util.List steps, java.util.List tags, - java.util.List astNodeIds + java.util.List astNodeIds, + Location location ) { this.id = requireNonNull(id, "Pickle.id cannot be null"); this.uri = requireNonNull(uri, "Pickle.uri cannot be null"); @@ -51,6 +53,7 @@ public Pickle( 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.location = location; } /** @@ -105,6 +108,13 @@ public java.util.List getAstNodeIds() { return astNodeIds; } + /** + * 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); + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -117,7 +127,8 @@ public boolean equals(Object o) { language.equals(that.language) && steps.equals(that.steps) && tags.equals(that.tags) && - astNodeIds.equals(that.astNodeIds); + astNodeIds.equals(that.astNodeIds) && + Objects.equals(location, that.location); } @Override @@ -129,7 +140,8 @@ public int hashCode() { language, steps, tags, - astNodeIds + astNodeIds, + location ); } @@ -143,6 +155,7 @@ public String toString() { ", steps=" + steps + ", tags=" + tags + ", astNodeIds=" + astNodeIds + + ", location=" + location + '}'; } } diff --git a/javascript/src/messages.ts b/javascript/src/messages.ts index e79c3a98..170d74e9 100644 --- a/javascript/src/messages.ts +++ b/javascript/src/messages.ts @@ -429,6 +429,9 @@ export class Pickle { tags: readonly PickleTag[] = [] astNodeIds: readonly string[] = [] + + @Type(() => Location) + location?: Location } export class PickleDocString { diff --git a/jsonschema/messages.md b/jsonschema/messages.md index 2a455533..de5844ca 100644 --- a/jsonschema/messages.md +++ b/jsonschema/messages.md @@ -282,6 +282,7 @@ will only have one of its fields set, which indicates the payload of the message | `steps` | [PickleStep](#picklestep)[] | yes | | | `tags` | [PickleTag](#pickletag)[] | yes | | | `astNodeIds` | string[] | yes | | +| `location` | [Location](#location) | no | | ## PickleDocString diff --git a/jsonschema/src/Pickle.json b/jsonschema/src/Pickle.json index 10877afe..20a0fb13 100644 --- a/jsonschema/src/Pickle.json +++ b/jsonschema/src/Pickle.json @@ -185,6 +185,10 @@ }, "type": "array", "minItems": 1 + }, + "location": { + "description": "The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row.", + "$ref": "./Location.json" } }, "type": "object" diff --git a/perl/lib/Cucumber/Messages.pm b/perl/lib/Cucumber/Messages.pm index 8b6ca712..1abb0f3a 100644 --- a/perl/lib/Cucumber/Messages.pm +++ b/perl/lib/Cucumber/Messages.pm @@ -2737,6 +2737,7 @@ my %types = ( steps => '[]Cucumber::Messages::PickleStep', tags => '[]Cucumber::Messages::PickleTag', ast_node_ids => '[]string', + location => 'Cucumber::Messages::Location', ); # This is a work-around for the fact that Moo doesn't have introspection @@ -2837,6 +2838,16 @@ has ast_node_ids => ); +=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', + ); + + } package Cucumber::Messages::PickleDocString { diff --git a/php/src-generated/Pickle.php b/php/src-generated/Pickle.php index 8f51f607..d5d9c041 100644 --- a/php/src-generated/Pickle.php +++ b/php/src-generated/Pickle.php @@ -77,6 +77,11 @@ public function __construct( * id originating from the `Scenario` AST node, and the second from the `TableRow` AST node. */ public readonly array $astNodeIds = [], + + /** + * The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. + */ + public readonly ?Location $location = null, ) { } @@ -94,6 +99,7 @@ public static function fromArray(array $arr): self self::ensureSteps($arr); self::ensureTags($arr); self::ensureAstNodeIds($arr); + self::ensureLocation($arr); return new self( (string) $arr['id'], @@ -103,6 +109,7 @@ public static function fromArray(array $arr): self array_values(array_map(fn (array $member) => PickleStep::fromArray($member), $arr['steps'])), array_values(array_map(fn (array $member) => PickleTag::fromArray($member), $arr['tags'])), array_values(array_map(fn (mixed $member) => (string) $member, $arr['astNodeIds'])), + isset($arr['location']) ? Location::fromArray($arr['location']) : null, ); } @@ -196,4 +203,14 @@ private static function ensureAstNodeIds(array $arr): void throw new SchemaViolationException('Property \'astNodeIds\' was not array'); } } + + /** + * @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'); + } + } } diff --git a/python/src/cucumber_messages/_messages.py b/python/src/cucumber_messages/_messages.py index 1e2ad28c..91b921c1 100644 --- a/python/src/cucumber_messages/_messages.py +++ b/python/src/cucumber_messages/_messages.py @@ -439,6 +439,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 b8b54ea5..a471be94 100644 --- a/ruby/lib/cucumber/messages/pickle.rb +++ b/ruby/lib/cucumber/messages/pickle.rb @@ -63,6 +63,11 @@ class Pickle < Message ## attr_reader :ast_node_ids + ## + # The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. + ## + attr_reader :location + def initialize( id: '', uri: '', @@ -70,7 +75,8 @@ def initialize( language: '', steps: [], tags: [], - ast_node_ids: [] + ast_node_ids: [], + location: nil ) @id = id @uri = uri @@ -79,6 +85,7 @@ def initialize( @steps = steps @tags = tags @ast_node_ids = ast_node_ids + @location = location super() end @@ -99,7 +106,8 @@ def self.from_h(hash) language: hash[:language], steps: hash[:steps]&.map { |item| PickleStep.from_h(item) }, tags: hash[:tags]&.map { |item| PickleTag.from_h(item) }, - ast_node_ids: hash[:astNodeIds] + ast_node_ids: hash[:astNodeIds], + location: Location.from_h(hash[:location]) ) end end From 263db337e7c13c33172bd30fb240c05a69b43c10 Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Thu, 17 Jul 2025 21:36:49 +0200 Subject: [PATCH 02/16] java: Use Integers in addition to Longs Currently, messages are a bit cumbersome to use in combination with Java. The generated code currently uses long values where Java would use integers. This leads to some silly code: ```java lines.add((int) (long) location.getLine()); ``` Unfortunately, long values are needed for the timestamp and duration. So simply replacing longs with integers wouldn't work. By specifying some upper bounds the code generation can make a more informed choice about the size of number to use. The choice for 2^31 - 1 is somewhat arbitrary but matches the maximum length of strings in Java and .Net. In practice, I would expect Gherkin documents to have a much more reasonable length though. --- codegen/generators/base.rb | 16 ++-- codegen/generators/cpp.rb | 4 +- codegen/generators/dotnet.rb | 4 +- codegen/generators/go.rb | 4 +- codegen/generators/java.rb | 20 +++-- codegen/generators/markdown.rb | 4 +- codegen/generators/perl.rb | 4 +- codegen/generators/php.rb | 8 +- codegen/generators/python.rb | 14 +-- codegen/generators/ruby.rb | 4 +- codegen/generators/typescript.rb | 4 +- .../io/cucumber/messages/types/Group.java | 6 +- .../io/cucumber/messages/types/Location.java | 12 +-- jsonschema/src/Attachment.json | 10 +-- jsonschema/src/Duration.json | 4 +- jsonschema/src/GherkinDocument.json | 12 +-- jsonschema/src/Location.json | 10 ++- jsonschema/src/Meta.json | 4 +- jsonschema/src/Pickle.json | 10 +-- jsonschema/src/Source.json | 2 +- jsonschema/src/SourceReference.json | 2 +- jsonschema/src/TestCase.json | 10 ++- jsonschema/src/TestCaseStarted.json | 7 +- jsonschema/src/Timestamp.json | 4 +- perl/lib/Cucumber/Messages.pm | 78 ++++++---------- python/src/cucumber_messages/_messages.py | 90 ++++++------------- ruby/lib/cucumber/messages/attachment.rb | 15 ++-- ruby/lib/cucumber/messages/comment.rb | 3 +- ruby/lib/cucumber/messages/feature_child.rb | 3 +- .../lib/cucumber/messages/gherkin_document.rb | 6 +- ruby/lib/cucumber/messages/location.rb | 3 +- ruby/lib/cucumber/messages/meta.rb | 6 +- ruby/lib/cucumber/messages/pickle.rb | 9 +- ruby/lib/cucumber/messages/pickle_step.rb | 3 +- ruby/lib/cucumber/messages/pickle_tag.rb | 3 +- ruby/lib/cucumber/messages/rule_child.rb | 3 +- ruby/lib/cucumber/messages/source.rb | 3 +- .../lib/cucumber/messages/source_reference.rb | 3 +- .../cucumber/messages/step_match_argument.rb | 6 +- ruby/lib/cucumber/messages/tag.rb | 3 +- .../cucumber/messages/test_case_started.rb | 6 +- ruby/lib/cucumber/messages/test_step.rb | 3 +- 42 files changed, 176 insertions(+), 249 deletions(-) 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..95ac3cb0 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' - } + }.fetch(type) end end end diff --git a/codegen/generators/dotnet.rb b/codegen/generators/dotnet.rb index 1e164c55..9d25fa87 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' - } + }.fetch(type) end end end diff --git a/codegen/generators/go.rb b/codegen/generators/go.rb index 659d2b49..bbeb3b5a 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' - } + }.fetch(type) end end end diff --git a/codegen/generators/java.rb b/codegen/generators/java.rb index 6df09797..eb207af3 100644 --- a/codegen/generators/java.rb +++ b/codegen/generators/java.rb @@ -21,12 +21,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..94c79c44 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' - } + }.fetch(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/java/src/generated/java/io/cucumber/messages/types/Group.java b/java/src/generated/java/io/cucumber/messages/types/Group.java index 45ada355..44eb6624 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Group.java +++ b/java/src/generated/java/io/cucumber/messages/types/Group.java @@ -15,12 +15,12 @@ @SuppressWarnings("unused") public final class Group { private final java.util.List children; - private final Long start; + private final Integer start; private final String value; public Group( java.util.List children, - Long start, + Integer start, String value ) { this.children = unmodifiableList(new ArrayList<>(requireNonNull(children, "Group.children cannot be null"))); @@ -32,7 +32,7 @@ public java.util.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/Location.java b/java/src/generated/java/io/cucumber/messages/types/Location.java index 19abec37..65879720 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Location.java +++ b/java/src/generated/java/io/cucumber/messages/types/Location.java @@ -16,22 +16,22 @@ // Generated code @SuppressWarnings("unused") public final class Location { - private final Long line; - private final Long column; + private final Integer line; + private final Integer column; public Location( - Long line, - Long column + Integer line, + 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/jsonschema/src/Attachment.json b/jsonschema/src/Attachment.json index 5ba885e5..0f9f8941 100644 --- a/jsonschema/src/Attachment.json +++ b/jsonschema/src/Attachment.json @@ -10,11 +10,11 @@ ], "properties": { "body": { - "description": "*\n The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment\n is simply the string. If it's `BASE64`, the string should be Base64 decoded to\n obtain the attachment.", + "description": "The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment\n is simply the string. If it's `BASE64`, the string should be Base64 decoded to\n obtain the attachment.", "type": "string" }, "contentEncoding": { - "description": "*\n Whether to interpret `body` \"as-is\" (IDENTITY) or if it needs to be Base64-decoded (BASE64).\n\n Content encoding is *not* determined by the media type, but rather by the type\n of the object being attached:\n\n - string: IDENTITY\n - byte array: BASE64\n - stream: BASE64", + "description": "Whether to interpret `body` \"as-is\" (IDENTITY) or if it needs to be Base64-decoded (BASE64).\n\n Content encoding is *not* determined by the media type, but rather by the type\n of the object being attached:\n\n - string: IDENTITY\n - byte array: BASE64\n - stream: BASE64", "enum": [ "IDENTITY", "BASE64" @@ -22,11 +22,11 @@ "type": "string" }, "fileName": { - "description": "*\n Suggested file name of the attachment. (Provided by the user as an argument to `attach`)", + "description": "Suggested file name of the attachment. (Provided by the user as an argument to `attach`)", "type": "string" }, "mediaType": { - "description": "*\n The media type of the data. This can be any valid\n [IANA Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml)\n as well as Cucumber-specific media types such as `text/x.cucumber.gherkin+plain`\n and `text/x.cucumber.stacktrace+plain`", + "description": "The media type of the data. This can be any valid\n [IANA Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml)\n as well as Cucumber-specific media types such as `text/x.cucumber.gherkin+plain`\n and `text/x.cucumber.stacktrace+plain`", "type": "string" }, "source": { @@ -41,7 +41,7 @@ "type": "string" }, "url": { - "description": "*\n A URL where the attachment can be retrieved. This field should not be set by Cucumber.\n It should be set by a program that reads a message stream and does the following for\n each Attachment message:\n\n - Writes the body (after base64 decoding if necessary) to a new file.\n - Sets `body` and `contentEncoding` to `null`\n - Writes out the new attachment message\n\n This will result in a smaller message stream, which can improve performance and\n reduce bandwidth of message consumers. It also makes it easier to process and download attachments\n separately from reports.", + "description": "A URL where the attachment can be retrieved. This field should not be set by Cucumber.\n It should be set by a program that reads a message stream and does the following for\n each Attachment message:\n\n - Writes the body (after base64 decoding if necessary) to a new file.\n - Sets `body` and `contentEncoding` to `null`\n - Writes out the new attachment message\n\n This will result in a smaller message stream, which can improve performance and\n reduce bandwidth of message consumers. It also makes it easier to process and download attachments\n separately from reports.", "type": "string" }, "testRunStartedId": { diff --git a/jsonschema/src/Duration.json b/jsonschema/src/Duration.json index 7f929228..c684fc3f 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\n second values with fractions must still have non-negative nanos values\n that count forward in time. Must be from 0 to 999,999,999\n inclusive.", - "type": "integer" + "type": "integer", + "minimum": 0, + "maximum": 9999999999 } }, "type": "object" diff --git a/jsonschema/src/GherkinDocument.json b/jsonschema/src/GherkinDocument.json index 911644a6..a063f8b6 100644 --- a/jsonschema/src/GherkinDocument.json +++ b/jsonschema/src/GherkinDocument.json @@ -44,7 +44,7 @@ "Comment": { "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, - "description": "*\n A comment in a Gherkin document", + "description": "A comment in a Gherkin document", "required": [ "location", "text" @@ -204,7 +204,7 @@ "FeatureChild": { "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, - "description": "*\n A child node of a `Feature` node", + "description": "A child node of a `Feature` node", "properties": { "rule": { "$ref": "#/definitions/Rule" @@ -266,7 +266,7 @@ "RuleChild": { "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, - "description": "*\n A child node of a `Rule` node", + "description": "A child node of a `Rule` node", "properties": { "background": { "$ref": "#/definitions/Background" @@ -428,7 +428,7 @@ "Tag": { "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, - "description": "*\n A tag", + "description": "A tag", "required": [ "location", "name", @@ -451,13 +451,13 @@ "type": "object" } }, - "description": "*\n The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document.\n Cucumber implementations should *not* depend on `GherkinDocument` or any of its\n children for execution - use [Pickle](#io.cucumber.messages.Pickle) instead.\n\n The only consumers of `GherkinDocument` should only be formatters that produce\n \"rich\" output, resembling the original Gherkin document.", + "description": "The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document.\n Cucumber implementations should *not* depend on `GherkinDocument` or any of its\n children for execution - use [Pickle](#io.cucumber.messages.Pickle) instead.\n\n The only consumers of `GherkinDocument` should only be formatters that produce\n \"rich\" output, resembling the original Gherkin document.", "required": [ "comments" ], "properties": { "uri": { - "description": "*\n The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)\n of the source, typically a file path relative to the root directory", + "description": "The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)\n of the source, typically a file path relative to the root directory", "type": "string" }, "feature": { diff --git a/jsonschema/src/Location.json b/jsonschema/src/Location.json index d1a0fb52..0e700cac 100644 --- a/jsonschema/src/Location.json +++ b/jsonschema/src/Location.json @@ -2,13 +2,17 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "Location.json", "additionalProperties": false, - "description": "*\n Points to a line and a column in a text file", + "description": "Points to a line and a column in a text file", "properties": { "line": { - "type": "integer" + "type": "integer", + "minimum": 0, + "maximum": 2147483647 }, "column": { - "type": "integer" + "type": "integer", + "minimum": 1, + "maximum": 2147483647 } }, "required": [ diff --git a/jsonschema/src/Meta.json b/jsonschema/src/Meta.json index 4fce192c..3ca8bb37 100644 --- a/jsonschema/src/Meta.json +++ b/jsonschema/src/Meta.json @@ -71,7 +71,7 @@ "type": "object" } }, - "description": "*\n This message contains meta information about the environment. Consumers can use\n this for various purposes.", + "description": "This message contains meta information about the environment. Consumers can use\n this for various purposes.", "required": [ "protocolVersion", "implementation", @@ -81,7 +81,7 @@ ], "properties": { "protocolVersion": { - "description": "*\n The [SEMVER](https://semver.org/) version number of the protocol", + "description": "The [SEMVER](https://semver.org/) version number of the protocol", "type": "string" }, "implementation": { diff --git a/jsonschema/src/Pickle.json b/jsonschema/src/Pickle.json index 10877afe..75e514b1 100644 --- a/jsonschema/src/Pickle.json +++ b/jsonschema/src/Pickle.json @@ -21,7 +21,7 @@ "PickleStep": { "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, - "description": "*\n An executable step", + "description": "An executable step", "required": [ "astNodeIds", "id", @@ -120,7 +120,7 @@ "PickleTag": { "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, - "description": "*\n A tag", + "description": "A tag", "required": [ "name", "astNodeId" @@ -149,7 +149,7 @@ ], "properties": { "id": { - "description": "*\n A unique id for the pickle", + "description": "A unique id for the pickle", "type": "string" }, "uri": { @@ -172,14 +172,14 @@ "type": "array" }, "tags": { - "description": "*\n One or more tags. If this pickle is constructed from a Gherkin document,\n It includes inherited tags from the `Feature` as well.", + "description": "One or more tags. If this pickle is constructed from a Gherkin document,\n It includes inherited tags from the `Feature` as well.", "items": { "$ref": "#/definitions/PickleTag" }, "type": "array" }, "astNodeIds": { - "description": "*\n Points to the AST node locations of the pickle. The last one represents the unique\n id of the pickle. A pickle constructed from `Examples` will have the first\n id originating from the `Scenario` AST node, and the second from the `TableRow` AST node.", + "description": "Points to the AST node locations of the pickle. The last one represents the unique\n id of the pickle. A pickle constructed from `Examples` will have the first\n id originating from the `Scenario` AST node, and the second from the `TableRow` AST node.", "items": { "type": "string" }, diff --git a/jsonschema/src/Source.json b/jsonschema/src/Source.json index 61ca46ee..ee7fc78b 100644 --- a/jsonschema/src/Source.json +++ b/jsonschema/src/Source.json @@ -10,7 +10,7 @@ ], "properties": { "uri": { - "description": "*\n The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)\n of the source, typically a file path relative to the root directory", + "description": "The [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)\n of the source, typically a file path relative to the root directory", "type": "string" }, "data": { diff --git a/jsonschema/src/SourceReference.json b/jsonschema/src/SourceReference.json index 5e9f46a5..08872ea2 100644 --- a/jsonschema/src/SourceReference.json +++ b/jsonschema/src/SourceReference.json @@ -47,7 +47,7 @@ "type": "object" } }, - "description": "*\n Points to a [Source](#io.cucumber.messages.Source) identified by `uri` and a\n [Location](#io.cucumber.messages.Location) within that file.", + "description": "Points to a [Source](#io.cucumber.messages.Source) identified by `uri` and a\n [Location](#io.cucumber.messages.Location) within that file.", "properties": { "uri": { "type": "string" diff --git a/jsonschema/src/TestCase.json b/jsonschema/src/TestCase.json index 003d9e95..8ac6aab0 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" @@ -29,14 +31,14 @@ "StepMatchArgument": { "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, - "description": "*\n Represents a single argument extracted from a step match and passed to a step definition.\n This is used for the following purposes:\n - Construct an argument to pass to a step definition (possibly through a parameter type transform)\n - Highlight the matched parameter in rich formatters such as the HTML formatter\n\n This message closely matches the `Argument` class in the `cucumber-expressions` library.", + "description": "Represents a single argument extracted from a step match and passed to a step definition.\n This is used for the following purposes:\n - Construct an argument to pass to a step definition (possibly through a parameter type transform)\n - Highlight the matched parameter in rich formatters such as the HTML formatter\n\n This message closely matches the `Argument` class in the `cucumber-expressions` library.", "required": [ "group" ], "properties": { "group": { "$ref": "#/definitions/Group", - "description": "*\n Represents the outermost capture group of an argument. This message closely matches the\n `Group` class in the `cucumber-expressions` library." + "description": "Represents the outermost capture group of an argument. This message closely matches the\n `Group` class in the `cucumber-expressions` library." }, "parameterTypeName": { "type": "string" @@ -63,7 +65,7 @@ "TestStep": { "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, - "description": "*\n A `TestStep` is derived from either a `PickleStep`\n combined with a `StepDefinition`, or from a `Hook`.", + "description": "A `TestStep` is derived from either a `PickleStep`\n combined with a `StepDefinition`, or from a `Hook`.", "required": [ "id" ], diff --git a/jsonschema/src/TestCaseStarted.json b/jsonschema/src/TestCaseStarted.json index 5800aaa4..8075df4d 100644 --- a/jsonschema/src/TestCaseStarted.json +++ b/jsonschema/src/TestCaseStarted.json @@ -10,11 +10,12 @@ ], "properties": { "attempt": { - "description": "*\n The first attempt should have value 0, and for each retry the value\n should increase by 1.", - "type": "integer" + "description": "The first attempt should have value 0, and for each retry the value\n should increase by 1.", + "type": "integer", + "minimum": 0 }, "id": { - "description": "*\n Because a `TestCase` can be run multiple times (in case of a retry),\n we use this field to group messages relating to the same attempt.", + "description": "Because a `TestCase` can be run multiple times (in case of a retry),\n we use this field to group messages relating to the same attempt.", "type": "string" }, "testCaseId": { diff --git a/jsonschema/src/Timestamp.json b/jsonschema/src/Timestamp.json index d27103b3..a63aa6f7 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\n second values with fractions must still have non-negative nanos values\n that count forward in time. Must be from 0 to 999,999,999\n inclusive.", - "type": "integer" + "type": "integer", + "minimum": 0, + "maximum": 9999999999 } }, "type": "object" diff --git a/perl/lib/Cucumber/Messages.pm b/perl/lib/Cucumber/Messages.pm index 8b6ca712..6125a328 100644 --- a/perl/lib/Cucumber/Messages.pm +++ b/perl/lib/Cucumber/Messages.pm @@ -101,8 +101,7 @@ sub _types { =head4 body -* - The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment +The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment is simply the string. If it's `BASE64`, the string should be Base64 decoded to obtain the attachment. =cut @@ -116,8 +115,7 @@ has body => =head4 content_encoding -* - Whether to interpret `body` "as-is" (IDENTITY) or if it needs to be Base64-decoded (BASE64). +Whether to interpret `body` "as-is" (IDENTITY) or if it needs to be Base64-decoded (BASE64). Content encoding is *not* determined by the media type, but rather by the type of the object being attached: @@ -153,8 +151,7 @@ has content_encoding => =head4 file_name -* - 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`) =cut has file_name => @@ -164,8 +161,7 @@ has file_name => =head4 media_type -* - The media type of the data. This can be any valid +The media type of the data. This can be any valid [IANA Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml) as well as Cucumber-specific media types such as `text/x.cucumber.gherkin+plain` and `text/x.cucumber.stacktrace+plain` @@ -210,8 +206,7 @@ has test_step_id => =head4 url -* - 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: @@ -649,8 +644,7 @@ package Cucumber::Messages::GherkinDocument { Represents the GherkinDocument message in Cucumber's L. -* - The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document. +The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document. Cucumber implementations should *not* depend on `GherkinDocument` or any of its children for execution - use [Pickle](#io.cucumber.messages.Pickle) instead. @@ -682,8 +676,7 @@ sub _types { =head4 uri -* - 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 =cut @@ -836,8 +829,7 @@ package Cucumber::Messages::Comment { Represents the Comment message in Cucumber's L. -* - A comment in a Gherkin document +A comment in a Gherkin document =head3 ATTRIBUTES @@ -1297,8 +1289,7 @@ package Cucumber::Messages::FeatureChild { Represents the FeatureChild message in Cucumber's L. -* - A child node of a `Feature` node +A child node of a `Feature` node =head3 ATTRIBUTES @@ -1488,8 +1479,7 @@ package Cucumber::Messages::RuleChild { Represents the RuleChild message in Cucumber's L. -* - A child node of a `Rule` node +A child node of a `Rule` node =head3 ATTRIBUTES @@ -1956,8 +1946,7 @@ package Cucumber::Messages::Tag { Represents the Tag message in Cucumber's L. -* - A tag +A tag =head3 ATTRIBUTES @@ -2150,8 +2139,7 @@ package Cucumber::Messages::Location { Represents the Location message in Cucumber's L. -* - Points to a line and a column in a text file +Points to a line and a column in a text file =head3 ATTRIBUTES @@ -2208,8 +2196,7 @@ package Cucumber::Messages::Meta { Represents the Meta message in Cucumber's L. -* - This message contains meta information about the environment. Consumers can use +This message contains meta information about the environment. Consumers can use this for various purposes. =head3 ATTRIBUTES @@ -2240,8 +2227,7 @@ sub _types { =head4 protocol_version -* - The [SEMVER](https://semver.org/) version number of the protocol +The [SEMVER](https://semver.org/) version number of the protocol =cut has protocol_version => @@ -2749,8 +2735,7 @@ sub _types { =head4 id -* - A unique id for the pickle +A unique id for the pickle =cut has id => @@ -2810,8 +2795,7 @@ has steps => =head4 tags -* - One or more tags. If this pickle is constructed from a Gherkin document, +One or more tags. If this pickle is constructed from a Gherkin document, It includes inherited tags from the `Feature` as well. =cut @@ -2824,8 +2808,7 @@ has tags => =head4 ast_node_ids -* - Points to the AST node locations of the pickle. The last one represents the unique +Points to the AST node locations of the pickle. The last one represents the unique 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. =cut @@ -2905,8 +2888,7 @@ package Cucumber::Messages::PickleStep { Represents the PickleStep message in Cucumber's L. -* - An executable step +An executable step =head3 ATTRIBUTES @@ -3219,8 +3201,7 @@ package Cucumber::Messages::PickleTag { Represents the PickleTag message in Cucumber's L. -* - A tag +A tag =head3 ATTRIBUTES @@ -3309,8 +3290,7 @@ sub _types { =head4 uri -* - 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 =cut @@ -3374,8 +3354,7 @@ package Cucumber::Messages::SourceReference { Represents the SourceReference message in Cucumber's L. -* - Points to a [Source](#io.cucumber.messages.Source) identified by `uri` and a +Points to a [Source](#io.cucumber.messages.Source) identified by `uri` and a [Location](#io.cucumber.messages.Location) within that file. =head3 ATTRIBUTES @@ -3899,8 +3878,7 @@ package Cucumber::Messages::StepMatchArgument { Represents the StepMatchArgument message in Cucumber's L. -* - Represents a single argument extracted from a step match and passed to a step definition. +Represents a single argument extracted from a step match and passed to a step definition. This is used for the following purposes: - Construct an argument to pass to a step definition (possibly through a parameter type transform) - Highlight the matched parameter in rich formatters such as the HTML formatter @@ -3931,8 +3909,7 @@ sub _types { =head4 group -* - Represents the outermost capture group of an argument. This message closely matches the +Represents the outermost capture group of an argument. This message closely matches the `Group` class in the `cucumber-expressions` library. =cut @@ -4010,8 +3987,7 @@ package Cucumber::Messages::TestStep { Represents the TestStep message in Cucumber's L. -* - A `TestStep` is derived from either a `PickleStep` +A `TestStep` is derived from either a `PickleStep` combined with a `StepDefinition`, or from a `Hook`. =head3 ATTRIBUTES @@ -4205,8 +4181,7 @@ sub _types { =head4 attempt -* - The first attempt should have value 0, and for each retry the value +The first attempt should have value 0, and for each retry the value should increase by 1. =cut @@ -4219,8 +4194,7 @@ has attempt => =head4 id -* - Because a `TestCase` can be run multiple times (in case of a retry), +Because a `TestCase` can be run multiple times (in case of a retry), we use this field to group messages relating to the same attempt. =cut diff --git a/python/src/cucumber_messages/_messages.py b/python/src/cucumber_messages/_messages.py index 1e2ad28c..cd27b8b3 100644 --- a/python/src/cucumber_messages/_messages.py +++ b/python/src/cucumber_messages/_messages.py @@ -26,16 +26,14 @@ class Attachment: """ body: str """ - * - The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment + The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment is simply the string. If it's `BASE64`, the string should be Base64 decoded to obtain the attachment. """ content_encoding: AttachmentContentEncoding """ - * - Whether to interpret `body` "as-is" (IDENTITY) or if it needs to be Base64-decoded (BASE64). + Whether to interpret `body` "as-is" (IDENTITY) or if it needs to be Base64-decoded (BASE64). Content encoding is *not* determined by the media type, but rather by the type of the object being attached: @@ -47,19 +45,13 @@ class Attachment: media_type: str """ - * - The media type of the data. This can be any valid + The media type of the data. This can be any valid [IANA Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml) as well as Cucumber-specific media types such as `text/x.cucumber.gherkin+plain` and `text/x.cucumber.stacktrace+plain` """ - file_name: Optional[str] = None - """ - * - Suggested file name of the attachment. (Provided by the user as an argument to `attach`) - """ - + file_name: Optional[str] = None # Suggested file name of the attachment. (Provided by the user as an argument to `attach`) source: Optional[Source] = None test_case_started_id: Optional[str] = None # The identifier of the test case attempt if the attachment was created during the execution of a test step test_run_hook_started_id: Optional[str] = None # The identifier of the test run hook execution if the attachment was created during the execution of a test run hook @@ -68,8 +60,7 @@ class Attachment: timestamp: Optional[Timestamp] = None # When the attachment was created url: Optional[str] = None """ - * - 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: @@ -146,8 +137,7 @@ class Exception: @dataclass class GherkinDocument: """ - * - The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document. + The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document. Cucumber implementations should *not* depend on `GherkinDocument` or any of its children for execution - use [Pickle](#io.cucumber.messages.Pickle) instead. @@ -158,8 +148,7 @@ class GherkinDocument: feature: Optional[Feature] = None uri: Optional[str] = None """ - * - 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 """ @@ -178,8 +167,7 @@ class Background: @dataclass class Comment: """ - * - A comment in a Gherkin document + A comment in a Gherkin document """ location: Location # The location of the comment text: str # The text of the comment @@ -225,8 +213,7 @@ class Feature: @dataclass class FeatureChild: """ - * - A child node of a `Feature` node + A child node of a `Feature` node """ background: Optional[Background] = None rule: Optional[Rule] = None @@ -247,8 +234,7 @@ class Rule: @dataclass class RuleChild: """ - * - A child node of a `Rule` node + A child node of a `Rule` node """ background: Optional[Background] = None scenario: Optional[Scenario] = None @@ -302,8 +288,7 @@ class TableRow: @dataclass class Tag: """ - * - A tag + A tag """ id: str # Unique ID to be able to reference the Tag from PickleTag location: Location # Location of the tag @@ -322,8 +307,7 @@ class Hook: @dataclass class Location: """ - * - Points to a line and a column in a text file + Points to a line and a column in a text file """ line: int column: Optional[int] = None @@ -332,19 +316,13 @@ class Location: @dataclass class Meta: """ - * - This message contains meta information about the environment. Consumers can use + This message contains meta information about the environment. Consumers can use this for various purposes. """ cpu: Product # 386, arm, amd64 etc implementation: Product # SpecFlow, Cucumber-JVM, Cucumber.js, Cucumber-Ruby, Behat etc. os: Product # Windows, Linux, MacOS etc - protocol_version: str - """ - * - The [SEMVER](https://semver.org/) version number of the protocol - """ - + protocol_version: str # The [SEMVER](https://semver.org/) version number of the protocol runtime: Product # Java, Ruby, Node.js etc ci: Optional[Ci] = None @@ -416,25 +394,18 @@ class Pickle: """ ast_node_ids: list[str] """ - * - Points to the AST node locations of the pickle. The last one represents the unique + Points to the AST node locations of the pickle. The last one represents the unique 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. """ - id: str - """ - * - A unique id for the pickle - """ - + id: str # A unique id for the pickle language: str # The language of the pickle name: str # The name of the pickle steps: list[PickleStep] # One or more steps tags: list[PickleTag] """ - * - One or more tags. If this pickle is constructed from a Gherkin document, + One or more tags. If this pickle is constructed from a Gherkin document, It includes inherited tags from the `Feature` as well. """ @@ -450,8 +421,7 @@ class PickleDocString: @dataclass class PickleStep: """ - * - An executable step + An executable step """ ast_node_ids: list[str] """ @@ -498,8 +468,7 @@ class PickleTableRow: @dataclass class PickleTag: """ - * - A tag + A tag """ ast_node_id: str # Points to the AST node this was created from name: str @@ -522,8 +491,7 @@ class Source: uri: str """ - * - 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 """ @@ -532,8 +500,7 @@ class Source: @dataclass class SourceReference: """ - * - Points to a [Source](#io.cucumber.messages.Source) identified by `uri` and a + Points to a [Source](#io.cucumber.messages.Source) identified by `uri` and a [Location](#io.cucumber.messages.Location) within that file. """ java_method: Optional[JavaMethod] = None @@ -593,8 +560,7 @@ class Group: @dataclass class StepMatchArgument: """ - * - Represents a single argument extracted from a step match and passed to a step definition. + Represents a single argument extracted from a step match and passed to a step definition. This is used for the following purposes: - Construct an argument to pass to a step definition (possibly through a parameter type transform) - Highlight the matched parameter in rich formatters such as the HTML formatter @@ -603,8 +569,7 @@ class StepMatchArgument: """ group: Group """ - * - Represents the outermost capture group of an argument. This message closely matches the + Represents the outermost capture group of an argument. This message closely matches the `Group` class in the `cucumber-expressions` library. """ @@ -619,8 +584,7 @@ class StepMatchArgumentsList: @dataclass class TestStep: """ - * - A `TestStep` is derived from either a `PickleStep` + A `TestStep` is derived from either a `PickleStep` combined with a `StepDefinition`, or from a `Hook`. """ id: str @@ -647,15 +611,13 @@ class TestCaseFinished: class TestCaseStarted: attempt: int """ - * - The first attempt should have value 0, and for each retry the value + The first attempt should have value 0, and for each retry the value should increase by 1. """ id: str """ - * - Because a `TestCase` can be run multiple times (in case of a retry), + Because a `TestCase` can be run multiple times (in case of a retry), we use this field to group messages relating to the same attempt. """ diff --git a/ruby/lib/cucumber/messages/attachment.rb b/ruby/lib/cucumber/messages/attachment.rb index e81cae40..0b275c84 100644 --- a/ruby/lib/cucumber/messages/attachment.rb +++ b/ruby/lib/cucumber/messages/attachment.rb @@ -22,16 +22,14 @@ module Messages ## class Attachment < Message ## - # * - # The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment + # The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment # is simply the string. If it's `BASE64`, the string should be Base64 decoded to # obtain the attachment. ## attr_reader :body ## - # * - # Whether to interpret `body` "as-is" (IDENTITY) or if it needs to be Base64-decoded (BASE64). + # Whether to interpret `body` "as-is" (IDENTITY) or if it needs to be Base64-decoded (BASE64). # # Content encoding is *not* determined by the media type, but rather by the type # of the object being attached: @@ -43,14 +41,12 @@ class Attachment < Message attr_reader :content_encoding ## - # * - # 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`) ## attr_reader :file_name ## - # * - # The media type of the data. This can be any valid + # The media type of the data. This can be any valid # [IANA Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml) # as well as Cucumber-specific media types such as `text/x.cucumber.gherkin+plain` # and `text/x.cucumber.stacktrace+plain` @@ -70,8 +66,7 @@ class Attachment < Message attr_reader :test_step_id ## - # * - # 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: # diff --git a/ruby/lib/cucumber/messages/comment.rb b/ruby/lib/cucumber/messages/comment.rb index db426989..f160d181 100644 --- a/ruby/lib/cucumber/messages/comment.rb +++ b/ruby/lib/cucumber/messages/comment.rb @@ -7,8 +7,7 @@ module Messages # Represents the Comment message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # A comment in a Gherkin document + # A comment in a Gherkin document ## class Comment < Message ## diff --git a/ruby/lib/cucumber/messages/feature_child.rb b/ruby/lib/cucumber/messages/feature_child.rb index 6a00543d..904ba8a1 100644 --- a/ruby/lib/cucumber/messages/feature_child.rb +++ b/ruby/lib/cucumber/messages/feature_child.rb @@ -7,8 +7,7 @@ module Messages # Represents the FeatureChild message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # A child node of a `Feature` node + # A child node of a `Feature` node ## class FeatureChild < Message attr_reader :rule diff --git a/ruby/lib/cucumber/messages/gherkin_document.rb b/ruby/lib/cucumber/messages/gherkin_document.rb index 8abd5896..ce1f34cb 100644 --- a/ruby/lib/cucumber/messages/gherkin_document.rb +++ b/ruby/lib/cucumber/messages/gherkin_document.rb @@ -7,8 +7,7 @@ module Messages # Represents the GherkinDocument message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document. + # The [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of a Gherkin document. # Cucumber implementations should *not* depend on `GherkinDocument` or any of its # children for execution - use [Pickle](#io.cucumber.messages.Pickle) instead. # @@ -17,8 +16,7 @@ module Messages ## class GherkinDocument < Message ## - # * - # 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 ## attr_reader :uri diff --git a/ruby/lib/cucumber/messages/location.rb b/ruby/lib/cucumber/messages/location.rb index 3b8319ef..8cfe963b 100644 --- a/ruby/lib/cucumber/messages/location.rb +++ b/ruby/lib/cucumber/messages/location.rb @@ -7,8 +7,7 @@ module Messages # Represents the Location message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # Points to a line and a column in a text file + # Points to a line and a column in a text file ## class Location < Message attr_reader :line diff --git a/ruby/lib/cucumber/messages/meta.rb b/ruby/lib/cucumber/messages/meta.rb index e60ae5aa..1776d1df 100644 --- a/ruby/lib/cucumber/messages/meta.rb +++ b/ruby/lib/cucumber/messages/meta.rb @@ -7,14 +7,12 @@ module Messages # Represents the Meta message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # This message contains meta information about the environment. Consumers can use + # This message contains meta information about the environment. Consumers can use # this for various purposes. ## class Meta < Message ## - # * - # The [SEMVER](https://semver.org/) version number of the protocol + # The [SEMVER](https://semver.org/) version number of the protocol ## attr_reader :protocol_version diff --git a/ruby/lib/cucumber/messages/pickle.rb b/ruby/lib/cucumber/messages/pickle.rb index b8b54ea5..6c3c58f6 100644 --- a/ruby/lib/cucumber/messages/pickle.rb +++ b/ruby/lib/cucumber/messages/pickle.rb @@ -23,8 +23,7 @@ module Messages ## class Pickle < Message ## - # * - # A unique id for the pickle + # A unique id for the pickle ## attr_reader :id @@ -49,15 +48,13 @@ class Pickle < Message attr_reader :steps ## - # * - # One or more tags. If this pickle is constructed from a Gherkin document, + # One or more tags. If this pickle is constructed from a Gherkin document, # It includes inherited tags from the `Feature` as well. ## attr_reader :tags ## - # * - # Points to the AST node locations of the pickle. The last one represents the unique + # Points to the AST node locations of the pickle. The last one represents the unique # 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. ## diff --git a/ruby/lib/cucumber/messages/pickle_step.rb b/ruby/lib/cucumber/messages/pickle_step.rb index 8b66e487..c71a3f55 100644 --- a/ruby/lib/cucumber/messages/pickle_step.rb +++ b/ruby/lib/cucumber/messages/pickle_step.rb @@ -7,8 +7,7 @@ module Messages # Represents the PickleStep message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # An executable step + # An executable step ## class PickleStep < Message attr_reader :argument diff --git a/ruby/lib/cucumber/messages/pickle_tag.rb b/ruby/lib/cucumber/messages/pickle_tag.rb index 7b44dbc9..a6e477ac 100644 --- a/ruby/lib/cucumber/messages/pickle_tag.rb +++ b/ruby/lib/cucumber/messages/pickle_tag.rb @@ -7,8 +7,7 @@ module Messages # Represents the PickleTag message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # A tag + # A tag ## class PickleTag < Message attr_reader :name diff --git a/ruby/lib/cucumber/messages/rule_child.rb b/ruby/lib/cucumber/messages/rule_child.rb index 91fa41f8..b96c9c77 100644 --- a/ruby/lib/cucumber/messages/rule_child.rb +++ b/ruby/lib/cucumber/messages/rule_child.rb @@ -7,8 +7,7 @@ module Messages # Represents the RuleChild message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # A child node of a `Rule` node + # A child node of a `Rule` node ## class RuleChild < Message attr_reader :background diff --git a/ruby/lib/cucumber/messages/source.rb b/ruby/lib/cucumber/messages/source.rb index 9aae553e..18a2f4a2 100644 --- a/ruby/lib/cucumber/messages/source.rb +++ b/ruby/lib/cucumber/messages/source.rb @@ -14,8 +14,7 @@ module Messages ## class Source < Message ## - # * - # 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 ## attr_reader :uri diff --git a/ruby/lib/cucumber/messages/source_reference.rb b/ruby/lib/cucumber/messages/source_reference.rb index 1a947674..5c802e07 100644 --- a/ruby/lib/cucumber/messages/source_reference.rb +++ b/ruby/lib/cucumber/messages/source_reference.rb @@ -7,8 +7,7 @@ module Messages # Represents the SourceReference message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # Points to a [Source](#io.cucumber.messages.Source) identified by `uri` and a + # Points to a [Source](#io.cucumber.messages.Source) identified by `uri` and a # [Location](#io.cucumber.messages.Location) within that file. ## class SourceReference < Message diff --git a/ruby/lib/cucumber/messages/step_match_argument.rb b/ruby/lib/cucumber/messages/step_match_argument.rb index 3fcdd4d2..c03c4ee6 100644 --- a/ruby/lib/cucumber/messages/step_match_argument.rb +++ b/ruby/lib/cucumber/messages/step_match_argument.rb @@ -7,8 +7,7 @@ module Messages # Represents the StepMatchArgument message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # Represents a single argument extracted from a step match and passed to a step definition. + # Represents a single argument extracted from a step match and passed to a step definition. # This is used for the following purposes: # - Construct an argument to pass to a step definition (possibly through a parameter type transform) # - Highlight the matched parameter in rich formatters such as the HTML formatter @@ -17,8 +16,7 @@ module Messages ## class StepMatchArgument < Message ## - # * - # Represents the outermost capture group of an argument. This message closely matches the + # Represents the outermost capture group of an argument. This message closely matches the # `Group` class in the `cucumber-expressions` library. ## attr_reader :group diff --git a/ruby/lib/cucumber/messages/tag.rb b/ruby/lib/cucumber/messages/tag.rb index 0a00c21b..5a4d5786 100644 --- a/ruby/lib/cucumber/messages/tag.rb +++ b/ruby/lib/cucumber/messages/tag.rb @@ -7,8 +7,7 @@ module Messages # Represents the Tag message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # A tag + # A tag ## class Tag < Message ## diff --git a/ruby/lib/cucumber/messages/test_case_started.rb b/ruby/lib/cucumber/messages/test_case_started.rb index dec26f99..3f9a4e20 100644 --- a/ruby/lib/cucumber/messages/test_case_started.rb +++ b/ruby/lib/cucumber/messages/test_case_started.rb @@ -9,15 +9,13 @@ module Messages ## class TestCaseStarted < Message ## - # * - # The first attempt should have value 0, and for each retry the value + # The first attempt should have value 0, and for each retry the value # should increase by 1. ## attr_reader :attempt ## - # * - # Because a `TestCase` can be run multiple times (in case of a retry), + # Because a `TestCase` can be run multiple times (in case of a retry), # we use this field to group messages relating to the same attempt. ## attr_reader :id diff --git a/ruby/lib/cucumber/messages/test_step.rb b/ruby/lib/cucumber/messages/test_step.rb index 4da93aa3..8157fd7b 100644 --- a/ruby/lib/cucumber/messages/test_step.rb +++ b/ruby/lib/cucumber/messages/test_step.rb @@ -7,8 +7,7 @@ module Messages # Represents the TestStep message in Cucumber's {message protocol}[https://github.com/cucumber/messages]. ## # - # * - # A `TestStep` is derived from either a `PickleStep` + # A `TestStep` is derived from either a `PickleStep` # combined with a `StepDefinition`, or from a `Hook`. ## class TestStep < Message From 7bbbf009c0ac2d1ae269f9664fcdf1fb5a9ce912 Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Fri, 18 Jul 2025 14:51:23 +0200 Subject: [PATCH 03/16] Reduce diff --- jsonschema/src/Duration.json | 2 +- perl/lib/Cucumber/Messages.pm | 2 +- python/src/cucumber_messages/_messages.py | 2 +- ruby/lib/cucumber/messages/duration.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jsonschema/src/Duration.json b/jsonschema/src/Duration.json index 56a53780..cd14b78f 100644 --- a/jsonschema/src/Duration.json +++ b/jsonschema/src/Duration.json @@ -12,7 +12,7 @@ "type": "integer" }, "nanos": { - "description": "Non-negative fractions of a second at nanosecond resolution. Negative\n second values with fractions must still have non-negative nanos values\n that count forward in time. Must be from 0 to 999,999,999\n inclusive.", + "description": "Non-negative fractions of a second at nanosecond resolution. Negative\nsecond values with fractions must still have non-negative nanos values\n that count forward in time. Must be from 0 to 999,999,999\n inclusive.", "type": "integer", "minimum": 0, "maximum": 9999999999 diff --git a/perl/lib/Cucumber/Messages.pm b/perl/lib/Cucumber/Messages.pm index 1555d22d..52e83fc5 100644 --- a/perl/lib/Cucumber/Messages.pm +++ b/perl/lib/Cucumber/Messages.pm @@ -304,7 +304,7 @@ has seconds => =head4 nanos Non-negative fractions of a second at nanosecond resolution. Negative - second values with fractions must still have non-negative nanos values +second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. =cut diff --git a/python/src/cucumber_messages/_messages.py b/python/src/cucumber_messages/_messages.py index 76cc2059..06dc4ade 100644 --- a/python/src/cucumber_messages/_messages.py +++ b/python/src/cucumber_messages/_messages.py @@ -83,7 +83,7 @@ class Duration: nanos: int """ Non-negative fractions of a second at nanosecond resolution. Negative - second values with fractions must still have non-negative nanos values + second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. """ diff --git a/ruby/lib/cucumber/messages/duration.rb b/ruby/lib/cucumber/messages/duration.rb index ec1fa9ec..83ddb795 100644 --- a/ruby/lib/cucumber/messages/duration.rb +++ b/ruby/lib/cucumber/messages/duration.rb @@ -15,7 +15,7 @@ class Duration < Message ## # Non-negative fractions of a second at nanosecond resolution. Negative - # second values with fractions must still have non-negative nanos values + # second values with fractions must still have non-negative nanos values # that count forward in time. Must be from 0 to 999,999,999 # inclusive. ## From 6e677010b82b16b50cab0d46b6ab97ee47d3b7da Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Fri, 18 Jul 2025 14:51:57 +0200 Subject: [PATCH 04/16] Reduce diff --- jsonschema/src/Duration.json | 2 +- perl/lib/Cucumber/Messages.pm | 2 +- python/src/cucumber_messages/_messages.py | 2 +- ruby/lib/cucumber/messages/duration.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jsonschema/src/Duration.json b/jsonschema/src/Duration.json index cd14b78f..aba6d0f7 100644 --- a/jsonschema/src/Duration.json +++ b/jsonschema/src/Duration.json @@ -12,7 +12,7 @@ "type": "integer" }, "nanos": { - "description": "Non-negative fractions of a second at nanosecond resolution. Negative\nsecond values with fractions must still have non-negative nanos values\n that count forward in time. Must be from 0 to 999,999,999\n inclusive.", + "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\n inclusive.", "type": "integer", "minimum": 0, "maximum": 9999999999 diff --git a/perl/lib/Cucumber/Messages.pm b/perl/lib/Cucumber/Messages.pm index 52e83fc5..5eb4fc21 100644 --- a/perl/lib/Cucumber/Messages.pm +++ b/perl/lib/Cucumber/Messages.pm @@ -305,7 +305,7 @@ has seconds => Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values - that count forward in time. Must be from 0 to 999,999,999 +that count forward in time. Must be from 0 to 999,999,999 inclusive. =cut diff --git a/python/src/cucumber_messages/_messages.py b/python/src/cucumber_messages/_messages.py index 06dc4ade..17f63f15 100644 --- a/python/src/cucumber_messages/_messages.py +++ b/python/src/cucumber_messages/_messages.py @@ -84,7 +84,7 @@ class Duration: """ Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values - that count forward in time. Must be from 0 to 999,999,999 + that count forward in time. Must be from 0 to 999,999,999 inclusive. """ diff --git a/ruby/lib/cucumber/messages/duration.rb b/ruby/lib/cucumber/messages/duration.rb index 83ddb795..1bdd1889 100644 --- a/ruby/lib/cucumber/messages/duration.rb +++ b/ruby/lib/cucumber/messages/duration.rb @@ -16,7 +16,7 @@ class Duration < Message ## # Non-negative fractions of a second at nanosecond resolution. Negative # second values with fractions must still have non-negative nanos values - # that count forward in time. Must be from 0 to 999,999,999 + # that count forward in time. Must be from 0 to 999,999,999 # inclusive. ## attr_reader :nanos From db27e26b5992875b898579119bfd03913cfd8f52 Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Fri, 18 Jul 2025 14:52:26 +0200 Subject: [PATCH 05/16] Reduce diff --- jsonschema/src/Duration.json | 2 +- perl/lib/Cucumber/Messages.pm | 2 +- python/src/cucumber_messages/_messages.py | 2 +- ruby/lib/cucumber/messages/duration.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jsonschema/src/Duration.json b/jsonschema/src/Duration.json index aba6d0f7..c111eba3 100644 --- a/jsonschema/src/Duration.json +++ b/jsonschema/src/Duration.json @@ -12,7 +12,7 @@ "type": "integer" }, "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\n inclusive.", + "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", "minimum": 0, "maximum": 9999999999 diff --git a/perl/lib/Cucumber/Messages.pm b/perl/lib/Cucumber/Messages.pm index 5eb4fc21..c99ba2b9 100644 --- a/perl/lib/Cucumber/Messages.pm +++ b/perl/lib/Cucumber/Messages.pm @@ -306,7 +306,7 @@ has seconds => Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 - inclusive. +inclusive. =cut has nanos => diff --git a/python/src/cucumber_messages/_messages.py b/python/src/cucumber_messages/_messages.py index 17f63f15..aa1a5e82 100644 --- a/python/src/cucumber_messages/_messages.py +++ b/python/src/cucumber_messages/_messages.py @@ -85,7 +85,7 @@ class Duration: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 - inclusive. + inclusive. """ seconds: int diff --git a/ruby/lib/cucumber/messages/duration.rb b/ruby/lib/cucumber/messages/duration.rb index 1bdd1889..43bfd069 100644 --- a/ruby/lib/cucumber/messages/duration.rb +++ b/ruby/lib/cucumber/messages/duration.rb @@ -17,7 +17,7 @@ class Duration < Message # Non-negative fractions of a second at nanosecond resolution. Negative # second values with fractions must still have non-negative nanos values # that count forward in time. Must be from 0 to 999,999,999 - # inclusive. + # inclusive. ## attr_reader :nanos From b149e9da56ae76e0c4be2b7436079da453f7e4e2 Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Fri, 18 Jul 2025 14:59:47 +0200 Subject: [PATCH 06/16] Fix range on nanos --- .../generated/java/io/cucumber/messages/types/Duration.java | 6 +++--- .../java/io/cucumber/messages/types/Timestamp.java | 6 +++--- java/src/main/java/io/cucumber/messages/Convertor.java | 5 +++-- jsonschema/src/Duration.json | 2 +- jsonschema/src/Timestamp.json | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) 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..f780675c 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Duration.java +++ b/java/src/generated/java/io/cucumber/messages/types/Duration.java @@ -17,11 +17,11 @@ @SuppressWarnings("unused") 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 +37,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/Timestamp.java b/java/src/generated/java/io/cucumber/messages/types/Timestamp.java index 7a550315..5142aee4 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Timestamp.java +++ b/java/src/generated/java/io/cucumber/messages/types/Timestamp.java @@ -14,11 +14,11 @@ @SuppressWarnings("unused") 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 +39,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/main/java/io/cucumber/messages/Convertor.java b/java/src/main/java/io/cucumber/messages/Convertor.java index fcff908f..cb4386d6 100644 --- a/java/src/main/java/io/cucumber/messages/Convertor.java +++ b/java/src/main/java/io/cucumber/messages/Convertor.java @@ -6,6 +6,7 @@ import java.io.PrintWriter; import java.io.StringWriter; +import java.time.Instant; import static java.util.Objects.requireNonNull; @@ -30,12 +31,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/jsonschema/src/Duration.json b/jsonschema/src/Duration.json index c111eba3..c3ad4dc7 100644 --- a/jsonschema/src/Duration.json +++ b/jsonschema/src/Duration.json @@ -15,7 +15,7 @@ "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", "minimum": 0, - "maximum": 9999999999 + "maximum": 999999999 } }, "type": "object" diff --git a/jsonschema/src/Timestamp.json b/jsonschema/src/Timestamp.json index 30510a0d..81395aa4 100644 --- a/jsonschema/src/Timestamp.json +++ b/jsonschema/src/Timestamp.json @@ -15,7 +15,7 @@ "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", "minimum": 0, - "maximum": 9999999999 + "maximum": 999999999 } }, "type": "object" From c2bc505cbb6e40a0682dbf94835ce467ddc788c6 Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Fri, 18 Jul 2025 15:01:24 +0200 Subject: [PATCH 07/16] Consistency --- codegen/generators/cpp.rb | 2 +- codegen/generators/dotnet.rb | 2 +- codegen/generators/go.rb | 2 +- codegen/generators/markdown.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/codegen/generators/cpp.rb b/codegen/generators/cpp.rb index 95ac3cb0..e201d945 100644 --- a/codegen/generators/cpp.rb +++ b/codegen/generators/cpp.rb @@ -26,7 +26,7 @@ def select_language_translations_for_data_types(type, property) 'integer' => 'std::size_t', 'string' => 'std::string', 'boolean' => 'bool' - }.fetch(type) + }[type] end end end diff --git a/codegen/generators/dotnet.rb b/codegen/generators/dotnet.rb index 9d25fa87..10af3cf7 100644 --- a/codegen/generators/dotnet.rb +++ b/codegen/generators/dotnet.rb @@ -26,7 +26,7 @@ def select_language_translations_for_data_types(type, property) 'integer' => 'long', 'string' => 'string', 'boolean' => 'bool' - }.fetch(type) + }[type] end end end diff --git a/codegen/generators/go.rb b/codegen/generators/go.rb index bbeb3b5a..de899650 100644 --- a/codegen/generators/go.rb +++ b/codegen/generators/go.rb @@ -19,7 +19,7 @@ def select_language_translations_for_data_types(type, property) 'integer' => 'int64', 'string' => 'string', 'boolean' => 'bool' - }.fetch(type) + }[type] end end end diff --git a/codegen/generators/markdown.rb b/codegen/generators/markdown.rb index 94c79c44..d4cbe553 100644 --- a/codegen/generators/markdown.rb +++ b/codegen/generators/markdown.rb @@ -25,7 +25,7 @@ def select_language_translations_for_data_types(type, property) 'integer' => 'integer', 'string' => 'string', 'boolean' => 'boolean' - }.fetch(type) + }[type] end end end From 60ec8439843e33f002b7d47cdcea6e6b457a3721 Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Fri, 18 Jul 2025 19:32:45 +0200 Subject: [PATCH 08/16] Fix location.line bound --- jsonschema/src/Location.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema/src/Location.json b/jsonschema/src/Location.json index 0e700cac..074d32ae 100644 --- a/jsonschema/src/Location.json +++ b/jsonschema/src/Location.json @@ -6,7 +6,7 @@ "properties": { "line": { "type": "integer", - "minimum": 0, + "minimum": 1, "maximum": 2147483647 }, "column": { From 01acc5c46c265df842ab23da26c0c8649827a85f Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Fri, 18 Jul 2025 19:36:12 +0200 Subject: [PATCH 09/16] Fix --- java/src/test/java/io/cucumber/messages/JacksonTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); } From 1fdbf902a1b11b209db7426ca14f52ce6e2de439 Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Tue, 4 Nov 2025 15:21:52 +0100 Subject: [PATCH 10/16] Use Java 17 * Set default release version to 17 * Enable Error prone with Nullaway --- codegen/generators/java.rb | 2 +- codegen/templates/java.java.erb | 17 ++-- java/.mvn/jvm.config | 10 +++ java/pom.xml | 9 +- .../cucumber/messages/types/Attachment.java | 37 ++++---- .../cucumber/messages/types/Background.java | 11 ++- .../java/io/cucumber/messages/types/Ci.java | 17 ++-- .../io/cucumber/messages/types/Comment.java | 5 +- .../io/cucumber/messages/types/DataTable.java | 11 ++- .../io/cucumber/messages/types/DocString.java | 9 +- .../io/cucumber/messages/types/Duration.java | 5 +- .../io/cucumber/messages/types/Envelope.java | 85 ++++++++++--------- .../io/cucumber/messages/types/Examples.java | 21 +++-- .../io/cucumber/messages/types/Exception.java | 13 +-- .../io/cucumber/messages/types/Feature.java | 17 ++-- .../cucumber/messages/types/FeatureChild.java | 17 ++-- .../messages/types/GherkinDocument.java | 19 +++-- .../java/io/cucumber/messages/types/Git.java | 13 +-- .../io/cucumber/messages/types/Group.java | 19 +++-- .../java/io/cucumber/messages/types/Hook.java | 17 ++-- .../cucumber/messages/types/JavaMethod.java | 11 ++- .../messages/types/JavaStackTraceElement.java | 5 +- .../io/cucumber/messages/types/Location.java | 9 +- .../java/io/cucumber/messages/types/Meta.java | 9 +- .../messages/types/ParameterType.java | 15 ++-- .../cucumber/messages/types/ParseError.java | 5 +- .../io/cucumber/messages/types/Pickle.java | 23 ++--- .../messages/types/PickleDocString.java | 9 +- .../cucumber/messages/types/PickleStep.java | 19 +++-- .../messages/types/PickleStepArgument.java | 13 +-- .../cucumber/messages/types/PickleTable.java | 11 ++- .../messages/types/PickleTableCell.java | 5 +- .../messages/types/PickleTableRow.java | 11 ++- .../io/cucumber/messages/types/PickleTag.java | 5 +- .../io/cucumber/messages/types/Product.java | 9 +- .../java/io/cucumber/messages/types/Rule.java | 17 ++-- .../io/cucumber/messages/types/RuleChild.java | 13 +-- .../io/cucumber/messages/types/Scenario.java | 23 ++--- .../io/cucumber/messages/types/Snippet.java | 5 +- .../io/cucumber/messages/types/Source.java | 5 +- .../messages/types/SourceReference.java | 21 +++-- .../java/io/cucumber/messages/types/Step.java | 17 ++-- .../messages/types/StepDefinition.java | 5 +- .../messages/types/StepDefinitionPattern.java | 5 +- .../messages/types/StepMatchArgument.java | 9 +- .../types/StepMatchArgumentsList.java | 11 ++- .../cucumber/messages/types/Suggestion.java | 11 ++- .../io/cucumber/messages/types/TableCell.java | 5 +- .../io/cucumber/messages/types/TableRow.java | 11 ++- .../java/io/cucumber/messages/types/Tag.java | 5 +- .../io/cucumber/messages/types/TestCase.java | 15 ++-- .../messages/types/TestCaseFinished.java | 5 +- .../messages/types/TestCaseStarted.java | 9 +- .../messages/types/TestRunFinished.java | 17 ++-- .../messages/types/TestRunHookFinished.java | 5 +- .../messages/types/TestRunHookStarted.java | 9 +- .../messages/types/TestRunStarted.java | 9 +- .../io/cucumber/messages/types/TestStep.java | 25 +++--- .../messages/types/TestStepFinished.java | 5 +- .../messages/types/TestStepResult.java | 13 +-- .../messages/types/TestStepStarted.java | 5 +- .../io/cucumber/messages/types/Timestamp.java | 5 +- .../types/UndefinedParameterType.java | 5 +- .../messages/NdjsonToMessageIterable.java | 7 +- .../TestStepResultStatusComparator.java | 1 + .../io/cucumber/messages/package-info.java | 4 + .../cucumber/messages/types/package-info.java | 4 + .../io/cucumber/messages/MessagesTest.java | 1 + 68 files changed, 516 insertions(+), 304 deletions(-) create mode 100644 java/.mvn/jvm.config create mode 100644 java/src/main/java/io/cucumber/messages/package-info.java create mode 100644 java/src/main/java/io/cucumber/messages/types/package-info.java diff --git a/codegen/generators/java.rb b/codegen/generators/java.rb index 8c7ee3f4..4e7761ac 100644 --- a/codegen/generators/java.rb +++ b/codegen/generators/java.rb @@ -5,7 +5,7 @@ module Generator # Automatic Code generation overrides for the Java programming language class Java < Base def array_type_for(type_name) - "java.util.List<#{type_name}>" + "List<#{type_name}>" end def format_description(raw_description, indent_string: '') diff --git a/codegen/templates/java.java.erb b/codegen/templates/java.java.erb index b29cf83b..0a8e2482 100644 --- a/codegen/templates/java.java.erb +++ b/codegen/templates/java.java.erb @@ -2,6 +2,9 @@ <%= class_name(key) %>.java package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -17,10 +20,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)| -%> @@ -44,8 +49,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)| diff --git a/java/.mvn/jvm.config b/java/.mvn/jvm.config new file mode 100644 index 00000000..8488a4fc --- /dev/null +++ b/java/.mvn/jvm.config @@ -0,0 +1,10 @@ +--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED +--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED +--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \ No newline at end of file diff --git a/java/pom.xml b/java/pom.xml index 0cce08e0..b9798ce8 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -5,7 +5,7 @@ io.cucumber cucumber-parent - 4.5.0 + 5.0.0-SNAPSHOT messages 30.1.1-SNAPSHOT @@ -53,6 +53,13 @@ + + + org.jspecify + jspecify + 1.0.0 + + com.fasterxml.jackson.core jackson-databind diff --git a/java/src/generated/java/io/cucumber/messages/types/Attachment.java b/java/src/generated/java/io/cucumber/messages/types/Attachment.java index 240d0cdc..1170c789 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Attachment.java +++ b/java/src/generated/java/io/cucumber/messages/types/Attachment.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -23,32 +26,32 @@ * is captured in `TestResult`. */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Attachment { private final String body; private final AttachmentContentEncoding contentEncoding; - private final String fileName; + private final @Nullable String fileName; private final String mediaType; - private final Source source; - private final String testCaseStartedId; - private final String testStepId; - private final String url; - private final String testRunStartedId; - private final String testRunHookStartedId; - private final Timestamp timestamp; + private final @Nullable Source source; + private final @Nullable String testCaseStartedId; + private final @Nullable String testStepId; + private final @Nullable String url; + private final @Nullable String testRunStartedId; + private final @Nullable String testRunHookStartedId; + private final @Nullable Timestamp timestamp; public Attachment( String body, AttachmentContentEncoding contentEncoding, - String fileName, + @Nullable String fileName, String mediaType, - Source source, - String testCaseStartedId, - String testStepId, - String url, - String testRunStartedId, - String testRunHookStartedId, - Timestamp timestamp + @Nullable Source source, + @Nullable String testCaseStartedId, + @Nullable String testStepId, + @Nullable String url, + @Nullable String testRunStartedId, + @Nullable String testRunHookStartedId, + @Nullable Timestamp timestamp ) { this.body = requireNonNull(body, "Attachment.body cannot be null"); this.contentEncoding = requireNonNull(contentEncoding, "Attachment.contentEncoding cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/Background.java b/java/src/generated/java/io/cucumber/messages/types/Background.java index d60acc2b..367cd380 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Background.java +++ b/java/src/generated/java/io/cucumber/messages/types/Background.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,13 +14,13 @@ * 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,7 +28,7 @@ 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"); @@ -55,7 +58,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..b7bb9a9f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Ci.java +++ b/java/src/generated/java/io/cucumber/messages/types/Ci.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,18 +16,18 @@ * CI environment */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Ci { private final String name; - private final String url; - private final String buildNumber; - private final Git git; + private final @Nullable String url; + private final @Nullable String buildNumber; + private final @Nullable Git git; public Ci( String name, - String url, - String buildNumber, - Git git + @Nullable String url, + @Nullable String buildNumber, + @Nullable Git git ) { this.name = requireNonNull(name, "Ci.name cannot be null"); this.url = url; diff --git a/java/src/generated/java/io/cucumber/messages/types/Comment.java b/java/src/generated/java/io/cucumber/messages/types/Comment.java index 8df2ee6f..a9f1e648 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Comment.java +++ b/java/src/generated/java/io/cucumber/messages/types/Comment.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,7 +16,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..8b30a641 100644 --- a/java/src/generated/java/io/cucumber/messages/types/DataTable.java +++ b/java/src/generated/java/io/cucumber/messages/types/DataTable.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,14 +14,14 @@ * 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"))); @@ -28,7 +31,7 @@ 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..bc065ac2 100644 --- a/java/src/generated/java/io/cucumber/messages/types/DocString.java +++ b/java/src/generated/java/io/cucumber/messages/types/DocString.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,16 +14,16 @@ * 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..6d8f3601 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Duration.java +++ b/java/src/generated/java/io/cucumber/messages/types/Duration.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -14,7 +17,7 @@ * of message is used. */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Duration { private final Long seconds; private final Long nanos; diff --git a/java/src/generated/java/io/cucumber/messages/types/Envelope.java b/java/src/generated/java/io/cucumber/messages/types/Envelope.java index b7534ed4..7f909ac7 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Envelope.java +++ b/java/src/generated/java/io/cucumber/messages/types/Envelope.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,28 +14,28 @@ * 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 +538,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..b796b4e3 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Examples.java +++ b/java/src/generated/java/io/cucumber/messages/types/Examples.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,25 +14,25 @@ * 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"); @@ -49,7 +52,7 @@ public Location getLocation() { return location; } - public java.util.List getTags() { + public List getTags() { return tags; } @@ -69,7 +72,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..487c76b9 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Exception.java +++ b/java/src/generated/java/io/cucumber/messages/types/Exception.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,16 +16,16 @@ * A simplified representation of an exception */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Exception { private final String type; - private final String message; - private final String stackTrace; + private final @Nullable String message; + private final @Nullable String stackTrace; public Exception( String type, - String message, - String stackTrace + @Nullable String message, + @Nullable String stackTrace ) { this.type = requireNonNull(type, "Exception.type cannot be null"); this.message = message; diff --git a/java/src/generated/java/io/cucumber/messages/types/Feature.java b/java/src/generated/java/io/cucumber/messages/types/Feature.java index 896b64fe..e5c998eb 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Feature.java +++ b/java/src/generated/java/io/cucumber/messages/types/Feature.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,24 +14,24 @@ * 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"))); @@ -49,7 +52,7 @@ public Location getLocation() { /** * All the tags placed above the `Feature` keyword */ - public java.util.List getTags() { + public List getTags() { return tags; } @@ -84,7 +87,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..cd62102f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/FeatureChild.java +++ b/java/src/generated/java/io/cucumber/messages/types/FeatureChild.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,11 +16,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 +47,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..8e4dc8a4 100644 --- a/java/src/generated/java/io/cucumber/messages/types/GherkinDocument.java +++ b/java/src/generated/java/io/cucumber/messages/types/GherkinDocument.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -18,16 +21,16 @@ * "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; @@ -49,7 +52,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..7a65c0a9 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Git.java +++ b/java/src/generated/java/io/cucumber/messages/types/Git.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -14,18 +17,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..fc2631d8 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Group.java +++ b/java/src/generated/java/io/cucumber/messages/types/Group.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,23 +14,23 @@ * Represents the Group message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Group { - private final java.util.List children; - private final Long start; - private final String value; + private final List children; + private final @Nullable Long start; + private final @Nullable String value; public Group( - java.util.List children, - Long start, - String value + List children, + @Nullable Long start, + @Nullable String value ) { this.children = unmodifiableList(new ArrayList<>(requireNonNull(children, "Group.children cannot be null"))); this.start = start; this.value = value; } - public java.util.List getChildren() { + public List getChildren() { return children; } diff --git a/java/src/generated/java/io/cucumber/messages/types/Hook.java b/java/src/generated/java/io/cucumber/messages/types/Hook.java index e1f20a47..3696290f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Hook.java +++ b/java/src/generated/java/io/cucumber/messages/types/Hook.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,20 +14,20 @@ * 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..c1ef18b3 100644 --- a/java/src/generated/java/io/cucumber/messages/types/JavaMethod.java +++ b/java/src/generated/java/io/cucumber/messages/types/JavaMethod.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,16 +14,16 @@ * 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"); @@ -35,7 +38,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..4f1d8f89 100644 --- a/java/src/generated/java/io/cucumber/messages/types/JavaStackTraceElement.java +++ b/java/src/generated/java/io/cucumber/messages/types/JavaStackTraceElement.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * 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..c390bcf0 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Location.java +++ b/java/src/generated/java/io/cucumber/messages/types/Location.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,14 +16,14 @@ * Points to a line and a column in a text file */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Location { private final Long line; - private final Long column; + private final @Nullable Long column; public Location( Long line, - Long column + @Nullable Long column ) { this.line = requireNonNull(line, "Location.line cannot be null"); this.column = column; diff --git a/java/src/generated/java/io/cucumber/messages/types/Meta.java b/java/src/generated/java/io/cucumber/messages/types/Meta.java index c9a64cfb..418c5dee 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Meta.java +++ b/java/src/generated/java/io/cucumber/messages/types/Meta.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -14,14 +17,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 +32,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..93e58de3 100644 --- a/java/src/generated/java/io/cucumber/messages/types/ParameterType.java +++ b/java/src/generated/java/io/cucumber/messages/types/ParameterType.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,22 +14,22 @@ * 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"))); @@ -43,7 +46,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..940db817 100644 --- a/java/src/generated/java/io/cucumber/messages/types/ParseError.java +++ b/java/src/generated/java/io/cucumber/messages/types/ParseError.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * 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..53ea3c70 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Pickle.java +++ b/java/src/generated/java/io/cucumber/messages/types/Pickle.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -22,24 +25,24 @@ * Each `PickleStep` of a `Pickle` is matched with a `StepDefinition` to create a `TestCase` */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Pickle { private final String id; private final String uri; private final String name; private final String language; - private final java.util.List steps; - private final java.util.List tags; - private final java.util.List astNodeIds; + private final List steps; + private final List tags; + private final List astNodeIds; public Pickle( String id, String uri, String name, String language, - java.util.List steps, - java.util.List tags, - java.util.List astNodeIds + List steps, + List tags, + List astNodeIds ) { this.id = requireNonNull(id, "Pickle.id cannot be null"); this.uri = requireNonNull(uri, "Pickle.uri cannot be null"); @@ -81,7 +84,7 @@ public String getLanguage() { /** * One or more steps */ - public java.util.List getSteps() { + public List getSteps() { return steps; } @@ -89,7 +92,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 +101,7 @@ public java.util.List getTags() { * id of the pickle. A pickle constructed from `Examples` will have the first * id originating from the `Scenario` AST node, and the second from the `TableRow` AST node. */ - public java.util.List getAstNodeIds() { + public List getAstNodeIds() { return astNodeIds; } diff --git a/java/src/generated/java/io/cucumber/messages/types/PickleDocString.java b/java/src/generated/java/io/cucumber/messages/types/PickleDocString.java index c88ae770..420c8986 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleDocString.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleDocString.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,13 +14,13 @@ * 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..76ff7f9f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleStep.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleStep.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,19 +16,19 @@ * 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; @@ -43,7 +46,7 @@ public Optional getArgument() { * References the IDs of the source of the step. For Gherkin, this can be * the ID of a Step, and possibly also the ID of a TableRow */ - public java.util.List getAstNodeIds() { + public List getAstNodeIds() { return astNodeIds; } diff --git a/java/src/generated/java/io/cucumber/messages/types/PickleStepArgument.java b/java/src/generated/java/io/cucumber/messages/types/PickleStepArgument.java index b0d9a3a0..055eb659 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleStepArgument.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleStepArgument.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,10 +16,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 +36,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..869f77b8 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTable.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTable.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,17 +14,17 @@ * 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"))); } - 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..19f4f5f3 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTableCell.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTableCell.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * 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..178bc4e9 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTableRow.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTableRow.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,17 +14,17 @@ * 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"))); } - 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..c92c64df 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTag.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTag.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,7 +16,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..be142d5b 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Product.java +++ b/java/src/generated/java/io/cucumber/messages/types/Product.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,14 +16,14 @@ * Used to describe various properties of Meta */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Product { private final String name; - private final String version; + private final @Nullable String version; public Product( String name, - String version + @Nullable String version ) { this.name = requireNonNull(name, "Product.name cannot be null"); this.version = version; diff --git a/java/src/generated/java/io/cucumber/messages/types/Rule.java b/java/src/generated/java/io/cucumber/messages/types/Rule.java index 27132844..cd35eb0f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Rule.java +++ b/java/src/generated/java/io/cucumber/messages/types/Rule.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,23 +14,23 @@ * 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"); @@ -49,7 +52,7 @@ public Location getLocation() { /** * All the tags placed above the `Rule` keyword */ - public java.util.List getTags() { + public List getTags() { return tags; } @@ -65,7 +68,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..6ff4ad44 100644 --- a/java/src/generated/java/io/cucumber/messages/types/RuleChild.java +++ b/java/src/generated/java/io/cucumber/messages/types/RuleChild.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,10 +16,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 +36,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..d4d63a2a 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Scenario.java +++ b/java/src/generated/java/io/cucumber/messages/types/Scenario.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,25 +14,25 @@ * 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"); @@ -49,7 +52,7 @@ public Location getLocation() { return location; } - public java.util.List getTags() { + public List getTags() { return tags; } @@ -65,11 +68,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..e70691fa 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Snippet.java +++ b/java/src/generated/java/io/cucumber/messages/types/Snippet.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * 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..421270af 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Source.java +++ b/java/src/generated/java/io/cucumber/messages/types/Source.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,7 +16,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..04adc3eb 100644 --- a/java/src/generated/java/io/cucumber/messages/types/SourceReference.java +++ b/java/src/generated/java/io/cucumber/messages/types/SourceReference.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -14,12 +17,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 +61,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..6f1a6d1d 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Step.java +++ b/java/src/generated/java/io/cucumber/messages/types/Step.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,23 +16,23 @@ * A step */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Step { private final Location location; private final String keyword; - private final StepKeywordType keywordType; + private final @Nullable StepKeywordType keywordType; private final String text; - private final DocString docString; - private final DataTable dataTable; + private final @Nullable DocString docString; + private final @Nullable DataTable dataTable; private final String id; public Step( Location location, String keyword, - StepKeywordType keywordType, + @Nullable StepKeywordType keywordType, String text, - DocString docString, - DataTable dataTable, + @Nullable DocString docString, + @Nullable DataTable dataTable, String id ) { this.location = requireNonNull(location, "Step.location cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/StepDefinition.java b/java/src/generated/java/io/cucumber/messages/types/StepDefinition.java index 0fe8976b..c0bc6398 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepDefinition.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepDefinition.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * 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..57866e7f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepDefinitionPattern.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepDefinitionPattern.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * 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..395e8f6a 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepMatchArgument.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepMatchArgument.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -18,14 +21,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..429228c0 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepMatchArgumentsList.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepMatchArgumentsList.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,17 +14,17 @@ * 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"))); } - 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..172ec282 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Suggestion.java +++ b/java/src/generated/java/io/cucumber/messages/types/Suggestion.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,16 +16,16 @@ * 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"); @@ -46,7 +49,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..1b48d10d 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TableCell.java +++ b/java/src/generated/java/io/cucumber/messages/types/TableCell.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,7 +16,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..095e9304 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TableRow.java +++ b/java/src/generated/java/io/cucumber/messages/types/TableRow.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,15 +16,15 @@ * 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"); @@ -39,7 +42,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..ecacacdf 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Tag.java +++ b/java/src/generated/java/io/cucumber/messages/types/Tag.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,7 +16,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..653ed71c 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCase.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCase.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -13,18 +16,18 @@ * 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"); @@ -43,7 +46,7 @@ public String getPickleId() { return pickleId; } - public java.util.List getTestSteps() { + public List getTestSteps() { return testSteps; } diff --git a/java/src/generated/java/io/cucumber/messages/types/TestCaseFinished.java b/java/src/generated/java/io/cucumber/messages/types/TestCaseFinished.java index 2d1255da..44d0f573 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCaseFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCaseFinished.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * 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..182190e6 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCaseStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCaseStarted.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,19 +14,19 @@ * Represents the TestCaseStarted message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestCaseStarted { private final Long attempt; private final String id; private final String testCaseId; - private final String workerId; + private final @Nullable String workerId; private final Timestamp timestamp; public TestCaseStarted( Long attempt, String id, String testCaseId, - String workerId, + @Nullable String workerId, Timestamp timestamp ) { this.attempt = requireNonNull(attempt, "TestCaseStarted.attempt cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java b/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java index 6dbed4ed..c5a3eca8 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,20 +14,20 @@ * Represents the TestRunFinished message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestRunFinished { - private final String message; + private final @Nullable String message; private final Boolean success; private final Timestamp timestamp; - private final Exception exception; - private final String testRunStartedId; + private final @Nullable Exception exception; + private final @Nullable String testRunStartedId; public TestRunFinished( - String message, + @Nullable String message, Boolean success, Timestamp timestamp, - Exception exception, - String testRunStartedId + @Nullable Exception exception, + @Nullable String testRunStartedId ) { this.message = message; this.success = requireNonNull(success, "TestRunFinished.success cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/TestRunHookFinished.java b/java/src/generated/java/io/cucumber/messages/types/TestRunHookFinished.java index e016428d..0f6639a7 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunHookFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunHookFinished.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * 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..c31b0621 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunHookStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunHookStarted.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,19 +14,19 @@ * Represents the TestRunHookStarted message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestRunHookStarted { private final String id; private final String testRunStartedId; private final String hookId; - private final String workerId; + private final @Nullable String workerId; private final Timestamp timestamp; public TestRunHookStarted( String id, String testRunStartedId, String hookId, - String workerId, + @Nullable String workerId, Timestamp timestamp ) { this.id = requireNonNull(id, "TestRunHookStarted.id cannot be null"); diff --git a/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java b/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java index 8406acba..15ac57c0 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,14 +14,14 @@ * 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..a5f20bbb 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStep.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStep.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -17,20 +20,20 @@ * * 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"); @@ -62,7 +65,7 @@ public Optional getPickleStepId() { *

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

* Each element represents the arguments for a matching step definition. */ - public Optional> getStepMatchArgumentsLists() { + public Optional> getStepMatchArgumentsLists() { return Optional.ofNullable(stepMatchArgumentsLists); } diff --git a/java/src/generated/java/io/cucumber/messages/types/TestStepFinished.java b/java/src/generated/java/io/cucumber/messages/types/TestStepFinished.java index b4937c3e..ab2912ba 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStepFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStepFinished.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * 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..e5fbce8f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStepResult.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStepResult.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,18 +14,18 @@ * Represents the TestStepResult message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class TestStepResult { private final Duration duration; - private final String message; + private final @Nullable String message; private final TestStepResultStatus status; - private final Exception exception; + private final @Nullable Exception exception; public TestStepResult( Duration duration, - String message, + @Nullable String message, TestStepResultStatus status, - Exception exception + @Nullable Exception exception ) { this.duration = requireNonNull(duration, "TestStepResult.duration cannot be null"); this.message = message; diff --git a/java/src/generated/java/io/cucumber/messages/types/TestStepStarted.java b/java/src/generated/java/io/cucumber/messages/types/TestStepStarted.java index bad56760..d5615b57 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStepStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStepStarted.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * 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..e95c5556 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Timestamp.java +++ b/java/src/generated/java/io/cucumber/messages/types/Timestamp.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * Represents the Timestamp message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class Timestamp { private final Long seconds; private final Long nanos; diff --git a/java/src/generated/java/io/cucumber/messages/types/UndefinedParameterType.java b/java/src/generated/java/io/cucumber/messages/types/UndefinedParameterType.java index e0e962c7..60830b61 100644 --- a/java/src/generated/java/io/cucumber/messages/types/UndefinedParameterType.java +++ b/java/src/generated/java/io/cucumber/messages/types/UndefinedParameterType.java @@ -1,5 +1,8 @@ package io.cucumber.messages.types; +import org.jspecify.annotations.Nullable; + +import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Optional; @@ -11,7 +14,7 @@ * Represents the UndefinedParameterType message in Cucumber's message protocol */ // Generated code -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "JavaLangClash"}) public final class UndefinedParameterType { private final String expression; private final String name; diff --git a/java/src/main/java/io/cucumber/messages/NdjsonToMessageIterable.java b/java/src/main/java/io/cucumber/messages/NdjsonToMessageIterable.java index eeb5e3c0..c4bcc33a 100644 --- a/java/src/main/java/io/cucumber/messages/NdjsonToMessageIterable.java +++ b/java/src/main/java/io/cucumber/messages/NdjsonToMessageIterable.java @@ -1,6 +1,7 @@ package io.cucumber.messages; import io.cucumber.messages.types.Envelope; +import org.jspecify.annotations.Nullable; import java.io.BufferedReader; import java.io.IOException; @@ -41,8 +42,8 @@ private NdjsonToMessageIterable(BufferedReader reader, Deserializer deserializer @Override public Iterator iterator() { - return new Iterator() { - private Envelope next; + return new Iterator<>() { + private @Nullable Envelope next; @Override public boolean hasNext() { @@ -50,7 +51,7 @@ public boolean hasNext() { String line = reader.readLine(); if (line == null) return false; - if (line.trim().equals("")) { + if (line.trim().isEmpty()) { return hasNext(); } try { diff --git a/java/src/main/java/io/cucumber/messages/TestStepResultStatusComparator.java b/java/src/main/java/io/cucumber/messages/TestStepResultStatusComparator.java index d9bf8b15..223411e9 100644 --- a/java/src/main/java/io/cucumber/messages/TestStepResultStatusComparator.java +++ b/java/src/main/java/io/cucumber/messages/TestStepResultStatusComparator.java @@ -7,6 +7,7 @@ /** * Orders test step results from least to most severe. */ +@SuppressWarnings("EnumOrdinal") public final class TestStepResultStatusComparator implements Comparator { @Override public int compare(TestStepResultStatus a, TestStepResultStatus b) { diff --git a/java/src/main/java/io/cucumber/messages/package-info.java b/java/src/main/java/io/cucumber/messages/package-info.java new file mode 100644 index 00000000..07ecc506 --- /dev/null +++ b/java/src/main/java/io/cucumber/messages/package-info.java @@ -0,0 +1,4 @@ +@NullMarked +package io.cucumber.messages; + +import org.jspecify.annotations.NullMarked; \ No newline at end of file diff --git a/java/src/main/java/io/cucumber/messages/types/package-info.java b/java/src/main/java/io/cucumber/messages/types/package-info.java new file mode 100644 index 00000000..891ab52c --- /dev/null +++ b/java/src/main/java/io/cucumber/messages/types/package-info.java @@ -0,0 +1,4 @@ +@NullMarked +package io.cucumber.messages.types; + +import org.jspecify.annotations.NullMarked; \ No newline at end of file diff --git a/java/src/test/java/io/cucumber/messages/MessagesTest.java b/java/src/test/java/io/cucumber/messages/MessagesTest.java index cd47a0d9..1a67432d 100644 --- a/java/src/test/java/io/cucumber/messages/MessagesTest.java +++ b/java/src/test/java/io/cucumber/messages/MessagesTest.java @@ -8,6 +8,7 @@ public class MessagesTest { @Test + @SuppressWarnings("NullAway") void is_invalid_when_required_fields_are_missing() { assertThrows(NullPointerException.class, () -> { new Attachment(null, null, null, null, null, null, null, null, null, null, null); From fb175cd4aacbc08f63efd709e66e561d3535d28e Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Tue, 4 Nov 2025 15:31:22 +0100 Subject: [PATCH 11/16] Use List.copyOf --- codegen/templates/java.java.erb | 8 +++----- .../java/io/cucumber/messages/types/Attachment.java | 2 -- .../java/io/cucumber/messages/types/Background.java | 4 +--- .../src/generated/java/io/cucumber/messages/types/Ci.java | 2 -- .../java/io/cucumber/messages/types/Comment.java | 2 -- .../java/io/cucumber/messages/types/DataTable.java | 4 +--- .../java/io/cucumber/messages/types/DocString.java | 2 -- .../java/io/cucumber/messages/types/Duration.java | 2 -- .../java/io/cucumber/messages/types/Envelope.java | 2 -- .../java/io/cucumber/messages/types/Examples.java | 6 ++---- .../java/io/cucumber/messages/types/Exception.java | 2 -- .../java/io/cucumber/messages/types/Feature.java | 6 ++---- .../java/io/cucumber/messages/types/FeatureChild.java | 2 -- .../java/io/cucumber/messages/types/GherkinDocument.java | 4 +--- .../generated/java/io/cucumber/messages/types/Git.java | 2 -- .../generated/java/io/cucumber/messages/types/Group.java | 4 +--- .../generated/java/io/cucumber/messages/types/Hook.java | 2 -- .../java/io/cucumber/messages/types/JavaMethod.java | 4 +--- .../io/cucumber/messages/types/JavaStackTraceElement.java | 2 -- .../java/io/cucumber/messages/types/Location.java | 2 -- .../generated/java/io/cucumber/messages/types/Meta.java | 2 -- .../java/io/cucumber/messages/types/ParameterType.java | 4 +--- .../java/io/cucumber/messages/types/ParseError.java | 2 -- .../generated/java/io/cucumber/messages/types/Pickle.java | 8 +++----- .../java/io/cucumber/messages/types/PickleDocString.java | 2 -- .../java/io/cucumber/messages/types/PickleStep.java | 4 +--- .../io/cucumber/messages/types/PickleStepArgument.java | 2 -- .../java/io/cucumber/messages/types/PickleTable.java | 4 +--- .../java/io/cucumber/messages/types/PickleTableCell.java | 2 -- .../java/io/cucumber/messages/types/PickleTableRow.java | 4 +--- .../java/io/cucumber/messages/types/PickleTag.java | 2 -- .../java/io/cucumber/messages/types/Product.java | 2 -- .../generated/java/io/cucumber/messages/types/Rule.java | 6 ++---- .../java/io/cucumber/messages/types/RuleChild.java | 2 -- .../java/io/cucumber/messages/types/Scenario.java | 8 +++----- .../java/io/cucumber/messages/types/Snippet.java | 2 -- .../generated/java/io/cucumber/messages/types/Source.java | 2 -- .../java/io/cucumber/messages/types/SourceReference.java | 2 -- .../generated/java/io/cucumber/messages/types/Step.java | 2 -- .../java/io/cucumber/messages/types/StepDefinition.java | 2 -- .../io/cucumber/messages/types/StepDefinitionPattern.java | 2 -- .../io/cucumber/messages/types/StepMatchArgument.java | 2 -- .../cucumber/messages/types/StepMatchArgumentsList.java | 4 +--- .../java/io/cucumber/messages/types/Suggestion.java | 4 +--- .../java/io/cucumber/messages/types/TableCell.java | 2 -- .../java/io/cucumber/messages/types/TableRow.java | 4 +--- .../generated/java/io/cucumber/messages/types/Tag.java | 2 -- .../java/io/cucumber/messages/types/TestCase.java | 4 +--- .../java/io/cucumber/messages/types/TestCaseFinished.java | 2 -- .../java/io/cucumber/messages/types/TestCaseStarted.java | 2 -- .../java/io/cucumber/messages/types/TestRunFinished.java | 2 -- .../io/cucumber/messages/types/TestRunHookFinished.java | 2 -- .../io/cucumber/messages/types/TestRunHookStarted.java | 2 -- .../java/io/cucumber/messages/types/TestRunStarted.java | 2 -- .../java/io/cucumber/messages/types/TestStep.java | 6 ++---- .../java/io/cucumber/messages/types/TestStepFinished.java | 2 -- .../java/io/cucumber/messages/types/TestStepResult.java | 2 -- .../java/io/cucumber/messages/types/TestStepStarted.java | 2 -- .../java/io/cucumber/messages/types/Timestamp.java | 2 -- .../cucumber/messages/types/UndefinedParameterType.java | 2 -- 60 files changed, 30 insertions(+), 150 deletions(-) diff --git a/codegen/templates/java.java.erb b/codegen/templates/java.java.erb index 0a8e2482..330a8bf1 100644 --- a/codegen/templates/java.java.erb +++ b/codegen/templates/java.java.erb @@ -5,11 +5,9 @@ package io.cucumber.messages.types; import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -35,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 -%> @@ -60,13 +58,13 @@ public final class <%= class_name(key) %> { -%> <%- if required -%> <%- if property['items'] -%> - this.<%= property_name %> = unmodifiableList(new ArrayList<>(requireNonNull(<%= property_name %>, "<%= class_name(key) %>.<%= property_name %> cannot be null"))); + this.<%= property_name %> = List.copyOf(requireNonNull(<%= property_name %>, "<%= class_name(key) %>.<%= property_name %> cannot be null")); <%- else -%> this.<%= property_name %> = requireNonNull(<%= property_name %>, "<%= class_name(key) %>.<%= property_name %> cannot be null"); <%- end -%> <%- else -%> <%- if property['items'] -%> - this.<%= property_name %> = <%= property_name %> == null ? null : unmodifiableList(new ArrayList<>(<%= property_name %>)); + this.<%= property_name %> = <%= property_name %> == null ? null : List.copyOf(<%= property_name %>); <%- else -%> this.<%= property_name %> = <%= property_name %>; <%- end -%> diff --git a/java/src/generated/java/io/cucumber/messages/types/Attachment.java b/java/src/generated/java/io/cucumber/messages/types/Attachment.java index 1170c789..ea5e0999 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Attachment.java +++ b/java/src/generated/java/io/cucumber/messages/types/Attachment.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 367cd380..4ed728a3 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Background.java +++ b/java/src/generated/java/io/cucumber/messages/types/Background.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -35,7 +33,7 @@ public Background( 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"); } 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 b7bb9a9f..54f83d3f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Ci.java +++ b/java/src/generated/java/io/cucumber/messages/types/Ci.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 a9f1e648..211ddece 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Comment.java +++ b/java/src/generated/java/io/cucumber/messages/types/Comment.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 8b30a641..0b049234 100644 --- a/java/src/generated/java/io/cucumber/messages/types/DataTable.java +++ b/java/src/generated/java/io/cucumber/messages/types/DataTable.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -24,7 +22,7 @@ public DataTable( 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() { 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 bc065ac2..9e0cb80a 100644 --- a/java/src/generated/java/io/cucumber/messages/types/DocString.java +++ b/java/src/generated/java/io/cucumber/messages/types/DocString.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 6d8f3601..f9423b84 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Duration.java +++ b/java/src/generated/java/io/cucumber/messages/types/Duration.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 7f909ac7..7157200f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Envelope.java +++ b/java/src/generated/java/io/cucumber/messages/types/Envelope.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 b796b4e3..8d8643f7 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Examples.java +++ b/java/src/generated/java/io/cucumber/messages/types/Examples.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -36,12 +34,12 @@ public Examples( 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"); } 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 487c76b9..97b6602f 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Exception.java +++ b/java/src/generated/java/io/cucumber/messages/types/Exception.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 e5c998eb..cfbcb073 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Feature.java +++ b/java/src/generated/java/io/cucumber/messages/types/Feature.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -34,12 +32,12 @@ public Feature( 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")); } /** 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 cd62102f..7b0bff9d 100644 --- a/java/src/generated/java/io/cucumber/messages/types/FeatureChild.java +++ b/java/src/generated/java/io/cucumber/messages/types/FeatureChild.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 8e4dc8a4..41f86ca0 100644 --- a/java/src/generated/java/io/cucumber/messages/types/GherkinDocument.java +++ b/java/src/generated/java/io/cucumber/messages/types/GherkinDocument.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -34,7 +32,7 @@ public GherkinDocument( ) { 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")); } /** 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 7a65c0a9..0612b121 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Git.java +++ b/java/src/generated/java/io/cucumber/messages/types/Git.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 fc2631d8..e3bb24d8 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Group.java +++ b/java/src/generated/java/io/cucumber/messages/types/Group.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -25,7 +23,7 @@ public Group( @Nullable Long start, @Nullable String value ) { - this.children = unmodifiableList(new ArrayList<>(requireNonNull(children, "Group.children cannot be null"))); + this.children = List.copyOf(requireNonNull(children, "Group.children cannot be null")); this.start = start; this.value = value; } 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 3696290f..bfebb165 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Hook.java +++ b/java/src/generated/java/io/cucumber/messages/types/Hook.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 c1ef18b3..1377fcf9 100644 --- a/java/src/generated/java/io/cucumber/messages/types/JavaMethod.java +++ b/java/src/generated/java/io/cucumber/messages/types/JavaMethod.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -27,7 +25,7 @@ public JavaMethod( ) { 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() { 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 4f1d8f89..0e27e62e 100644 --- a/java/src/generated/java/io/cucumber/messages/types/JavaStackTraceElement.java +++ b/java/src/generated/java/io/cucumber/messages/types/JavaStackTraceElement.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 c390bcf0..690c4522 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Location.java +++ b/java/src/generated/java/io/cucumber/messages/types/Location.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 418c5dee..7965eb93 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Meta.java +++ b/java/src/generated/java/io/cucumber/messages/types/Meta.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 93e58de3..d9787469 100644 --- a/java/src/generated/java/io/cucumber/messages/types/ParameterType.java +++ b/java/src/generated/java/io/cucumber/messages/types/ParameterType.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -32,7 +30,7 @@ public ParameterType( @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"); 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 940db817..7a0b5a22 100644 --- a/java/src/generated/java/io/cucumber/messages/types/ParseError.java +++ b/java/src/generated/java/io/cucumber/messages/types/ParseError.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 53ea3c70..4dc39810 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Pickle.java +++ b/java/src/generated/java/io/cucumber/messages/types/Pickle.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -48,9 +46,9 @@ public Pickle( this.uri = requireNonNull(uri, "Pickle.uri cannot be null"); this.name = requireNonNull(name, "Pickle.name cannot be null"); this.language = requireNonNull(language, "Pickle.language cannot be null"); - this.steps = unmodifiableList(new ArrayList<>(requireNonNull(steps, "Pickle.steps cannot be null"))); - this.tags = unmodifiableList(new ArrayList<>(requireNonNull(tags, "Pickle.tags cannot be null"))); - this.astNodeIds = unmodifiableList(new ArrayList<>(requireNonNull(astNodeIds, "Pickle.astNodeIds cannot be null"))); + this.steps = List.copyOf(requireNonNull(steps, "Pickle.steps cannot be null")); + this.tags = List.copyOf(requireNonNull(tags, "Pickle.tags cannot be null")); + this.astNodeIds = List.copyOf(requireNonNull(astNodeIds, "Pickle.astNodeIds cannot be null")); } /** 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 420c8986..56c8d9a6 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleDocString.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleDocString.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 76ff7f9f..4795afc6 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleStep.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleStep.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -32,7 +30,7 @@ public PickleStep( 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"); 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 055eb659..56e78d50 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleStepArgument.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleStepArgument.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 869f77b8..fddb36ee 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTable.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTable.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -21,7 +19,7 @@ public final class PickleTable { public PickleTable( 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 List getRows() { 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 19f4f5f3..d977d51e 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTableCell.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTableCell.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 178bc4e9..f875b185 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTableRow.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTableRow.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -21,7 +19,7 @@ public final class PickleTableRow { public PickleTableRow( 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 List getCells() { 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 c92c64df..2bfed83a 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleTag.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleTag.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 be142d5b..46a32295 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Product.java +++ b/java/src/generated/java/io/cucumber/messages/types/Product.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 cd35eb0f..2971a80b 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Rule.java +++ b/java/src/generated/java/io/cucumber/messages/types/Rule.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -34,11 +32,11 @@ public Rule( 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"); } 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 6ff4ad44..fdc56204 100644 --- a/java/src/generated/java/io/cucumber/messages/types/RuleChild.java +++ b/java/src/generated/java/io/cucumber/messages/types/RuleChild.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 d4d63a2a..45d32421 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Scenario.java +++ b/java/src/generated/java/io/cucumber/messages/types/Scenario.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -36,12 +34,12 @@ public Scenario( 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"); } 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 e70691fa..31bf59d1 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Snippet.java +++ b/java/src/generated/java/io/cucumber/messages/types/Snippet.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 421270af..e659ebdf 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Source.java +++ b/java/src/generated/java/io/cucumber/messages/types/Source.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 04adc3eb..323772d7 100644 --- a/java/src/generated/java/io/cucumber/messages/types/SourceReference.java +++ b/java/src/generated/java/io/cucumber/messages/types/SourceReference.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 6f1a6d1d..92c027cf 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Step.java +++ b/java/src/generated/java/io/cucumber/messages/types/Step.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 c0bc6398..fe53dadd 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepDefinition.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepDefinition.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 57866e7f..74ce9cf5 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepDefinitionPattern.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepDefinitionPattern.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 395e8f6a..e8787abb 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepMatchArgument.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepMatchArgument.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 429228c0..dee66b89 100644 --- a/java/src/generated/java/io/cucumber/messages/types/StepMatchArgumentsList.java +++ b/java/src/generated/java/io/cucumber/messages/types/StepMatchArgumentsList.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -21,7 +19,7 @@ public final class StepMatchArgumentsList { public StepMatchArgumentsList( 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 List getStepMatchArguments() { 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 172ec282..e0037e40 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Suggestion.java +++ b/java/src/generated/java/io/cucumber/messages/types/Suggestion.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -29,7 +27,7 @@ public Suggestion( ) { 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")); } /** 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 1b48d10d..6d0a7cae 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TableCell.java +++ b/java/src/generated/java/io/cucumber/messages/types/TableCell.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 095e9304..8739e416 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TableRow.java +++ b/java/src/generated/java/io/cucumber/messages/types/TableRow.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -28,7 +26,7 @@ public TableRow( 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"); } 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 ecacacdf..302c1618 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Tag.java +++ b/java/src/generated/java/io/cucumber/messages/types/Tag.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 653ed71c..ffe16ecd 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCase.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCase.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -31,7 +29,7 @@ public TestCase( ) { 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; } 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 44d0f573..d7e37771 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCaseFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCaseFinished.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 182190e6..51492528 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCaseStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCaseStarted.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 c5a3eca8..5cfbd3d5 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 0f6639a7..7f43fef8 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunHookFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunHookFinished.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 c31b0621..7cfe193b 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunHookStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunHookStarted.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 15ac57c0..bd3566e8 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunStarted.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 a5f20bbb..a7d5ba9b 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStep.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStep.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** @@ -38,8 +36,8 @@ public TestStep( 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); } /** 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 ab2912ba..f9b4f733 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStepFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStepFinished.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 e5fbce8f..87579828 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStepResult.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStepResult.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 d5615b57..15f4c4ca 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStepStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStepStarted.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 e95c5556..38d05fb9 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Timestamp.java +++ b/java/src/generated/java/io/cucumber/messages/types/Timestamp.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** 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 60830b61..5bbd51b5 100644 --- a/java/src/generated/java/io/cucumber/messages/types/UndefinedParameterType.java +++ b/java/src/generated/java/io/cucumber/messages/types/UndefinedParameterType.java @@ -3,11 +3,9 @@ import org.jspecify.annotations.Nullable; import java.util.List; -import java.util.ArrayList; import java.util.Objects; import java.util.Optional; -import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** From decfffac59104ca9cd0164ba8b947c4aaf981fea Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Mon, 10 Nov 2025 16:11:06 +0100 Subject: [PATCH 12/16] Use integers in comparators --- .../cucumber/messages/LocationComparator.java | 4 +-- .../messages/DurationComparatorTest.java | 20 ++++++------- .../messages/LocationComparatorTest.java | 28 +++++++++---------- .../messages/TimestampComparatorTest.java | 20 ++++++------- 4 files changed, 36 insertions(+), 36 deletions(-) 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/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/LocationComparatorTest.java b/java/src/test/java/io/cucumber/messages/LocationComparatorTest.java index 7ae5d503..e7a30900 100644 --- a/java/src/test/java/io/cucumber/messages/LocationComparatorTest.java +++ b/java/src/test/java/io/cucumber/messages/LocationComparatorTest.java @@ -11,49 +11,49 @@ class LocationComparatorTest { @Test void isEqual(){ - Location a = new Location(3L, 14L); - Location b = new Location(3L, 14L); + 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); + 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); + 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); + 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); + 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); + 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); + 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/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(); } } From 627b411d6474db10126a31cf52cd70deee10fbc4 Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Mon, 10 Nov 2025 16:13:46 +0100 Subject: [PATCH 13/16] Add location after uri. It is sort of the identity --- .../messages/cucumber/messages/pickle.hpp | 4 +-- .../lib/messages/cucumber/messages/pickle.cpp | 4 +-- dotnet/Cucumber.Messages/generated/Pickle.cs | 24 ++++++------- go/messages.go | 2 +- .../io/cucumber/messages/types/Pickle.java | 32 ++++++++--------- javascript/src/messages.ts | 6 ++-- jsonschema/messages.md | 2 +- jsonschema/src/Pickle.json | 8 ++--- perl/lib/Cucumber/Messages.pm | 22 ++++++------ php/src-generated/Pickle.php | 34 +++++++++---------- ruby/lib/cucumber/messages/pickle.rb | 20 +++++------ 11 files changed, 79 insertions(+), 79 deletions(-) diff --git a/cpp/include/messages/cucumber/messages/pickle.hpp b/cpp/include/messages/cucumber/messages/pickle.hpp index 3eae05c5..8543f414 100644 --- a/cpp/include/messages/cucumber/messages/pickle.hpp +++ b/cpp/include/messages/cucumber/messages/pickle.hpp @@ -6,9 +6,9 @@ #include +#include #include #include -#include namespace cucumber::messages { @@ -37,12 +37,12 @@ struct pickle { std::string id; std::string uri; + std::optional location; std::string name; std::string language; std::vector steps; std::vector tags; std::vector ast_node_ids; - std::optional location; std::string to_string() const; diff --git a/cpp/src/lib/messages/cucumber/messages/pickle.cpp b/cpp/src/lib/messages/cucumber/messages/pickle.cpp index 5dd05bcb..85f39d00 100644 --- a/cpp/src/lib/messages/cucumber/messages/pickle.cpp +++ b/cpp/src/lib/messages/cucumber/messages/pickle.cpp @@ -12,12 +12,12 @@ 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); cucumber::messages::to_string(oss, ", tags=", tags); cucumber::messages::to_string(oss, ", ast_node_ids=", ast_node_ids); - cucumber::messages::to_string(oss, ", location=", location); return oss.str(); } @@ -27,12 +27,12 @@ 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); cucumber::messages::to_json(j, camelize("tags"), tags); cucumber::messages::to_json(j, camelize("ast_node_ids"), ast_node_ids); - cucumber::messages::to_json(j, camelize("location"), location); } std::string diff --git a/dotnet/Cucumber.Messages/generated/Pickle.cs b/dotnet/Cucumber.Messages/generated/Pickle.cs index 352db6c8..473bfd13 100644 --- a/dotnet/Cucumber.Messages/generated/Pickle.cs +++ b/dotnet/Cucumber.Messages/generated/Pickle.cs @@ -37,6 +37,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 */ @@ -60,27 +64,24 @@ public sealed class Pickle * id originating from the `Scenario` AST node, and the second from the `TableRow` AST node. */ public List AstNodeIds { 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; } public Pickle( string id, string uri, + Location location, string name, string language, List steps, List tags, - List astNodeIds, - Location location + List astNodeIds ) { RequireNonNull(id, "Id", "Pickle.Id cannot be null"); 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"); @@ -91,7 +92,6 @@ Location location this.Tags = new List(tags); RequireNonNull>(astNodeIds, "AstNodeIds", "Pickle.AstNodeIds cannot be null"); this.AstNodeIds = new List(astNodeIds); - this.Location = location; } public override bool Equals(Object o) @@ -102,12 +102,12 @@ 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) && Tags.Equals(that.Tags) && - AstNodeIds.Equals(that.AstNodeIds) && - Object.Equals(Location, that.Location); + AstNodeIds.Equals(that.AstNodeIds); } public override int GetHashCode() @@ -117,6 +117,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) @@ -127,8 +129,6 @@ public override int GetHashCode() hash = hash * 31 + Tags.GetHashCode(); if (AstNodeIds != null) hash = hash * 31 + AstNodeIds.GetHashCode(); - if (Location != null) - hash = hash * 31 + Location.GetHashCode(); return hash; } @@ -137,12 +137,12 @@ public override string ToString() return "Pickle{" + "id=" + Id + ", uri=" + Uri + + ", location=" + Location + ", name=" + Name + ", language=" + Language + ", steps=" + Steps + ", tags=" + Tags + ", astNodeIds=" + AstNodeIds + - ", location=" + Location + '}'; } diff --git a/go/messages.go b/go/messages.go index c4a0e79c..805985d3 100644 --- a/go/messages.go +++ b/go/messages.go @@ -217,12 +217,12 @@ 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"` Tags []*PickleTag `json:"tags"` AstNodeIds []string `json:"astNodeIds"` - Location *Location `json:"location,omitempty"` } type PickleDocString struct { 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 3a8772dc..0e26e8f8 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Pickle.java +++ b/java/src/generated/java/io/cucumber/messages/types/Pickle.java @@ -29,31 +29,31 @@ public final class Pickle { private final String id; private final String uri; + private final 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 Location location; public Pickle( String id, String uri, + Location location, String name, String language, java.util.List steps, java.util.List tags, - java.util.List astNodeIds, - Location location + java.util.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.location = location; } /** @@ -70,6 +70,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 */ @@ -108,13 +115,6 @@ public java.util.List getAstNodeIds() { return astNodeIds; } - /** - * 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); - } - @Override public boolean equals(Object o) { if (this == o) return true; @@ -123,12 +123,12 @@ 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) && tags.equals(that.tags) && - astNodeIds.equals(that.astNodeIds) && - Objects.equals(location, that.location); + astNodeIds.equals(that.astNodeIds); } @Override @@ -136,12 +136,12 @@ public int hashCode() { return Objects.hash( id, uri, + location, name, language, steps, tags, - astNodeIds, - location + astNodeIds ); } @@ -150,12 +150,12 @@ public String toString() { return "Pickle{" + "id=" + id + ", uri=" + uri + + ", location=" + location + ", name=" + name + ", language=" + language + ", steps=" + steps + ", tags=" + tags + ", astNodeIds=" + astNodeIds + - ", location=" + location + '}'; } } diff --git a/javascript/src/messages.ts b/javascript/src/messages.ts index 170d74e9..b57eba03 100644 --- a/javascript/src/messages.ts +++ b/javascript/src/messages.ts @@ -418,6 +418,9 @@ export class Pickle { uri: string = '' + @Type(() => Location) + location?: Location + name: string = '' language: string = '' @@ -429,9 +432,6 @@ export class Pickle { tags: readonly PickleTag[] = [] astNodeIds: readonly string[] = [] - - @Type(() => Location) - location?: Location } export class PickleDocString { diff --git a/jsonschema/messages.md b/jsonschema/messages.md index de5844ca..e3627c3c 100644 --- a/jsonschema/messages.md +++ b/jsonschema/messages.md @@ -277,12 +277,12 @@ will only have one of its fields set, which indicates the payload of the message | ----- | ---- | ----------- | ----------- | | `id` | string | yes | | | `uri` | string | yes | | +| `location` | [Location](#location) | no | | | `name` | string | yes | | | `language` | string | yes | | | `steps` | [PickleStep](#picklestep)[] | yes | | | `tags` | [PickleTag](#pickletag)[] | yes | | | `astNodeIds` | string[] | yes | | -| `location` | [Location](#location) | no | | ## PickleDocString diff --git a/jsonschema/src/Pickle.json b/jsonschema/src/Pickle.json index 20a0fb13..ae910eeb 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" @@ -185,10 +189,6 @@ }, "type": "array", "minItems": 1 - }, - "location": { - "description": "The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row.", - "$ref": "./Location.json" } }, "type": "object" diff --git a/perl/lib/Cucumber/Messages.pm b/perl/lib/Cucumber/Messages.pm index 1abb0f3a..cc1403ee 100644 --- a/perl/lib/Cucumber/Messages.pm +++ b/perl/lib/Cucumber/Messages.pm @@ -2732,12 +2732,12 @@ use Scalar::Util qw( blessed ); my %types = ( id => 'string', uri => 'string', + location => 'Cucumber::Messages::Location', name => 'string', language => 'string', steps => '[]Cucumber::Messages::PickleStep', tags => '[]Cucumber::Messages::PickleTag', ast_node_ids => '[]string', - location => 'Cucumber::Messages::Location', ); # This is a work-around for the fact that Moo doesn't have introspection @@ -2773,6 +2773,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 @@ -2838,16 +2848,6 @@ has ast_node_ids => ); -=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', - ); - - } package Cucumber::Messages::PickleDocString { diff --git a/php/src-generated/Pickle.php b/php/src-generated/Pickle.php index d5d9c041..1f238684 100644 --- a/php/src-generated/Pickle.php +++ b/php/src-generated/Pickle.php @@ -50,6 +50,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 */ @@ -77,11 +82,6 @@ public function __construct( * id originating from the `Scenario` AST node, and the second from the `TableRow` AST node. */ public readonly array $astNodeIds = [], - - /** - * The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. - */ - public readonly ?Location $location = null, ) { } @@ -94,22 +94,22 @@ 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); self::ensureTags($arr); self::ensureAstNodeIds($arr); - self::ensureLocation($arr); 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'])), array_values(array_map(fn (array $member) => PickleTag::fromArray($member), $arr['tags'])), array_values(array_map(fn (mixed $member) => (string) $member, $arr['astNodeIds'])), - isset($arr['location']) ? Location::fromArray($arr['location']) : null, ); } @@ -139,6 +139,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 */ @@ -203,14 +213,4 @@ private static function ensureAstNodeIds(array $arr): void throw new SchemaViolationException('Property \'astNodeIds\' was not array'); } } - - /** - * @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'); - } - } } diff --git a/ruby/lib/cucumber/messages/pickle.rb b/ruby/lib/cucumber/messages/pickle.rb index a471be94..6aa075fb 100644 --- a/ruby/lib/cucumber/messages/pickle.rb +++ b/ruby/lib/cucumber/messages/pickle.rb @@ -33,6 +33,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 ## @@ -63,29 +68,24 @@ class Pickle < Message ## attr_reader :ast_node_ids - ## - # The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. - ## - attr_reader :location - def initialize( id: '', uri: '', + location: nil, name: '', language: '', steps: [], tags: [], - ast_node_ids: [], - location: nil + ast_node_ids: [] ) @id = id @uri = uri + @location = location @name = name @language = language @steps = steps @tags = tags @ast_node_ids = ast_node_ids - @location = location super() end @@ -102,12 +102,12 @@ 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) }, tags: hash[:tags]&.map { |item| PickleTag.from_h(item) }, - ast_node_ids: hash[:astNodeIds], - location: Location.from_h(hash[:location]) + ast_node_ids: hash[:astNodeIds] ) end end From 9a4d01e6ae044d98237c8bcf27b8f6edbde73d16 Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Mon, 10 Nov 2025 18:05:56 +0100 Subject: [PATCH 14/16] Use checkstyle --- codegen/templates/java.java.erb | 2 +- java/.mvn/jvm.config | 2 +- java/checkstyle-suppressions.xml | 9 ++++++ java/pom.xml | 16 ++++++++++ .../cucumber/messages/types/Attachment.java | 14 ++++----- .../java/io/cucumber/messages/types/Ci.java | 4 +-- .../io/cucumber/messages/types/Exception.java | 4 +-- .../messages/types/GherkinDocument.java | 2 +- .../io/cucumber/messages/types/Pickle.java | 2 +- .../cucumber/messages/types/PickleStep.java | 2 +- .../io/cucumber/messages/types/Product.java | 2 +- .../java/io/cucumber/messages/types/Step.java | 2 +- .../io/cucumber/messages/types/TestCase.java | 2 +- .../messages/types/TestCaseStarted.java | 2 +- .../messages/types/TestRunFinished.java | 4 +-- .../messages/types/TestRunHookStarted.java | 2 +- .../io/cucumber/messages/types/TestStep.java | 8 ++--- .../messages/types/TestStepResult.java | 4 +-- .../java/io/cucumber/messages/Convertor.java | 1 - .../messages/MessageToNdjsonWriter.java | 1 + .../java/io/cucumber/messages/Jackson.java | 1 - .../messages/LocationComparatorTest.java | 29 ++++++++++--------- .../messages/NdjsonSerializationTest.java | 2 +- 23 files changed, 71 insertions(+), 46 deletions(-) create mode 100644 java/checkstyle-suppressions.xml diff --git a/codegen/templates/java.java.erb b/codegen/templates/java.java.erb index 330a8bf1..8f8e1513 100644 --- a/codegen/templates/java.java.erb +++ b/codegen/templates/java.java.erb @@ -86,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/java/.mvn/jvm.config b/java/.mvn/jvm.config index 8488a4fc..32599cef 100644 --- a/java/.mvn/jvm.config +++ b/java/.mvn/jvm.config @@ -7,4 +7,4 @@ --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED ---add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \ No newline at end of file +--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 b9798ce8..61846a8e 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -139,6 +139,22 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + + + validate + verify + + check + + + checkstyle-suppressions.xml + + + + org.apache.maven.plugins maven-compiler-plugin 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 ea5e0999..fe0388ef 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Attachment.java +++ b/java/src/generated/java/io/cucumber/messages/types/Attachment.java @@ -88,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); @@ -109,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: *

@@ -140,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/Ci.java b/java/src/generated/java/io/cucumber/messages/types/Ci.java index 54f83d3f..0f5740e7 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Ci.java +++ b/java/src/generated/java/io/cucumber/messages/types/Ci.java @@ -41,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/Exception.java b/java/src/generated/java/io/cucumber/messages/types/Exception.java index 97b6602f..f5118b58 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Exception.java +++ b/java/src/generated/java/io/cucumber/messages/types/Exception.java @@ -38,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/GherkinDocument.java b/java/src/generated/java/io/cucumber/messages/types/GherkinDocument.java index 41f86ca0..9c081af0 100644 --- a/java/src/generated/java/io/cucumber/messages/types/GherkinDocument.java +++ b/java/src/generated/java/io/cucumber/messages/types/GherkinDocument.java @@ -36,7 +36,7 @@ public GherkinDocument( } /** - * 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() { 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 ad0ada71..bfc5ef28 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Pickle.java +++ b/java/src/generated/java/io/cucumber/messages/types/Pickle.java @@ -69,7 +69,7 @@ public String getUri() { } /** - * The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row. + * 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); 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 4795afc6..c9925ca2 100644 --- a/java/src/generated/java/io/cucumber/messages/types/PickleStep.java +++ b/java/src/generated/java/io/cucumber/messages/types/PickleStep.java @@ -56,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/Product.java b/java/src/generated/java/io/cucumber/messages/types/Product.java index 46a32295..812c6940 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Product.java +++ b/java/src/generated/java/io/cucumber/messages/types/Product.java @@ -35,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/Step.java b/java/src/generated/java/io/cucumber/messages/types/Step.java index 92c027cf..201d88b3 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Step.java +++ b/java/src/generated/java/io/cucumber/messages/types/Step.java @@ -57,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/TestCase.java b/java/src/generated/java/io/cucumber/messages/types/TestCase.java index ffe16ecd..946af5d2 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCase.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCase.java @@ -49,7 +49,7 @@ public List getTestSteps() { } /** - * 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/TestCaseStarted.java b/java/src/generated/java/io/cucumber/messages/types/TestCaseStarted.java index 51492528..3ba5ad2b 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestCaseStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestCaseStarted.java @@ -55,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 5cfbd3d5..c72674b4 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunFinished.java @@ -35,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); @@ -56,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/TestRunHookStarted.java b/java/src/generated/java/io/cucumber/messages/types/TestRunHookStarted.java index 7cfe193b..e7f874b7 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestRunHookStarted.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestRunHookStarted.java @@ -56,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/TestStep.java b/java/src/generated/java/io/cucumber/messages/types/TestStep.java index a7d5ba9b..afebe4f8 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStep.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStep.java @@ -41,7 +41,7 @@ public TestStep( } /** - * 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); @@ -52,14 +52,14 @@ 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. */ @@ -68,7 +68,7 @@ public Optional> getStepDefinitionIds() { } /** - * 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. */ 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 87579828..3f0fbf0a 100644 --- a/java/src/generated/java/io/cucumber/messages/types/TestStepResult.java +++ b/java/src/generated/java/io/cucumber/messages/types/TestStepResult.java @@ -36,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); @@ -47,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/main/java/io/cucumber/messages/Convertor.java b/java/src/main/java/io/cucumber/messages/Convertor.java index cb4386d6..88d39865 100644 --- a/java/src/main/java/io/cucumber/messages/Convertor.java +++ b/java/src/main/java/io/cucumber/messages/Convertor.java @@ -6,7 +6,6 @@ import java.io.PrintWriter; import java.io.StringWriter; -import java.time.Instant; import static java.util.Objects.requireNonNull; 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/test/java/io/cucumber/messages/Jackson.java b/java/src/test/java/io/cucumber/messages/Jackson.java index fad8130c..52e5ab55 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; diff --git a/java/src/test/java/io/cucumber/messages/LocationComparatorTest.java b/java/src/test/java/io/cucumber/messages/LocationComparatorTest.java index e7a30900..1de66e64 100644 --- a/java/src/test/java/io/cucumber/messages/LocationComparatorTest.java +++ b/java/src/test/java/io/cucumber/messages/LocationComparatorTest.java @@ -6,52 +6,53 @@ import static org.assertj.core.api.Assertions.assertThat; class LocationComparatorTest { - + final LocationComparator comparator = new LocationComparator(); - + @Test - void isEqual(){ + void isEqual() { Location a = new Location(3, 14); Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isZero(); } - + @Test - void isSmallerOnLine(){ + void isSmallerOnLine() { Location a = new Location(2, 14); Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isNegative(); } - + @Test - void isSmallerOnColum(){ + void isSmallerOnColum() { Location a = new Location(3, 13); Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isNegative(); } + @Test - void isSmallerAbsentColumn(){ + void isSmallerAbsentColumn() { Location a = new Location(3, null); Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isNegative(); } - + @Test - void isLargerOnLine(){ + void isLargerOnLine() { Location a = new Location(4, 14); Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isPositive(); } - + @Test - void isLargerOnColumn(){ + void isLargerOnColumn() { Location a = new Location(3, 15); Location b = new Location(3, 14); assertThat(comparator.compare(a, b)).isPositive(); } - + @Test - void isLargerAbsentColumn(){ + 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/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 From 4d5aedb964b36efb7356da7d356e93db11975b4c Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Mon, 10 Nov 2025 18:10:45 +0100 Subject: [PATCH 15/16] Use checkstyle --- jsonschema/messages.md | 7 +++++++ 1 file changed, 7 insertions(+) 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 From 6fdd10d95e6eda3b5704af7845c34f9f003102a9 Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Mon, 10 Nov 2025 22:47:07 +0100 Subject: [PATCH 16/16] Bump version --- java/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/pom.xml b/java/pom.xml index 61846a8e..67a6b7b3 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -8,7 +8,7 @@ 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