Project: AspectJ
Bug 161217 NPE in BcelAdvice
Reported: 2006-10-17 08:19:24 | Status: resolved fixed

I've been playing with some aspect deployment models and got into this error during project rebuild from AJDT: java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelAdvice.implementOn(BcelAdvice.java:199) at org.aspectj.weaver.Shadow.implementMungers(Shadow.java:699) at org.aspectj.weaver.Shadow.implement(Shadow.java:471) at org.aspectj.weaver.bcel.BcelClassWeaver.implement(BcelClassWeaver.java:2832) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:506) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeave ... lasses when weaving when batch building BuildConfig[...] #Files=6 Here is the aspect and classes it is applied to: ----- @Aspect("percflow(execution(* InstrumentedBean.getProperty2()))") public class GetFieldAtAspect { @Around("execution(* ConfigurableBean.getProperty2())") public Object onGet(ProceedingJoinPoint jp) throws Throwable { return jp.proceed(); } } ------ import org.springframework.beans.factory.InitializingBean; public class InstrumentedBean implements InitializingBean, IInstrumentedBean { private ConfigurableBean configurableBean; private String value; private transient String transientValue = "aaa"; public void afterPropertiesSet() throws Exception { this.configurableBean = new ConfigurableBean(); } public String getProperty1() { synchronized(this) { return this.configurableBean.getProperty1(); } } public String getProperty2() { synchronized(this) { return this.configurableBean.getProperty2(); } } public void setValue(String value) { synchronized(this) { this.value = value; } } public Object getValue() { synchronized(this) { return value; } } public Object getTransientValue() { return transientValue; } public void setTransientValue(String transientValue) { this.transientValue = transientValue; } } ------ import java.io.Serializable; import org.springframework.beans.factory.annotation.Configurable; @Configurable public class ConfigurableBean implements Serializable { private static final long serialVersionUID = 1L; private String property1; private String property2; public ConfigurableBean() { } public String getProperty1() { return this.property1; } public String getProperty2() { return this.property2; } public void setProperty1(String property1) { this.property1 = property1; } public void setProperty2(String property2) { this.property2 = property2; } }

Files changed in fix:
tests/bugs153/pr161217/AtAspectJAspect.java tests/bugs153/pr161217/C.java tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java