Community
Participate
Working Groups
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(){} }
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.
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.
updating target flag to indicate inclusion in 1.2 release.
I really am updating the target flag this time...