Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336508

Summary: Disabling weaving of fetch groups causes VerifyError
Product: z_Archived Reporter: Tom Ware <tom.ware>
Component: EclipselinkAssignee: Tom Ware <tom.ware>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: eclipselink.orm-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed Fix - more testing required none

Description Tom Ware CLA 2011-02-07 09:31:17 EST
Set the following persistence unit in any of our test persistence units and run the tests

<property name="eclipselink.weaving.fetchgroups" value="false"/>

You will see an exception like this:
java.lang.VerifyError: (class: org/eclipse/persistence/testing/models/jpa/delimited/Project, method: setVersion signature: (I)V) Register 2 contains wrong type
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:247)
	at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(PrivilegedAccessHelper.java:93)
	at org.eclipse.persistence.descriptors.ClassDescriptor.convertClassNamesToClasses(ClassDescriptor.java:1258)
	at org.eclipse.persistence.sessions.Project.convertClassNamesToClasses(Project.java:367)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:338)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:185)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:242)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:230)
	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.createEntityManager(JUnitTestCase.java:347)
	at org.eclipse.persistence.testing.tests.jpa.delimited.DelimitedPUTestSuite.testPopulate(DelimitedPUTestSuite.java:62)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:503)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



Running with the system properties:

eclipselink.weaving.output.path=<path>
eclipselink.weaving.overwrite.existing=true

Will output the classes as they are weaved.

Decompile those classes and you will see that the class is inproperly built
Comment 1 Tom Ware CLA 2011-02-07 15:53:21 EST
This issue occurs in persistence units where the following is true

1. PROPERTY access is used
2. The underlying field represented by the property does not have the same name as the property.  (e.g. m_budget is the field name and getBudget/setBudget are the method names)
3. The property is a java primitive
Comment 2 Tom Ware CLA 2011-02-08 08:20:58 EST
Created attachment 188515 [details]
Proposed Fix - more testing required
Comment 3 Tom Ware CLA 2011-02-17 15:42:57 EST
Checked in weaver fix for issue with fetch group weaving disabled.

I have tested this manually, but this check-in will be properly tested by some changes the QA team is providing and the check-in facilitates running their testing.

The changes only affect persistence units with eclipselink.weaving.fetch-groups=false 

Initial check-in to trunk only pending tests.
Comment 4 Tom Ware CLA 2011-02-18 09:42:24 EST
QA test verifys improvement.  Checking into 2.2 stream as well.
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:06:18 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink