eclipselink
eclipselink copied to clipboard
[master] ASM separation
Refactor EL to allow usage booth ASM implementations (standard provided by org.ow2.asm
and internal org.eclipse.persistence.asm
).
Main reason behind this enhancement is quickly adopt new Java version as Java release cycle is quicker now.
Usage of ASM implementation is controlled by new system property eclipselink.asm.service
. There are following values possible
- eclipselink - use ASM implementation from
org.eclipse.persistence.asm
project - ow2 - use ASM implementation from
org.ow2.asm
project (DEFAULT) Various EclipseLink tests should be executed with this system property e.g.
mvn verify -pl :org.eclipse.persistence.jpa.jse.test -P mysql -Declipselink.asm.service=ow2
mvn verify -pl :org.eclipse.persistence.jpa.jse.test -P mysql -Declipselink.asm.service=eclipselink
mvn test -pl :org.eclipse.persistence.moxy -P test-moxy-lrg -Declipselink.asm.service=ow2
mvn test -pl :org.eclipse.persistence.moxy -P test-moxy-lrg -Declipselink.asm.service=eclipselink
mvn clean verify -pl :org.eclipse.persistence.jpa.test -P test-jpa-lrg,mysql -Declipselink.asm.service=ow2
mvn clean verify -pl :org.eclipse.persistence.jpa.test -P test-jpa-lrg,mysql -Declipselink.asm.service=eclipselink
Code in this enhancement should be divided into following parts:
- Adapter/wrapper classes in
org.eclipse.persistence.core
module inorg.eclipse.persistence.asm
package. There are classes which translate calls from EclipseLink into ASM implementation. Code where is ASM used is pointed toorg.eclipse.persistence.asm
Java package. - Required code changes in the rest of EclipseLink code base to use adapter/wrapper classes from the previous point. Major part of these changes is
org.eclipse.persistence.internal.libraries.asm.Opcodes.ACC_PUBLIC
->org.eclipse.persistence.asm.Opcodes.valueInt("ACC_PUBLIC")
ororg.eclipse.persistence.internal.libraries.asm.Label l0 = new org.eclipse.persistence.internal.libraries.asm.Label();
->org.eclipse.persistence.asm.Label l0 = org.eclipse.persistence.asm.ASMFactory.createLabel();
- Dependency changes in pom.xml. ASM implementation artifacts are used as a compilation dependency in
org.eclipse.persistence.core
module and in the others usually as a dependency in test scope. - JPMS change as package
org.eclipse.persistence.internal.libraries.asm
and moduleorg.eclipse.persistence.asm
is not used directly in project submodules. - OSGi part is open now. There are test changes only in
OSGiBundleTest.java
.
This PR handle all scenarious how ASM is used in EclipseLink (sorted from most simple):
- Simple ASM method call or constant access without and in/out values conversion like
org.eclipse.persistence.internal.libraries.asm.Opcodes.ACC_PUBLIC
->org.eclipse.persistence.asm.Opcodes.valueInt("ACC_PUBLIC")
- Method call with in/out value conversion like
MethodVisitor mv = cw.visitMethod(....
- Most complex are classes from EclipseLink which instances are passed into ASM implementation and some methods are overriden there and some not. These classes inherits from ASM classes like ClassVisitor, ClassReader, ClassWriter.
See
org.eclipse.persistence.internal.jpa.weaving.ClassWeaver, org.eclipse.persistence.internal.jpa.weaving.ComputeClassWriter, org.eclipse.persistence.internal.jpa.weaving.MethodWeaver ...
Open questions:
- OSGi directives like <Import-Package> in some pom.xml files.
- package-rename.properties
oracle.toplink.libraries.asm=org.eclipse.persistence.internal.libraries.asm
- Opcodes.valueInt(....) performance
- module-info.java
- org.eclipse.persistence.tools.weaving.jpa.StaticWeave classpath (OW2, EclipseLink ASM) + documentation update
- Test dependencies in server tests
- Eliminate additional ASM EclipseLink* classes like EclipseLinkClassVisitor
- Decide if there is some more elegant way how to distinguish calls like "super.visit...()", than "super.visit...Super()"
- Default implementation currently is OW2, but due a historical reasons it should be org.eclipse.persistence.asm
- ASM distribution in EclipseLInk bundles.
- Extend current tests to verify booth ASM implementaions.
Fixes #1424 .
Signed-off-by: Radek Felcman [email protected]