Skip to content

Commit

Permalink
schemaframework, serial annotation
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <[email protected]>
  • Loading branch information
lukasj committed Feb 22, 2024
1 parent d8375ee commit 039ce18
Show file tree
Hide file tree
Showing 104 changed files with 426 additions and 440 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -33,8 +33,11 @@
import org.eclipse.persistence.oxm.schema.XMLSchemaURLReference;
import org.eclipse.persistence.sessions.Project;

import java.io.Serial;

public class SimpleXMLFormatProject extends Project {

@Serial
private static final long serialVersionUID = 3830217546821842428L;
private transient NamespaceResolver ns;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public Vector getFavouriteRestaurants() {
}

/**
* Return a platform independant definition of the database table.
* Return a platform independent definition of the database table.
*/
public static org.eclipse.persistence.tools.schemaframework.TableDefinition relationTableDefinition() {
org.eclipse.persistence.tools.schemaframework.TableDefinition definition = new org.eclipse.persistence.tools.schemaframework.TableDefinition();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -15,6 +15,8 @@
package org.eclipse.persistence.internal.sessions.coordination.corba.sun;


import java.io.Serial;

/**
* org/eclipse/persistence/internal/remotecommand/corba/sun/_SunCORBAConnectionStub.java .
* Generated by the IDL-to-Java compiler (portable), version "3.1"
Expand Down Expand Up @@ -51,6 +53,7 @@ public String[] _ids() {
return __ids.clone();
}

@Serial
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
String str = s.readUTF();
String[] args = null;
Expand All @@ -60,6 +63,7 @@ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException
_set_delegate(delegate);
}

@Serial
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
String[] args = null;
java.util.Properties props = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -15,6 +15,8 @@
package org.eclipse.persistence.sessions.remote.corba.sun;


import java.io.Serial;

/**
* INTERNAL:
* org/eclipse/persistence/remote/corba/sun/_CORBARemoteSessionControllerStub.java
Expand Down Expand Up @@ -756,6 +758,7 @@ public String[] _ids() {
return __ids.clone();
}

@Serial
private void readObject(java.io.ObjectInputStream s) {
try {
String str = s.readUTF();
Expand All @@ -766,6 +769,7 @@ private void readObject(java.io.ObjectInputStream s) {
}
}

@Serial
private void writeObject(java.io.ObjectOutputStream s) {
try {
String str = org.omg.CORBA.ORB.init().object_to_string(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ static int getLatestOPCodeVersion() {
final Map<String, Integer> versionMap = new LinkedHashMap<>();
Pattern searchPattern = Pattern.compile("^V\\d((_\\d)?|\\d*)");
try {
Class opcodesClazz = Opcodes.getOpcodesClass();
Class<?> opcodesClazz = Opcodes.getOpcodesClass();
for (Field f : opcodesClazz.getDeclaredFields()) {
if (searchPattern.matcher(f.getName()).matches()) {
versionMap.put(f.getName().replace("V","").replace('_', '.'), f.getInt(opcodesClazz));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public String getCommonSuperClass(final String type1, final String type2) {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
if (this.classWriter instanceof org.eclipse.persistence.asm.internal.platform.ow2.ClassWriterImpl) {
return (T)((org.eclipse.persistence.asm.internal.platform.ow2.ClassWriterImpl)this.classWriter).getInternal(this.customClassWriter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void visitEnd() {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
if (this.annotationVisitor instanceof org.eclipse.persistence.asm.internal.platform.ow2.AnnotationVisitorImpl) {
return (T)((org.eclipse.persistence.asm.internal.platform.ow2.AnnotationVisitorImpl)this.annotationVisitor).getInternal(this.customAnnotationVisitor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public String[] getInterfaces() {
return classReader.getInterfaces();
}

@Override
@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
if (this.classReader instanceof org.eclipse.persistence.asm.internal.platform.ow2.ClassReaderImpl) {
return (T)((org.eclipse.persistence.asm.internal.platform.ow2.ClassReaderImpl)this.classReader).getInternal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
if (this.fieldVisitor instanceof org.eclipse.persistence.asm.internal.platform.ow2.FieldVisitorImpl) {
return (T)((org.eclipse.persistence.asm.internal.platform.ow2.FieldVisitorImpl)this.fieldVisitor).getInternal(this.customFieldVisitor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ public AnnotationVisitor visitAnnotationSuper(String descriptor, boolean visible
return this.methodVisitor.visitAnnotationSuper(descriptor, visible);
}

@Override
@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
if (this.methodVisitor instanceof org.eclipse.persistence.asm.internal.platform.ow2.MethodVisitorImpl) {
return (T)((org.eclipse.persistence.asm.internal.platform.ow2.MethodVisitorImpl)this.methodVisitor).getInternal(this.customMethodVisitor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private static int valueInt(String fieldName) {
return ((int) Util.getFieldValue(ASM_OPCCODES_MAP, fieldName, Integer.TYPE));
}

public static Class getOpcodesClass() {
public static Class<?> getOpcodesClass() {
String asmService = ASMFactory.getAsmService();
Class<?> clazz;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@
import java.lang.invoke.VarHandle;
import java.util.Map;

public class Util {
public final class Util {

//java.lang.invoke.VarHandle >= JDK 9


private Util() {
// no instance
}

public static Object getFieldValue(Map<String, String> targetNames, String name, Class<?> type) {
String asmService = ASMFactory.getAsmService();
Object result = null;
try {
MethodHandles.Lookup lookup = MethodHandles.lookup();
String className = targetNames.get(asmService);
Expand All @@ -36,11 +40,10 @@ public static Object getFieldValue(Map<String, String> targetNames, String name,
}
Class<?> clazz = Class.forName(className);
VarHandle field = lookup.findStaticVarHandle(clazz, name, type);
result = field.get();
return field.get();
} catch (ClassNotFoundException | IllegalAccessException | NoSuchFieldException e) {
throw ValidationException.notAvailableASMService();
}
return result;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public void visitEnd() {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T) this.elAnnotationVisitor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public AttributeImpl(String type) {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.attribute;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void accept(ClassVisitor classVisitor, int parsingOptions) {

@Override
public void accept(ClassVisitor classVisitor, Attribute[] attributePrototypes, int parsingOptions) {
org.eclipse.persistence.internal.libraries.asm.Attribute[] attributePrototypesUnwrap = Arrays.stream(attributePrototypes).map(value -> value.unwrap()).toArray(size -> new org.eclipse.persistence.internal.libraries.asm.Attribute[size]);
org.eclipse.persistence.internal.libraries.asm.Attribute[] attributePrototypesUnwrap = Arrays.stream(attributePrototypes).map(value -> value.unwrap()).toArray(org.eclipse.persistence.internal.libraries.asm.Attribute[]::new);
elClassReader.accept(classVisitor.unwrap(), attributePrototypesUnwrap, parsingOptions);
}

Expand All @@ -79,6 +79,7 @@ public String[] getInterfaces() {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.elClassReader;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public void visitEnd() {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.elClassVisitor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public byte[] toByteArraySuper() {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.elClassWriter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.elFieldVisitor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public LabelImpl(Label label) {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.elLabel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,25 +461,25 @@ public void visitIincInsnSuper(int var, int increment) {

@Override
public void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels) {
org.eclipse.persistence.internal.libraries.asm.Label[] labelsUnwrap = Arrays.stream(labels).map(value -> value.unwrap()).toArray(size -> new org.eclipse.persistence.internal.libraries.asm.Label[size]);
org.eclipse.persistence.internal.libraries.asm.Label[] labelsUnwrap = Arrays.stream(labels).map(value -> value.unwrap()).toArray(org.eclipse.persistence.internal.libraries.asm.Label[]::new);
this.ow2MethodVisitor.visitTableSwitchInsn(min, max, dflt.unwrap(), labelsUnwrap);
}

@Override
public void visitTableSwitchInsnSuper(int min, int max, Label dflt, Label... labels) {
org.eclipse.persistence.internal.libraries.asm.Label[] labelsUnwrap = Arrays.stream(labels).map(value -> value.unwrap()).toArray(size -> new org.eclipse.persistence.internal.libraries.asm.Label[size]);
org.eclipse.persistence.internal.libraries.asm.Label[] labelsUnwrap = Arrays.stream(labels).map(value -> value.unwrap()).toArray(org.eclipse.persistence.internal.libraries.asm.Label[]::new);
((ELMethodVisitor)this.ow2MethodVisitor).visitTableSwitchInsnSuper(min, max, dflt.unwrap(), labelsUnwrap);
}

@Override
public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
org.eclipse.persistence.internal.libraries.asm.Label[] labelsUnwrap = Arrays.stream(labels).map(value -> value.unwrap()).toArray(size -> new org.eclipse.persistence.internal.libraries.asm.Label[size]);
org.eclipse.persistence.internal.libraries.asm.Label[] labelsUnwrap = Arrays.stream(labels).map(value -> value.unwrap()).toArray(org.eclipse.persistence.internal.libraries.asm.Label[]::new);
this.ow2MethodVisitor.visitLookupSwitchInsn(dflt.unwrap() , keys, labelsUnwrap);
}

@Override
public void visitLookupSwitchInsnSuper(Label dflt, int[] keys, Label[] labels) {
org.eclipse.persistence.internal.libraries.asm.Label[] labelsUnwrap = Arrays.stream(labels).map(value -> value.unwrap()).toArray(size -> new org.eclipse.persistence.internal.libraries.asm.Label[size]);
org.eclipse.persistence.internal.libraries.asm.Label[] labelsUnwrap = Arrays.stream(labels).map(value -> value.unwrap()).toArray(org.eclipse.persistence.internal.libraries.asm.Label[]::new);
((ELMethodVisitor)this.ow2MethodVisitor).visitLookupSwitchInsnSuper(dflt.unwrap() , keys, labelsUnwrap);
}

Expand Down Expand Up @@ -524,6 +524,7 @@ public AnnotationVisitor visitAnnotationSuper(final String descriptor, final boo
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.ow2MethodVisitor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public SerialVersionUIDAdderImpl(final org.eclipse.persistence.asm.ClassVisitor
this.elSerialVersionUIDAdder = new ElSerialVersionUIDAdder((classVisitor != null) ? classVisitor.unwrap() : null);
}

@Override
@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.elSerialVersionUIDAdder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected String getMethodDescriptorInternal(final Method method) {

@Override
protected String getMethodDescriptorInternal(org.eclipse.persistence.asm.Type returnType, org.eclipse.persistence.asm.Type... argumentTypes) {
Type[] unwrappedArgumentTypes = Arrays.stream(argumentTypes).map(value -> value.unwrap()).toArray(size -> new org.eclipse.persistence.internal.libraries.asm.Type[size]);
Type[] unwrappedArgumentTypes = Arrays.stream(argumentTypes).map(value -> value.unwrap()).toArray(org.eclipse.persistence.internal.libraries.asm.Type[]::new);
return this.type.getMethodDescriptor(returnType.unwrap(), unwrappedArgumentTypes);
}

Expand All @@ -75,6 +75,7 @@ public String getClassName() {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public void visitEnd() {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T) this.ow2AnnotationVisitor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public AttributeImpl(String type) {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.ow2Attribute;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void accept(ClassVisitor classVisitor, int parsingOptions) {

@Override
public void accept(ClassVisitor classVisitor, Attribute[] attributePrototypes, int parsingOptions) {
org.objectweb.asm.Attribute[] attributePrototypesUnwrap = Arrays.stream(attributePrototypes).map(value -> value.unwrap()).toArray(size -> new org.objectweb.asm.Attribute[size]);
org.objectweb.asm.Attribute[] attributePrototypesUnwrap = Arrays.stream(attributePrototypes).map(value -> value.unwrap()).toArray(org.objectweb.asm.Attribute[]::new);
ow2ClassReader.accept(classVisitor.unwrap(), attributePrototypesUnwrap, parsingOptions);
}

Expand All @@ -69,6 +69,7 @@ public String[] getInterfaces() {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.ow2ClassReader;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public void visitEnd() {
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.ow2ClassVisitor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ public byte[] toByteArraySuper() {
return ow2ClassWriter.toByteArraySuper();
}

@Override
@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.ow2ClassWriter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean
}

@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.ow2FieldVisitor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public LabelImpl(Label label) {
this.ow2Label = label;
}

@Override
@Override
@SuppressWarnings({"unchecked"})
public <T> T unwrap() {
return (T)this.ow2Label;
}
Expand Down
Loading

0 comments on commit 039ce18

Please sign in to comment.