Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AJDT throws NullPointerException after adding cflow.

Raised and fixed as https://bugs.eclipse.org/bugs/show_bug.cgi?id=314766

Please raise bugs for NPEs, they should never occur and indicate a real issue.

Next refresh of AspectJ into AJDT (which will make this fix available
in AJDT) should happen in the next couple of days.

Andy

On 27 May 2010 09:08, Benyi Wang <bewang.tech@xxxxxxxxx> wrote:
> If I add cflow(validate()) into @AfterReturning, AJDT throws NPE. I list the
> class and message here. The maven project is also attached.
> My environment:
> Eclipse 3.5 buildid: 20100218-1602
> AJDT 2.0.2.e35x-20100105-0900
> package org.foo;
> import org.aspectj.lang.annotation.AfterReturning;
> import org.aspectj.lang.annotation.Aspect;
> import org.aspectj.lang.annotation.Pointcut;
> @Aspect
> public class CflowAspect {
> @Pointcut("execution(boolean *..CflowExample.validateParameter(..))")
> public void validate() {
> }
> @AfterReturning(pointcut = "call(boolean *..Properties.containsKey(Object))
> && args(key) && cflow(validate())", returning = "existed")
> public void afterCheckExistence(String key, boolean existed) {
> System.out.println(key + " " + (existed ? "exists" : "doesn't exists"));
> }
> }
> package org.foo;
> import java.util.Properties;
> public class CflowExample {
> private boolean validateParameter(Properties config, String key) {
> return config.containsKey(key);
> }
> public static void main(String[] args) {
> Properties props = new Properties();
> props.put("ABC", "data");
> CflowExample example = new CflowExample();
> example.validateParameter(props, "ABC");
> example.validateParameter(props, "DEF");
> }
> }
> java.lang.NullPointerException
> at org.aspectj.weaver.bcel.BcelWorld.isAspectIncluded(BcelWorld.java:942)
> at org.aspectj.weaver.ShadowMunger.match(ShadowMunger.java:80)
> at org.aspectj.weaver.Advice.match(Advice.java:106)
> at org.aspectj.weaver.bcel.BcelAdvice.match(BcelAdvice.java:149)
> at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:3108)
> at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2562)
> a ... Z
>                     POP
>                     RETURN   (line 18)
>   end public static void main(String[])
> end public class org.foo.CflowExample
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top