-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[JAVA] [PERF] improve java enum fromValue generation #22995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
4a11326
638b230
f8df6d3
f58117c
79a9da0
de68f0e
582b525
540537e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,10 @@ import java.io.IOException; | |||||
| {{#isUri}} | ||||||
| import java.net.URI; | ||||||
| {{/isUri}} | ||||||
| {{#useEnumCaseInsensitive}}import java.util.Locale; | ||||||
| {{/useEnumCaseInsensitive}}import java.util.HashMap; | ||||||
| import java.util.Map; | ||||||
| import java.util.Optional; | ||||||
| import com.google.gson.TypeAdapter; | ||||||
| import com.google.gson.JsonElement; | ||||||
| import com.google.gson.annotations.JsonAdapter; | ||||||
|
|
@@ -28,8 +32,16 @@ import com.google.gson.stream.JsonWriter; | |||||
| {{{name}}}({{{value}}}){{^-last}}, | ||||||
| {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} | ||||||
|
|
||||||
| private static final Map<{{{dataType}}}, {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> BY_VALUE = new HashMap<>(); | ||||||
|
|
||||||
| private {{{dataType}}} value; | ||||||
|
|
||||||
| static { | ||||||
| for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} e: values()) { | ||||||
| BY_VALUE.put(e.value, e); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Case-insensitive lookup lowercases the input but the BY_VALUE map is populated with unnormalized keys, so enums with uppercase values will not be found. Prompt for AI agents |
||||||
| } | ||||||
| } | ||||||
|
|
||||||
| {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { | ||||||
| this.value = value; | ||||||
| } | ||||||
|
|
@@ -44,12 +56,7 @@ import com.google.gson.stream.JsonWriter; | |||||
| } | ||||||
|
|
||||||
| public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { | ||||||
| for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { | ||||||
| if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) { | ||||||
| return b; | ||||||
| } | ||||||
| } | ||||||
| {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} | ||||||
| return Optional.ofNullable({{#useEnumCaseInsensitive}}value == null ? null : BY_VALUE.get(value.toLowerCase(Locale.ROOT)){{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}BY_VALUE.get(value){{/useEnumCaseInsensitive}}).{{#isNullable}}orElse(null){{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}orElse({{{name}}}){{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'")){{/enumUnknownDefaultCase}}{{/isNullable}}; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: useEnumCaseInsensitive applies to all enums, but this template always calls value.toLowerCase(...) without checking isString, causing compilation errors for non-String enum value types. Prompt for AI agents
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,10 @@ import com.google.gson.stream.JsonWriter; | |||||
| {{#isUri}} | ||||||
| import java.net.URI; | ||||||
| {{/isUri}} | ||||||
| {{#useEnumCaseInsensitive}}import java.util.Locale; | ||||||
| {{/useEnumCaseInsensitive}}import java.util.HashMap; | ||||||
| import java.util.Map; | ||||||
| import java.util.Optional; | ||||||
|
|
||||||
| /** | ||||||
| * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} | ||||||
|
|
@@ -39,8 +43,16 @@ import java.net.URI; | |||||
| {{{name}}}({{{value}}}){{^-last}}, | ||||||
| {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} | ||||||
|
|
||||||
| private static final Map<{{{dataType}}}, {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> BY_VALUE = new HashMap<>(); | ||||||
|
|
||||||
| private {{{dataType}}} value; | ||||||
|
|
||||||
| static { | ||||||
| for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} e: values()) { | ||||||
| BY_VALUE.put(e.value, e); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Case-insensitive lookup lowercases the input but the BY_VALUE map is populated with unnormalized keys, so enums with uppercase/mixed-case values will no longer resolve. Prompt for AI agents
Suggested change
|
||||||
| } | ||||||
| } | ||||||
|
|
||||||
| {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { | ||||||
| this.value = value; | ||||||
| } | ||||||
|
|
@@ -61,12 +73,7 @@ import java.net.URI; | |||||
| @JsonCreator | ||||||
| {{/jackson}} | ||||||
| public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { | ||||||
| for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { | ||||||
| if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) { | ||||||
| return b; | ||||||
| } | ||||||
| } | ||||||
| {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}return {{{name}}};{{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/enumUnknownDefaultCase}}{{/isNullable}} | ||||||
| return Optional.ofNullable({{#useEnumCaseInsensitive}}value == null ? null : BY_VALUE.get(value.toLowerCase(Locale.ROOT)){{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}BY_VALUE.get(value){{/useEnumCaseInsensitive}}).{{#isNullable}}orElse(null){{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}orElse({{{name}}}){{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'")){{/enumUnknownDefaultCase}}{{/isNullable}}; | ||||||
| } | ||||||
| {{#gson}} | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,10 @@ | |||||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Case-insensitive lookup lowercases the input but BY_VALUE is populated with original-cased keys, so valid enum values with uppercase characters will not resolve when useEnumCaseInsensitive is enabled. Prompt for AI agents |
||||||
| import com.fasterxml.jackson.annotation.JsonValue; | ||||||
| {{/jackson}} | ||||||
| {{#useEnumCaseInsensitive}}import java.util.Locale; | ||||||
| {{/useEnumCaseInsensitive}}import java.util.HashMap; | ||||||
| import java.util.Map; | ||||||
| import java.util.Optional; | ||||||
|
|
||||||
| /** | ||||||
| * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} | ||||||
|
|
@@ -22,8 +26,16 @@ import com.fasterxml.jackson.annotation.JsonValue; | |||||
| {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} | ||||||
| {{/gson}} | ||||||
|
|
||||||
| private static final Map<{{{dataType}}}, {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> BY_VALUE = new HashMap<>(); | ||||||
|
|
||||||
| private {{{dataType}}} value; | ||||||
|
|
||||||
| static { | ||||||
| for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} e: values()) { | ||||||
| BY_VALUE.put(e.value, e); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { | ||||||
| this.value = value; | ||||||
| } | ||||||
|
|
@@ -43,12 +55,7 @@ import com.fasterxml.jackson.annotation.JsonValue; | |||||
|
|
||||||
| @JsonCreator | ||||||
| public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { | ||||||
| for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { | ||||||
| if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) { | ||||||
| return b; | ||||||
| } | ||||||
| } | ||||||
| {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/isNullable}} | ||||||
| return Optional.ofNullable({{#useEnumCaseInsensitive}}value == null ? null : BY_VALUE.get(value.toLowerCase(Locale.ROOT)){{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}BY_VALUE.get(value){{/useEnumCaseInsensitive}}).{{#isNullable}}orElse(null){{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}orElse({{{name}}}){{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'")){{/enumUnknownDefaultCase}}{{/isNullable}}; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Prompt for AI agents
Suggested change
|
||||||
| } | ||||||
| {{/jackson}} | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| {{#useEnumCaseInsensitive}}import java.util.Locale; | ||
| {{/useEnumCaseInsensitive}}import java.util.HashMap; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
|
|
||
| /** | ||
| * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} | ||
| */ | ||
|
|
@@ -28,8 +33,16 @@ | |
| {{/enumVars}} | ||
| {{/allowableValues}} | ||
|
|
||
| private static final Map<{{{dataType}}}, {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}> BY_VALUE = new HashMap<>(); | ||
|
|
||
| private {{{dataType}}} value; | ||
|
|
||
| static { | ||
| for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} e: values()) { | ||
| BY_VALUE.put(e.value, e); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Case-insensitive lookup lowercases the input, but BY_VALUE is populated with original values, so mixed/upper-case enum values won't be found when useEnumCaseInsensitive is enabled. Prompt for AI agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, it does not respect the case. This only works for exact equals.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, actually, I don't think it will be possible, at least not with some workaround. What if |
||
| } | ||
| } | ||
|
|
||
| {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{{dataType}}} value) { | ||
| this.value = value; | ||
| } | ||
|
|
@@ -46,12 +59,7 @@ | |
|
|
||
| {{#jackson}}@JsonCreator{{/jackson}} | ||
| public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { | ||
| for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { | ||
| if (b.value.equals(value)) { | ||
| return b; | ||
| } | ||
| } | ||
| {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/isNullable}} | ||
| return Optional.ofNullable({{#useEnumCaseInsensitive}}value == null ? null : BY_VALUE.get(value.toLowerCase(Locale.ROOT)){{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}BY_VALUE.get(value){{/useEnumCaseInsensitive}}).{{#isNullable}}orElse(null){{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}orElse({{{name}}}){{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'")){{/enumUnknownDefaultCase}}{{/isNullable}}; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if the value is non-String, and the flag |
||
| } | ||
| {{#jsonb}} | ||
| public static final class Deserializer implements JsonbDeserializer<{{datatypeWithEnum}}> { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,10 @@ | |
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonValue; | ||
| {{/jackson}} | ||
| {{#useEnumCaseInsensitive}}import java.util.Locale; | ||
| {{/useEnumCaseInsensitive}}import java.util.HashMap; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
|
|
||
| /** | ||
| * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} | ||
|
|
@@ -27,8 +31,16 @@ import com.fasterxml.jackson.annotation.JsonValue; | |
| {{/enumVars}} | ||
| {{/allowableValues}} | ||
|
|
||
| private static final Map<{{{dataType}}}, {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> BY_VALUE = new HashMap<>(); | ||
|
|
||
| private {{{dataType}}} value; | ||
|
|
||
| static { | ||
| for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} e: values()) { | ||
| BY_VALUE.put(e.value, e); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Case-insensitive deserialization lowercases the input but the BY_VALUE map is populated with original casing, so mixed-case enum values won't resolve. Prompt for AI agents |
||
| } | ||
| } | ||
|
|
||
| {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { | ||
| this.value = value; | ||
| } | ||
|
|
@@ -49,16 +61,6 @@ import com.fasterxml.jackson.annotation.JsonValue; | |
| @JsonCreator | ||
| {{/jackson}} | ||
| public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { | ||
| for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { | ||
| if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) { | ||
| return b; | ||
| } | ||
| } | ||
| {{#isNullable}} | ||
| return null; | ||
| {{/isNullable}} | ||
| {{^isNullable}} | ||
| throw new IllegalArgumentException("Unexpected value '" + value + "'"); | ||
| {{/isNullable}} | ||
| return Optional.ofNullable({{#useEnumCaseInsensitive}}value == null ? null : BY_VALUE.get(value.toLowerCase(Locale.ROOT)){{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}BY_VALUE.get(value){{/useEnumCaseInsensitive}}).{{#isNullable}}orElse(null){{/isNullable}}{{^isNullable}}{{#enumUnknownDefaultCase}}{{#allowableValues}}{{#enumVars}}{{#-last}}orElse({{{name}}}){{/-last}}{{/enumVars}}{{/allowableValues}}{{/enumUnknownDefaultCase}}{{^enumUnknownDefaultCase}}orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'")){{/enumUnknownDefaultCase}}{{/isNullable}}; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>org.openapitools</groupId> | ||
| <artifactId>enum-lookup-jmh</artifactId> | ||
| <name>Enum Lookup JMH</name> | ||
| <version>1.0-SNAPSHOT</version> | ||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <artifactId>maven-compiler-plugin</artifactId> | ||
| <version>3.11.0</version> | ||
| <configuration> | ||
| <annotationProcessorPaths> | ||
| <path> | ||
| <groupId>org.openjdk.jmh</groupId> | ||
| <artifactId>jmh-generator-annprocess</artifactId> | ||
| <version>${jmh.version}</version> | ||
| </path> | ||
| </annotationProcessorPaths> | ||
| </configuration> | ||
| </plugin> | ||
| <plugin> | ||
| <artifactId>maven-shade-plugin</artifactId> | ||
| <version>3.5.0</version> | ||
| <executions> | ||
| <execution> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>shade</goal> | ||
| </goals> | ||
| <configuration> | ||
| <finalName>benchmarks</finalName> | ||
| <transformers> | ||
| <transformer> | ||
| <mainClass>org.openjdk.jmh.Main</mainClass> | ||
| </transformer> | ||
| </transformers> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.openjdk.jmh</groupId> | ||
| <artifactId>jmh-generator-annprocess</artifactId> | ||
| <version>1.37</version> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| <properties> | ||
| <jmh.version>1.37</jmh.version> | ||
| <maven.compiler.target>11</maven.compiler.target> | ||
| <maven.compiler.source>11</maven.compiler.source> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| </properties> | ||
| </project> |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Case-insensitive enum lookup lowercases the input but the BY_VALUE map is populated with original casing, so mixed-case enum values will not be found when useEnumCaseInsensitive is enabled.
Prompt for AI agents