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

Bug 321641

Summary: No way to exclude Proxool classes although excluded from AOP. Causing Veryfy error.
Product: [Tools] AspectJ Reporter: Abraham Nevado <info>
Component: LTWeavingAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: aclement, info
Version: 1.6.9   
Target Milestone: 1.6.10   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
This is the unique aop.xml we are using
none
Proposed Patch aclement: iplog+

Description Abraham Nevado CLA 2010-08-03 14:05:08 EDT
Build Identifier: 20100218-1602

For aspectJ 1.6.7 the setup works, however exactly the same setup but changing the aspectJ version to 1.6.8 or 1.6.9 derive to the same error: a piece of code excluded from the aop.xml is woven causing a Verify Error.

We are using Proxool, proxy setup which in fact uses CGLIB to create a EnhancerProxy class. In order to avoid VerifyError exceptions the Proxool classes are excluded from aop.xml exactly in the same way the CGLIB workarround is commented in the aspectJ FAQ:

		<exclude within="*..*Proxool*"/>


This is the error we got when we upgrade our 1.6.7 aspejctweaver.jar to 1.6.8. The same is got when using 1.6.9:

jvm 3    | 2010/08/03 16:42:53 | java.lang.VerifyError: (class: oracle/jdbc/internal/OracleConnection$$EnhancerByProxool$$7f6320a8, method: getTdoCState signature: (Ljava/lang/String;Ljava/lang/String;)J) Inconsistent stack height 1 != 0
jvm 3    | 2010/08/03 16:42:53 | 	at java.lang.Class.getDeclaredMethods0(Native Method)
jvm 3    | 2010/08/03 16:42:53 | 	at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
jvm 3    | 2010/08/03 16:42:53 | 	at java.lang.Class.getDeclaredMethod(Class.java:1935)
jvm 3    | 2010/08/03 16:42:53 | 	at org.logicalcobwebs.cglib.proxy.Enhancer.getCallbacksSetter(Enhancer.java:627)
jvm 3    | 2010/08/03 16:42:53 | 	at org.logicalcobwebs.cglib.proxy.Enhancer.setCallbacksHelper(Enhancer.java:615)
jvm 3    | 2010/08/03 16:42:53 | 	at org.logicalcobwebs.cglib.proxy.Enhancer.setThreadCallbacks(Enhancer.java:609)
jvm 3    | 2010/08/03 16:42:53 | 	at org.logicalcobwebs.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:631)
jvm 3    | 2010/08/03 16:42:53 | 	at org.logicalcobwebs.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)
jvm 3    | 2010/08/03 16:42:53 | 	at org.logicalcobwebs.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:225)
jvm 3    | 2010/08/03 16:42:53 | 	at org.logicalcobwebs.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
jvm 3    | 2010/08/03 16:42:53 | 	at org.logicalcobwebs.cglib.proxy.Enhancer.create(Enhancer.java:285)
....

As far as the Verify Error is got while deploying one of the applications that run on the serve we are no able to use the new versions of aspectJ because the application is not properly started up.

Thank you very much in advance,

Best regards.

Reproducible: Always

Steps to Reproduce:
1.Exclude Proxool classes from aop.xml using aspectj 1.6.7. It works
2.Upgrade to 1.6.8: it does not work.
3.Upgrade to 1.6.9: it does not work.
Comment 1 Abraham Nevado CLA 2010-08-03 14:06:49 EDT
Created attachment 175805 [details]
This is the unique aop.xml we are using
Comment 2 Abraham Nevado CLA 2010-08-09 23:06:53 EDT
Created attachment 176202 [details]
Proposed Patch
Comment 3 Abraham Nevado CLA 2010-08-09 23:14:31 EDT
I believe the issue is related to new modifications regarding fast exclusion patterns.

While before patterns such us "*..*CGLIB*" where matching for classes like com/mycompany/framework/service/MessageService$$EnhancerByCGLIB$$6dd4e683

Now the *..*CGLIB* patterns are stored in the list excludeStarDotDotStar and the next piece of code is executed:

		if (!excludeStarDotDotStar.isEmpty()) {
			for (String namePiece : excludeStarDotDotStar) {
				int index = fastClassName.lastIndexOf('.');
				if (fastClassName.indexOf(namePiece, index + 1) != -1) {
					return false;
				}
			}
		}
where fastClassName = com.mycompany.framework.service.MessageService..EnhancerByCGLIB..6dd4e683
as init previously in the line:

String fastClassName = className.replace('/', '.').replace('$', '.');

Which in turns makes the excludeStarDotDotStar method not to work as expected for this kind of patterns because GCGLIB is searched at string 6dd4e683, where never is, so it always return true. 

In order to avoid this, I suggest just changing the fastClassName at the very beginning avoiding '$' substituion and just after the excludeStarDotDotStar fast pattern check is performed, substitute the '$' character by '.' to allow the rest of code work smoothly.

I have created a diff patch with this suggestion already coded.

Feedback is welcome.

Thank you.
Comment 4 Andrew Clement CLA 2010-08-10 11:13:55 EDT
a shame the patch is not against my repo, it does make it messier to apply.  I also like to have a test with each patch to stop any future regressions.

I've created a tiny test and applied the change. thanks!!