Bug 50776 - fail in compiling aspect with overriding method introduction with different throws clause
Summary: fail in compiling aspect with overriding method introduction with different t...
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.0   Edit
Hardware: PC Linux
: P3 blocker (vote)
Target Milestone: 1.2   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-28 12:21 EST by mariano CLA
Modified: 2004-03-19 09:44 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mariano CLA 2004-01-28 12:21:31 EST
A first class (class A) declares only one method with some exceptions in the
throws clause ( void m() throws Exception ).
A second class (class B) extends it without redefinig the method. 
An aspect declares a method introduction in the class B, with the same name,
signature and return type of the one in class A, but without throws clause; this
is a legal override.
In the second class (class B) each invocation to the overriden method doesn't
need a try-catch block, because it refers to his hown method that raises no
exception.
This code compiles using 
ajc version 1.0.6 (built Jul 24, 2002 6:21 PM PST) running on java 1.4.0
But not using
AspectJ Compiler 1.1.1 
AspectJ Compiler 1.1.0

class A{
  public A(){}
  public void m() throws Exception{}
}

class B extends A{
  public B(){}
  public void some_code(){
    m();}
}

aspect C{
  public void B.m(){}
}
Comment 1 Jim Hugunin CLA 2004-03-04 16:54:13 EST
Assigning to Andy, but including a tip.

This is probably a bug in InterTypeMemberFinder.getExactMethod.  If you look 
at the corresponding getMethods method that one checks to see if there are any 
intertype methods declared and if so adds them to the base set that comes from 
the pure jdt logic.  For this method, instead it assumes that if the base 
method returned from the jdt code is valid then there's no reason to check for 
any intertype declarations.  Set a break point here and run the given test to 
see if this is the right diagnosis.
Comment 2 Andrew Clement CLA 2004-03-05 05:54:30 EST
Jim was write (as usual!) - when getExactMethod() found a method existing on 
the type, it did not check for intertype declarations that may be overriding 
it.  Basically, it did not allow for the case where the method was inherited 
from a supertype and overridden via an ITD.  Fix checked in.
Comment 3 Adrian Colyer CLA 2004-03-19 09:43:52 EST
updating target flag to indicate inclusion in 1.2 release.
Comment 4 Adrian Colyer CLA 2004-03-19 09:44:49 EST
I really am updating the target flag this time...