Skip to content

Commit

Permalink
bugfix-20188: use numeric check to ensure that generated inner enums …
Browse files Browse the repository at this point in the history
…do not use valueOf factory method for BigDecimals.
  • Loading branch information
timon-sbr committed Dec 11, 2024
1 parent b218e23 commit 7d87d50
Show file tree
Hide file tree
Showing 28 changed files with 117 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{#withXml}}
@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
{{/withXml}}
{{{name}}}({{^isUri}}{{dataType}}.valueOf({{/isUri}}{{{value}}}{{^isUri}}){{/isUri}}){{^-last}},
{{{name}}}({{^isUri}}{{^isNumeric}}{{dataType}}.valueOf({{/isNumeric}}{{/isUri}}{{{value}}}{{^isUri}}{{^isNumeric}}){{/isNumeric}}{{/isUri}}){{^-last}},
{{/-last}}{{#-last}};{{/-last}}
{{/enumVars}}
{{/allowableValues}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -175,9 +175,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -167,9 +167,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -172,9 +172,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -162,9 +162,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -165,9 +165,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -165,9 +165,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -180,9 +180,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumIntegerOnly
*/
public enum EnumIntegerOnlyEnum {
NUMBER_2(Integer.valueOf(2)),
NUMBER_2(2),

NUMBER_MINUS_2(Integer.valueOf(-2));
NUMBER_MINUS_2(-2);

private Integer value;

Expand Down Expand Up @@ -219,9 +219,9 @@ public static EnumIntegerOnlyEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -178,9 +178,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumIntegerOnly
*/
public enum EnumIntegerOnlyEnum {
NUMBER_2(Integer.valueOf(2)),
NUMBER_2(2),

NUMBER_MINUS_2(Integer.valueOf(-2));
NUMBER_MINUS_2(-2);

private Integer value;

Expand Down Expand Up @@ -217,9 +217,9 @@ public static EnumIntegerOnlyEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -180,9 +180,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumIntegerOnly
*/
public enum EnumIntegerOnlyEnum {
NUMBER_2(Integer.valueOf(2)),
NUMBER_2(2),

NUMBER_MINUS_2(Integer.valueOf(-2));
NUMBER_MINUS_2(-2);

private Integer value;

Expand Down Expand Up @@ -219,9 +219,9 @@ public static EnumIntegerOnlyEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -165,9 +165,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ public EnumStringRequiredEnum read(final JsonReader jsonReader) throws IOExcepti
*/
@JsonAdapter(EnumIntegerEnum.Adapter.class)
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -196,9 +196,9 @@ public EnumIntegerEnum read(final JsonReader jsonReader) throws IOException {
*/
@JsonAdapter(EnumNumberEnum.Adapter.class)
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -173,9 +173,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -172,9 +172,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ public static EnumStringRequiredEnum fromValue(String value) {
* Gets or Sets enumInteger
*/
public enum EnumIntegerEnum {
NUMBER_1(Integer.valueOf(1)),
NUMBER_1(1),

NUMBER_MINUS_1(Integer.valueOf(-1));
NUMBER_MINUS_1(-1);

private Integer value;

Expand Down Expand Up @@ -172,9 +172,9 @@ public static EnumIntegerEnum fromValue(Integer value) {
* Gets or Sets enumNumber
*/
public enum EnumNumberEnum {
NUMBER_1_DOT_1(Double.valueOf(1.1)),
NUMBER_1_DOT_1(1.1),

NUMBER_MINUS_1_DOT_2(Double.valueOf(-1.2));
NUMBER_MINUS_1_DOT_2(-1.2);

private Double value;

Expand Down
Loading

0 comments on commit 7d87d50

Please sign in to comment.