Bug 166514 - NPE when saving class that doesn't implement interface methods
Summary: NPE when saving class that doesn't implement interface methods
Status: RESOLVED DUPLICATE of bug 242797
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.6.2   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 162601 166517 176737 184523 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-12-01 11:53 EST by Felix Mayer CLA
Modified: 2008-08-26 23:04 EDT (History)
5 users (show)

See Also:


Attachments
ajcore dump (25.66 KB, text/plain)
2008-03-26 11:26 EDT, Ludger Solbach CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Mayer CLA 2006-12-01 11:53:17 EST
Build ID: M20060921-0945

Steps To Reproduce:

1. Install the latest AJDT 1.4.1 for Eclipse 3.2.1

2. Create a new class like this:
import java.util.Map;

public class DelegatingMap<K, V> implements Map<K, V> {

    protected final Map<K, V> delegate;

    public DelegatingMap(Map<K, V> delegate) {
        super();
        this.delegate = delegate;
    }

}

3. Save it and get an Internal compiler error:
java.lang.NullPointerException
at org.aspectj.ajdt.internal.compiler.problem.AjProblemReporter.abstractMethodMustBeImplemented(AjProblemReporter.java:231)
at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodVerifier.checkAbstractMethod(MethodVerifier.java:96)
at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodVerifier.checkMethods(MethodVerifier.java:269)
at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Method ... pter.java:102)
at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)


More information:
Comment 1 Steve Young CLA 2006-12-06 12:30:23 EST
Build ID: M20060921-0945
AJDT Version: 1.4.1.200611230655
AspectJ version: 1.5.3.200611221118

I get 12 problems, all errors, all of the type:

"The type DelegatingMap<K,V> must implement the inherited abstract method Map<K,V>.clear()"

I don't get any NPE.
Comment 2 Helen Beeken CLA 2006-12-07 06:24:12 EST
*** Bug 166517 has been marked as a duplicate of this bug. ***
Comment 3 Helen Beeken CLA 2006-12-07 06:25:23 EST
Reassigning to aspectj...
Comment 4 Helen Beeken CLA 2006-12-07 06:30:01 EST
This could also be a dup of bug 162601 (they display the same stack trace)

Felix - were you using the same project when you raised 162601?
Comment 5 Felix Mayer CLA 2006-12-07 10:06:11 EST
I have been able to reproduce the issue in a new Java project in Eclipse, that I then converted into an AspectJ project. Creating the above class proved to be only the last step, I had to create a working aspect as well. Below are the additional types I created. The DelegatingMap should be created after all the other types are in place. Saving it will produce the exception.

package test;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Documented
@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface Relationship {
    
}

************************************************************************

package test;

import java.util.HashSet;
import java.util.Set;

public class PersistentDomainObject {
    
    @Relationship
    private Set<PersistentDomainObject> objects = new HashSet<PersistentDomainObject>();

    /**
     * @return the objects
     */
    public Set<PersistentDomainObject> getObjects() {
        return objects;
    }

    /**
     * @param objects the objects to set
     */
    public void setObjects(Set<PersistentDomainObject> objects) {
        this.objects = objects;
    }

}

**********************************************************************

package test;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

@Aspect
public class RelationshipAspect {

    /**
     * 
     */
    public RelationshipAspect() {
        super();
    }
    
    @Around("get(@test.Relationship * test.PersistentDomainObject+.*)")
    public Object aroundGet(ProceedingJoinPoint thisJoinPoint) throws Throwable {
        Object result = thisJoinPoint.proceed();
        return result;
    }
    
    @Around("set(@test.Relationship test.PersistentDomainObject+ test..*.*)")
    public Object aroundSet(ProceedingJoinPoint thisJoinPoint) throws Throwable {
        Object result = thisJoinPoint.proceed();
        return result;
    }

}
Comment 6 Felix Mayer CLA 2006-12-07 10:10:34 EST
You can probably mark bug# 162601 as a duplicate of this one. The stack trace is the same, but I was never able to reproduce it reliably.
Comment 7 Helen Beeken CLA 2006-12-07 10:19:47 EST
*** Bug 162601 has been marked as a duplicate of this bug. ***
Comment 8 Helen Beeken CLA 2006-12-07 10:21:23 EST
Marking the product as aspectj since this bug relates to the compiler and is just been seen when the compiler is invoked via ajdt.
Comment 9 Andrew Clement CLA 2007-10-26 04:11:39 EDT
check if this is a core AJ bug or a bug because of the eclipse compiler version we are based on. if it is the latter we will fix it in 1.6 when we move to the new compiler.
Comment 10 Andrew Clement CLA 2007-10-26 06:48:25 EDT
*** Bug 176737 has been marked as a duplicate of this bug. ***
Comment 11 Andrew Clement CLA 2007-10-26 07:11:39 EDT
*** Bug 184523 has been marked as a duplicate of this bug. ***
Comment 12 Andrew Clement CLA 2008-03-14 15:22:02 EDT
I've just spent some time trying to recreate this but it won't fail for me - we have possibly fixed it 'by accident' between when it was last seen and now...
Comment 13 Ludger Solbach CLA 2008-03-26 11:26:55 EDT
Created attachment 93616 [details]
ajcore dump

Hi Andy,

sorry, have to disappoint you there. I'm still getting this error with 1.5.4 final when compiling with iajc. I don't get it from AJDT though...

Hope this helps...

Ludger
Comment 14 Ludger Solbach CLA 2008-03-26 11:50:59 EDT
After putting InfrastructureAspects.jar on the aspectpath (it was only on the classpath before), the problem went away.
But the compiler should react a bit more graceful than throwing an exception here. How about "Missing types on aspect path" or something like that?
Comment 15 Andrew Clement CLA 2008-04-01 01:12:21 EDT
With the info you gave me in your last comment, I've been able to address this.  It won't NPE now and should complain about a missing type instead.
Comment 16 Andrew Clement CLA 2008-08-26 23:04:18 EDT
i'm now persuing further variants of "abstract method must be implemented' under bug 242797.  I've fixed another 5 or 6 cases under that bug already (available in 1.6.2 aspectj dev builds), so I'm closing this one as a dup of that where I'll continue to persue any more that arise.

*** This bug has been marked as a duplicate of bug 242797 ***