Skip to content

Commit

Permalink
[Master] Update Eclipselink to use Eclipselink*Visitor types (#1234)
Browse files Browse the repository at this point in the history
* Update Eclipselink ASM usage to use EclipseLink*Visitor types.

Signed-off-by: Joe Grassel <fyrewyld@gmail.com>
  • Loading branch information
jgrassel committed Aug 7, 2021
1 parent 8775292 commit 99631ab
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@
import org.eclipse.persistence.internal.jpa.metadata.MetadataDescriptor;
import org.eclipse.persistence.internal.jpa.metadata.MetadataLogger;
import org.eclipse.persistence.internal.libraries.asm.AnnotationVisitor;
import org.eclipse.persistence.internal.libraries.asm.EclipseLinkAnnotationVisitor;
import org.eclipse.persistence.internal.libraries.asm.Attribute;
import org.eclipse.persistence.internal.libraries.asm.ClassReader;
import org.eclipse.persistence.internal.libraries.asm.ClassVisitor;
import org.eclipse.persistence.internal.libraries.asm.EclipseLinkClassVisitor;
import org.eclipse.persistence.internal.libraries.asm.EclipseLinkFieldVisitor;
import org.eclipse.persistence.internal.libraries.asm.EclipseLinkClassReader;
import org.eclipse.persistence.internal.libraries.asm.FieldVisitor;
import org.eclipse.persistence.internal.libraries.asm.EclipseLinkMethodVisitor;
import org.eclipse.persistence.internal.libraries.asm.MethodVisitor;
import org.eclipse.persistence.internal.libraries.asm.Opcodes;
import org.eclipse.persistence.internal.libraries.asm.Type;
Expand Down Expand Up @@ -239,14 +243,14 @@ public void resolveGenericTypes(MetadataClass child, List<String> genericTypes,
/**
* Walk the class byte codes and collect the class info.
*/
public class ClassMetadataVisitor extends ClassVisitor {
public class ClassMetadataVisitor extends EclipseLinkClassVisitor {

private boolean isLazy;
private boolean processedMemeber;
private MetadataClass classMetadata;

ClassMetadataVisitor(MetadataClass metadataClass, boolean isLazy) {
super(Opcodes.ASM9);
super();
this.isLazy = isLazy;
this.classMetadata = metadataClass;
}
Expand Down Expand Up @@ -331,7 +335,7 @@ public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
*
* @see MetadataAnnotationArrayVisitor for population of array attributes
*/
class MetadataAnnotationVisitor extends AnnotationVisitor {
class MetadataAnnotationVisitor extends EclipseLinkAnnotationVisitor {

/**
* Element the annotation is being applied to. If this is null the
Expand All @@ -350,15 +354,15 @@ class MetadataAnnotationVisitor extends AnnotationVisitor {
}

MetadataAnnotationVisitor(MetadataAnnotatedElement element, String name, boolean isRegular) {
super(Opcodes.ASM9);
super();
this.element = element;
this.annotation = new MetadataAnnotation();
this.annotation.setName(processDescription(name, false).get(0));
this.annotation.setIsMeta(!isRegular);
}

public MetadataAnnotationVisitor(MetadataAnnotation annotation) {
super(Opcodes.ASM9);
super();
this.annotation = annotation;
}

Expand Down Expand Up @@ -401,7 +405,7 @@ public void visitEnd() {
* Specialized visitor to handle the population of arrays of annotation
* values.
*/
class MetadataAnnotationArrayVisitor extends AnnotationVisitor {
class MetadataAnnotationArrayVisitor extends EclipseLinkAnnotationVisitor {

private MetadataAnnotation annotation;

Expand All @@ -410,7 +414,7 @@ class MetadataAnnotationArrayVisitor extends AnnotationVisitor {
private List<Object> values;

public MetadataAnnotationArrayVisitor(MetadataAnnotation annotation, String name) {
super(Opcodes.ASM9);
super();
this.annotation = annotation;
this.attributeName = name;
this.values = new ArrayList<Object>();
Expand Down Expand Up @@ -444,12 +448,12 @@ public void visitEnd() {
* Factory for the creation of {@link MetadataField} handling basic type,
* generics, and annotations.
*/
class MetadataFieldVisitor extends FieldVisitor {
class MetadataFieldVisitor extends EclipseLinkFieldVisitor {

private MetadataField field;

public MetadataFieldVisitor(MetadataClass classMetadata, int access, String name, String desc, String signature, Object value) {
super(Opcodes.ASM9);
super();
this.field = new MetadataField(classMetadata);
this.field.setModifiers(access);
this.field.setName(name);
Expand Down Expand Up @@ -479,12 +483,12 @@ public void visitEnd() {
*/
// Note: Subclassed EmptyListener to minimize signature requirements for
// ignored MethodVisitor API
class MetadataMethodVisitor extends MethodVisitor {
class MetadataMethodVisitor extends EclipseLinkMethodVisitor {

private MetadataMethod method;

public MetadataMethodVisitor(MetadataClass classMetadata, int access, String name, String desc, String signature, String[] exceptions) {
super(Opcodes.ASM9);
super();
this.method = new MetadataMethod(MetadataAsmFactory.this, classMetadata);

this.method.setName(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import org.eclipse.persistence.internal.helper.Helper;
import org.eclipse.persistence.internal.libraries.asm.ClassVisitor;
import org.eclipse.persistence.internal.libraries.asm.EclipseLinkClassVisitor;
import org.eclipse.persistence.internal.libraries.asm.FieldVisitor;
import org.eclipse.persistence.internal.libraries.asm.Label;
import org.eclipse.persistence.internal.libraries.asm.MethodVisitor;
Expand All @@ -41,7 +42,7 @@
* @see org.eclipse.persistence.internal.jpa.weaving.MethodWeaver
*/

public class ClassWeaver extends ClassVisitor implements Opcodes {
public class ClassWeaver extends EclipseLinkClassVisitor implements Opcodes {

// PersistenceWeaved
public static final String PERSISTENCE_WEAVED_SHORT_SIGNATURE = "org/eclipse/persistence/internal/weaving/PersistenceWeaved";
Expand Down Expand Up @@ -215,7 +216,7 @@ public static boolean isJAXBOnPath() {
}

public ClassWeaver(ClassVisitor classWriter, ClassDetails classDetails) {
super(ASM8, classWriter);
super(classWriter);
this.classDetails = classDetails;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.eclipse.persistence.internal.descriptors.VirtualAttributeMethodInfo;
import org.eclipse.persistence.internal.libraries.asm.Attribute;
import org.eclipse.persistence.internal.libraries.asm.Label;
import org.eclipse.persistence.internal.libraries.asm.EclipseLinkMethodVisitor;
import org.eclipse.persistence.internal.libraries.asm.MethodVisitor;
import org.eclipse.persistence.internal.libraries.asm.Opcodes;
import org.eclipse.persistence.internal.libraries.asm.Type;
Expand All @@ -34,7 +35,7 @@
*
*/

public class MethodWeaver extends MethodVisitor implements Opcodes {
public class MethodWeaver extends EclipseLinkMethodVisitor implements Opcodes {

protected ClassWeaver tcw;
protected String methodName;
Expand All @@ -44,7 +45,7 @@ public class MethodWeaver extends MethodVisitor implements Opcodes {
protected boolean methodStarted = false;

public MethodWeaver(ClassWeaver tcw, String methodName, String methodDescriptor, MethodVisitor mv) {
super(ASM8, mv);
super(mv);
this.tcw = tcw;
this.methodName = methodName;
this.methodDescriptor = methodDescriptor;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
<test.xml.parser>org.eclipse.persistence.platform.xml.jaxp.JAXPParser</test.xml.parser>

<!--Eclipse Dependencies version-->
<eclipselink.asm.version>9.1.0</eclipselink.asm.version>
<eclipselink.asm.version>9.1.1</eclipselink.asm.version>
<activation.version>2.0.1</activation.version>
<annotation.version>2.0.0</annotation.version>
<cdi.version>3.0.0</cdi.version>
Expand Down

0 comments on commit 99631ab

Please sign in to comment.