Bug 177762

Summary: [generics] UnresolvedType.forSignature throws BCException when using generics
Product: [Tools] AspectJ Reporter: Bartek Zdanowski <b.zdanowski>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P2 CC: aclement, b.zdanowski
Version: unspecified   
Target Milestone: 1.6.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Original class
none
Aspect file in state when Exception was thrown none

Description Bartek Zdanowski CLA 2007-03-16 10:45:37 EDT
While in Eclipse, the editted aspect file was:
-----
package pl.autoguard.ac2.ws.types;

public privileged aspect ContactPersonAspect {

    private java.util.Set<pl.autoguard.ac2.ws.types.Object> ContactPerson.objectsSet;

    public java.util.Set ContactPerson.getObjectsSet(){
        System.out.println("ASPECT!!! ContactPerson.getObjectsSet ");
        return this.objectsSet;
    }

    public void ContactPerson.setObjectsSet(java.util.Set<pl.autoguard.ac2.ws.types.Object> objectsSet){
        System.out.println("ASPECT dodana metoda ContactPerson.setObjectsSet  WITH SET");
        this.objectsSet = objectsSet;
    }

/****************************************************************************/

    /** Client **/
    pointcut setClient(Client client):
        execution(void ContactPerson.setClient(Client));



    pointcut arraySet():
        execution(public void ContactPerson.set*(pl.autoguard.ac2.ws.types.*[]));

    void around(): arraySet() && args(..){
        System.out.println("ASPECT around " + thisJoinPoint.toShortString());

        proceed();
    }

    after(Client client, ContactPerson contactPerson): setClient(client)
        && args(client) && target(contactPerson){
        contactPerson.clientId = client.getClientId();
    }


}
-----

There's a syntax error due to a programmer mistake, in pointcut

    pointcut setClient(Client client):
        execution(void ContactPerson.setClient(Client));

but while writing "Client client" exception was thrown.

org.aspectj.weaver.BCException
at org.aspectj.weaver.UnresolvedType.forSignature(UnresolvedType.java:447)
at org.aspectj.weaver.MemberImpl.signatureToTypes(MemberImpl.java:204)
at org.aspectj.weaver.MemberImpl.<init>(MemberImpl.java:61)
at org.aspectj.weaver.ResolvedMemberImpl.<init>(ResolvedMemberImpl.java:108)
at org.aspectj.weaver.AjcMemberMaker.privilegedAccessMethodForFieldGet(AjcMemberMaker.java:360)
at org.aspectj.ajdt.internal. ... .aj
when incrementally building BuildConfig[C:\Java\workspace\.metadata\.plugins\org.eclipse.ajdt.core\AC2 Java Client Core.generated.lst] #Files=326
Comment 1 Bartek Zdanowski CLA 2007-03-16 10:48:26 EDT
Created attachment 61102 [details]
Original class

Class which aspect applies to
Comment 2 Bartek Zdanowski CLA 2007-03-16 10:49:12 EDT
Created attachment 61103 [details]
Aspect file in state when Exception was thrown
Comment 3 Matt Chapman CLA 2007-05-02 06:13:00 EDT
Passing over to compiler
Comment 4 Andrew Clement CLA 2007-10-26 06:57:23 EDT
work into testcase for 1.5.4 and investigate.
Comment 5 Andrew Clement CLA 2008-06-10 16:36:22 EDT
i tried a quick recreate but can't get it to fail - given the age of the bug (sorry it took me so long to get round to it...) and that the weaver has been largely refactored in the failing area for 1.6.1, I'm not sure it can still fail.  The BCException does now include the signature that was causing problems so should it happen again the signature will be included in the stack trace.  In fact I half suspect it may be related to the problem of our internal 'P' prefixed signatures leaking out into the .class files - as the forSignature() method that is failing does not cope with 'P' prefixes (and it should not, they shouldn't get passed into here..).  So I wouldn't be surprised if the change to fix the problem of leaking P sigs also addressed this situation here.  feel free to reopen if anything like this happens again.