Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350800 - NPE when using Annotations, Generics and Abstract Pointcut
Summary: NPE when using Annotations, Generics and Abstract Pointcut
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 1.6.12   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-30 07:35 EDT by Andre Rocha CLA
Modified: 2011-06-30 13:31 EDT (History)
1 user (show)

See Also:


Attachments
AbstractAdapter.java (169 bytes, application/octet-stream)
2011-06-30 07:37 EDT, Andre Rocha CLA
no flags Details
Adapter.java (172 bytes, application/octet-stream)
2011-06-30 07:38 EDT, Andre Rocha CLA
no flags Details
AbstractProbingAspect.java (645 bytes, application/octet-stream)
2011-06-30 07:38 EDT, Andre Rocha CLA
no flags Details
ProbingAspect.java (446 bytes, application/octet-stream)
2011-06-30 07:39 EDT, Andre Rocha CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Rocha CLA 2011-06-30 07:35:18 EDT
Build Identifier: 20110615-0604

java.lang.NullPointerException
at org.aspectj.weaver.ResolvedPointcutDefinition.parameterizedWith(ResolvedPointcutDefinition.java:121)
at org.aspectj.weaver.ReferenceType.getDeclaredPointcuts(ReferenceType.java:797)
at org.aspectj.weaver.ResolvedType.getExposedPointcuts(ResolvedType.java:2323)
at org.aspectj.weaver.ResolvedType.getExposedPointcuts(ResolvedType.java:2316)
at org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceType.che ... oBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Compile error: NullPointerException thrown: null

Reproducible: Always

Steps to Reproduce:
The code below fails during compilation:


package test.aop;

import java.io.Serializable;
public abstract class AbstractAdapter<T extends Serializable> {
   protected abstract T execute(T message);
}

package test.aop;

public class Adapter extends AbstractAdapter<String> {
   @Override
   public String execute(String message) {
      return message;
   }
}

package test.aop;

import java.io.Serializable;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
public abstract class AbstractProbingAspect<T extends Serializable> {
   @Pointcut("")
   protected abstract void adapterMethodExecution();
   
   @Around("adapterMethodExecution()")
   public T around(ProceedingJoinPoint thisJoinPoint) throws Throwable {
      return (T) thisJoinPoint.proceed();      
   }   
   
   protected abstract String extractFunctionName(T command);
}
Comment 1 Andre Rocha CLA 2011-06-30 07:37:29 EDT
Created attachment 198894 [details]
AbstractAdapter.java
Comment 2 Andre Rocha CLA 2011-06-30 07:38:15 EDT
Created attachment 198895 [details]
Adapter.java
Comment 3 Andre Rocha CLA 2011-06-30 07:38:48 EDT
Created attachment 198896 [details]
AbstractProbingAspect.java
Comment 4 Andre Rocha CLA 2011-06-30 07:39:21 EDT
Created attachment 198897 [details]
ProbingAspect.java
Comment 5 Andrew Clement CLA 2011-06-30 13:31:57 EDT
Fixed.  The problem was that annotation style was not handling an empty pointcut quite right, but this wouldn't trip anything up until it was used in a generic aspect.  3 testcases added based on the attached code. (1) the code as it is (2) the code style version of it (3) the annotation style but extended to actually run and check the matching