Bug 90143 - [itds] Problem with an ITD on an interface
Summary: [itds] Problem with an ITD on an interface
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-04 06:46 EDT by Sian January CLA
Modified: 2005-11-05 05:38 EST (History)
0 users

See Also:


Attachments
Test project (2.73 KB, application/x-zip-compressed)
2005-04-04 06:47 EDT, Sian January CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sian January CLA 2005-04-04 06:46:08 EDT
If an ITD method is declared on an interface with an anonymous inner class 
returned as the result, the compiler generates an error for any "super.xxx" 
calls in the anonymous inner class.  The example project shows this with a 
nested inner interface, but the same problem occurs with an ITD of this kind 
on any interface.  The error does not occur if the ITD is declared on an inner 
class (as shown in the example) or a normal class.
Comment 1 Sian January CLA 2005-04-04 06:47:08 EDT
Created attachment 19507 [details]
Test project

Test case attached
Comment 2 Andrew Clement CLA 2005-04-04 08:16:30 EDT
take a look for M3
Comment 3 Andrew Clement CLA 2005-09-30 05:42:57 EDT
Collapsed into one test program: 

class MyClass {
  protected Object method() {
    return null;
  }
}

abstract aspect A {

  interface C2 { }

  public void C2.hello() {
    new MyClass() {
      protected Object methodX() {
        return super.method();
      }
    };
  }

  // ok
  class C { }
  public void C.hello() {
    new MyClass() {
      protected Object methodX() {
        return super.method();
      }
    };
  }


}
Comment 4 Andrew Clement CLA 2005-10-03 04:06:47 EDT
putting on my todo list, testcase added to CVS.
Comment 5 Andrew Clement CLA 2005-11-04 11:26:33 EST
When we fail, at the top of MessageSend.resolveType(BlockScope) we attempt
receiverType.resolveType() and the receiverType is an InterSuperReference.  When
we succeed it is simply a normal SuperReference.

When the ITD is on an interface we run a 'InterSuperFixerVisitor' over the body
of the ITD.  (see InterTypeDeclaration.fixSuperCallsForInterfaceContext). 
Unfortunately it doesn't seem to realise when we've moved into an inner
anonymous class (blurgh).  I modified the visitor to keep a stack counter when
it goes into local types - if its >0 we don't mess with the super calls.

fix checked in, waiting on build.
Comment 6 Andrew Clement CLA 2005-11-05 05:38:28 EST
fix available.