-
Notifications
You must be signed in to change notification settings - Fork 168
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
Handle xjc XmlEnumValue in DynamicJAXB enum #2273
base: master
Are you sure you want to change the base?
Conversation
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.*; |
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.
Please don't use *
in imports. We prefer specific imports like removed part.
@@ -96,17 +94,20 @@ public EclipseLinkClassWriter getClassWriter(String className) { | |||
} | |||
|
|||
public void addEnum(String className, Object... literalLabels) { | |||
var literalsMap = Arrays.stream(literalLabels) |
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.
var
is not preferred as we will backport this PR into 2.7 branch with JDK 8.0 support.
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
|
||
Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved. |
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.
For a new files Copyright (c) 2024 Oracle...
is correct.
</xs:complexType> | ||
</xs:element> | ||
|
||
<!-- This test contains exactly 6 enum values to test an ASM boundary case (ICONST) --> |
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.
This comment seems inconsistent with values 6 enum
vs 4 (QTR1...QTR4
).
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.
In general please use specific types instead of var
.
import java.util.Iterator; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.*; |
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.
Please use specific imports instead of ... .*
This should be applied to all changes.
@@ -223,7 +223,7 @@ protected void addMethods(ClassWriter cw, String parentClassType) { | |||
|
|||
protected byte[] createEnum(EnumInfo enumInfo) { | |||
|
|||
String[] enumValues = enumInfo.getLiteralLabels(); | |||
var enumValues = enumInfo.getEnumValues(); |
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.
Please use specific type instead of var
.
for (String enumValue : enumValues) { | ||
cw.visitField(Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC + Opcodes.ACC_ENUM, enumValue, "L" + internalClassName + ";", null, null); | ||
for (var enumValue : enumValues.entrySet()) { | ||
var fv = cw.visitField(Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC + Opcodes.ACC_ENUM, enumValue.getKey(), "L" + internalClassName + ";", null, null); |
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.
var
again.
To resolve #2272