Bug 118781 - [waiting-on-build]VerifyError in AspectJ
Summary: [waiting-on-build]VerifyError in AspectJ
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 119408 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-12-01 03:43 EST by Ian Orford CLA
Modified: 2006-05-10 10:54 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Orford CLA 2005-12-01 03:43:53 EST
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)
Comment 1 Andrew Clement CLA 2005-12-01 03:52:23 EST
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?
Comment 2 Ian Orford CLA 2005-12-01 04:03:45 EST
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.

Comment 3 Andrew Clement CLA 2005-12-01 04:26:03 EST
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.
Comment 4 Ian Orford CLA 2005-12-01 05:17:44 EST
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+.*(..));


Comment 5 Ian Orford CLA 2005-12-01 06:09:51 EST
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" 
Comment 6 Andrew Clement CLA 2005-12-01 06:46:35 EST
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.
Comment 7 Ian Orford CLA 2005-12-01 06:59:08 EST
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.
Comment 8 Andrew Clement CLA 2005-12-01 07:11:27 EST
thats it!!  I can recreate it with -XnoInline turned on :)
Comment 9 Ian Orford CLA 2005-12-01 07:21:22 EST
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!
Comment 10 Andrew Clement CLA 2005-12-01 10:06:04 EST
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.
Comment 11 Andrew Clement CLA 2005-12-01 11:49:42 EST
fix available in latest AspectJ dev build - will probably be in AJDT on Monday.
Comment 12 Wes Isberg CLA 2006-05-10 10:54:44 EDT
*** Bug 119408 has been marked as a duplicate of this bug. ***