Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Help - Compilation works with 1.1 but fails with 1.2

> Hi,
> 
> This is the class I have defined.
> public class OverloadMethodTest
> {
> 	public void test(String one)	{
> 	}
> 	public void test(String one, int two)	{
> 	}
> 	public void test1(String one)	{
> 	}
> 	public void test1(String one, int two)	{
> 	}
> }
> 
> This is the aspect that I want to weave with the above class.
> 
> public aspect OverloadMethodAspect
> {
> 	public pointcut test(String strArg) : 
> 		execution(* OverloadMethodTest.test(String,..)) &&
> args(strArg,..);
> 	
> 	public pointcut test1(String strArg) :
> 		execution(* OverloadMethodTest.test1(String,..)) &&
> args(strArg,..);
> 
> 	public pointcut both(String strArg) : test(strArg)  ||
> test1(strArg);
> 
> 	before(String strArg) : both(strArg) {
> 		System.out.println("Before Calling method " +
> thisJoinPointStaticPart.getSignature().getName()
> 					+ " strArg " + strArg);
> 	}
> }
> 
> It works with the aspectj 1.1 version, but fails when compiled using
> aspectJ 1.2  with the following errors
> 
> D:\work\TestAspects\OverloadMethodTest.java:9 error Ambiguous binding of
> type ja
> va.lang.String using args(..) at this line.  Use one args(..) per matched
> join p
> oint, see secondary source location for location of extraneous args(..)
> (no source information available)
> 
>         see also: D:\work\TestAspects\OverloadMethodAspect.aj:7
>         see also: D:\work\TestAspects\OverloadMethodTest.jar
> D:\work\TestAspects\OverloadMethodTest.java:11 error Ambiguous binding of
> type j
> ava.lang.String using args(..) at this line.  Use one args(..) per matched
> join
> point, see secondary source location for location of extraneous args(..)
> (no source information available)
> 
>         see also: D:\work\TestAspects\OverloadMethodAspect.aj:7
>         see also: D:\work\TestAspects\OverloadMethodTest.jar
> D:\work\TestAspects\OverloadMethodTest.java:5 error Ambiguous binding of
> type ja
> va.lang.String using args(..) at this line.  Use one args(..) per matched
> join p
> oint, see secondary source location for location of extraneous args(..)
> (no source information available)
> 
>         see also: D:\work\TestAspects\OverloadMethodAspect.aj:7
>         see also: D:\work\TestAspects\OverloadMethodTest.jar
> D:\work\TestAspects\OverloadMethodTest.java:7 error Ambiguous binding of
> type ja
> va.lang.String using args(..) at this line.  Use one args(..) per matched
> join p
> oint, see secondary source location for location of extraneous args(..)
> (no source information available)
> 
>         see also: D:\work\TestAspects\OverloadMethodAspect.aj:7
>         see also: D:\work\TestAspects\OverloadMethodTest.jar
> 
> 4 errors
> 
> Is there something wrong with the aspect I have defined? How do I get this
> to work using aspectJ 1.2.
> I have attached the source files.
> 
> Java Version - Sun jdk1.3.08
> AspectJ version - (AspectJ Compiler 1.2 built on Friday May 21, 2004 at
> 15:06:22 GMT)
> 
> Thanks
> Kamal
> 
>  <<OverloadMethodAspect.aj>>  <<OverloadMethodTest.java>> 

Attachment: OverloadMethodAspect.aj
Description: Binary data

Attachment: OverloadMethodTest.java
Description: Binary data


Back to the top