Community
Participate
Working Groups
I'm fairly new to AspectJ, so this is probably not going to be well explained. I've started working on a project that was working fine. Then I added methods to classes that take a 2-dimensional string array parameter and suddenly I'm getting a VerifyError exception. java.lang.VerifyError: (class: com/drkw/cpds/obligor/facades/version_1_00/ObligorDetailFacade_1_00, method: searchForObligorSummariesByGroup_aroundBody24 signature: (Lcom/drkw/cpds/obligor/facades/version_1_00/ObligorDetailFacade_1_00;[[[Ljava/lang/String;Ljava/lang/String;LjavaÀ(‚ at com.drkw.cpds.obligor.facades.version_1_00.obligor.ObligorManager.<clinit>(ObligorManager.java:48) at com.drkw.cpds.obligor.integration.version_1_00.obligor.GetObligorDetailsGroupingTest.testGetObligorDetailsUsingGroups(GetObligorDetailsGroupingTest.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
Are you able to attach any of the code that leads to this problem? perhaps at least the ITD statements you are using? Are you working with Java5 constructs (generics?) or just regular 1.4 java? What level of the compiler are you on, the latest?
I'm using: Java 1.4.2_07 Eclipse 3.1.1 AspectJ dev tools 1.3.0 build 20051130095036 Sorry - dont know what you mean by ITD. I think the method I've added that's causing the problem is public ObligorDetail[] searchForObligorDetailsByGroup(String[][] mistralId, String name, String country, String legalEntity, Integer startPosition, Integer pageSize, SortKey[] sortKeys) throws BusinessException; We have a similar method that takes a single-dimension array as the first parameter instead of this 2-dimension array but is the same otherwise. That's been working fine for ages.
Oh, I see from the code, you have advised the method with around advice. I initially assumed when you said 'added a method to a class' that you had made an inter-type declaration ITD, something like: public void SomeClass.newMethod() {} Can you tell me the signature for the around advice (and the pointcut) that you are using to match this? public ObligorDetail[] searchForObligorDetailsByGroup(String[][] mistralId, String name, String country, String legalEntity, Integer startPosition, Integer pageSize, SortKey[] sortKeys) throws BusinessException; In the meantime, I'll try a similar method with two dimensional params.
I said I wouldnt explain it well, didnt I ;-) Hope this makes sense. I'm also trying to start with a simplest case of a class and an aspect to try to isolate this, but at the moment I'm getting other exceptions. The java method is: public ObligorSummary[] searchForObligorSummariesByGroup(String[][] mistralId, String name, String country, String legalEntity, Integer startPosition, Integer pageSize, SortKey[] keys) throws BusinessException; The classname is ObligorDetailFacade_1_00 which extends abstract class ObligorManager There are 2 around advices: a) Object around() throws AspectException : no_transaction_required_calls() with pointcut pointcut no_transaction_required_calls(): all_1_00_Calls() && !transaction_required_calls(); b) Object around() throws AspectException, SystemException : all_1_00_Calls(); pointcut all_1_00_Calls is defined as: pointcut all_1_00_Calls(): !callGetInstance() && (callXref_1_00() || callObligor_1_00() || callVerify_1_00()); where the callObligor_1_00 is the one that matches here... pointcut callObligor_1_00(): execution(public * com.drkw.cpds.obligor.facades.version_1_00.obligor.ObligorManager+.*(..));
I've now reproduced this with a simple class... --- Class --- package blah; import java.util.Random; public class MyClass { public Integer[] getRandomInt(String[][] param) { for (int i = 0; i < param.length; i++) { System.out.print("[" + i + "] = ["); for (int j = 0; j < param[i].length; j++) { System.out.print(param[i][j]); if (j != param[i].length-1) System.out.print(','); } System.out.println(']'); } return new Integer[] { new Integer(new Random().nextInt())}; } } --- Aspect --- package blah; public aspect MyAspect { pointcut callPointCut(): call(public * blah.MyClass+.*(..)); Object around() : callPointCut() { System.out.println("start of around"); Object result = proceed(); System.out.println("end of around"); return result; } } --- Main class --- package blah; /** */ public class MyMain { /** * @param args */ public static void main(String[] args) { MyClass mc = new MyClass(); mc.getRandomInt(new String[][]{{ "a", "b", "c"},{"x","y","z"}}); } } --- Exception --- java.lang.VerifyError: (class: blah/MyMain$AjcClosure3, method: run signature: ([Ljava/lang/Object;)Ljava/lang/Object;) Incompatible argument to function at blah.MyMain.main(MyMain.java:15) Exception in thread "main"
thanks for the simple testcase Ian ... but ... I still can't get it to fail for me :( I've tried in AJDT and from the command line, I've switched to a 1.4.2 vm from my usual 1.5 (although I'm on an earlier version of 1.4.2 than you). Do you have any options configured in the AspectJ pages for the project? I'm just trying to work out the difference between your environment and mine... my ajdt is a little older than yours - i'll try updating that now to see if it makes a difference.
Progress - sort of. I have Advanced/No Inline switched on. As soon as I turn it off and recompile, my simple case works. However it appears to make no difference to my main project. I'm still investigating.
thats it!! I can recreate it with -XnoInline turned on :)
Good, that's pinpointed it. However I'm still not able to get past it in my real application, so all I've done is invalidate my simple test case. Any other suggestions welcome!
Fix checked in ... we incorrectly handled multi-dimensional array signatures. In fact String[][] was turning into String[][][] !! Fix will be in next aspectj dev build and in AJDT in a couple of days.
fix available in latest AspectJ dev build - will probably be in AJDT on Monday.
*** Bug 119408 has been marked as a duplicate of this bug. ***