Bug 108050 - Execution not matching override in doubly derived method
Summary: Execution not matching override in doubly derived method
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M3   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-25 16:22 EDT by Ron Bodkin CLA
Modified: 2005-08-26 07:50 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2005-08-25 16:22:28 EDT
The following sample code fails because the compiler isn't matching the
execution of doPost in MockServlet4. The declare warning for "servlet request"
doesn't match  in that case, nor does advice on the join point actually run at
runtime (though this simplified code only shows the problem with declare
warning). This was working until fairly recently (certainly in M2, even in AJDT
from August 11).

public abstract class MockServlet extends HttpServlet {
    
    protected void doPost() {
    }

    private static aspect FindMatches {
        declare warning: execution(* HttpServlet.do*(..)): "servlet request";
        declare warning: execution(* HttpServlet+.do*(..)): "servlet request2";    	
    }
}

class HttpServlet {
    protected void doPost() {
    }    
}

public class MockDelayingServlet extends MockServlet {
    private static final long serialVersionUID = 1; 
}

public class MockServlet4 extends MockDelayingServlet 
{
    protected void doPost()
    {
    } 
}

compiler output (should have 6 warnings, including two for MockServlet4):

C:\devel\workspace\test\src\MockServlet.java:16 [warning] servlet request
protected void doPost() {
^^^^^^^^^^^^^^^^^^^^^^^^^
        method-execution(void MockServlet.doPost())
        see also: C:\devel\workspace\test\src\MockServlet.java:20::0
C:\devel\workspace\test\src\MockServlet.java:16 [warning] servlet request2
protected void doPost() {
^^^^^^^^^^^^^^^^^^^^^^^^^
        method-execution(void MockServlet.doPost())
        see also: C:\devel\workspace\test\src\MockServlet.java:21::0
C:\devel\workspace\test\src\MockServlet.java:26 [warning] servlet request
protected void doPost() {
^^^^^^^^^^^^^^^^^^^^^^^^^
        method-execution(void HttpServlet.doPost())
        see also: C:\devel\workspace\test\src\MockServlet.java:20::0
C:\devel\workspace\test\src\MockServlet.java:26 [warning] servlet request2
protected void doPost() {
^^^^^^^^^^^^^^^^^^^^^^^^^
        method-execution(void HttpServlet.doPost())
        see also: C:\devel\workspace\test\src\MockServlet.java:21::0
C:\devel\workspace\test\src\MockServlet4.java:9 [warning] servlet request2
protected void doPost()
^^^^^^^^^^^^^^^^^^^^^^^
        method-execution(void MockServlet4.doPost())
        see also: C:\devel\workspace\test\src\MockServlet.java:21::0

5 warnings
Comment 1 Adrian Colyer CLA 2005-08-26 07:50:57 EDT
bloody hell!  (excuse my language)

over 2300 tests in the suite now (any many of those make multiple discrete
assertions) - up by 1,100 from AspectJ 1.2.1, and not one of them caught this bug. 

It's fixed now in the tree, and serious enough to warrant 1.5.0 M3a
Thanks for the quick catch and the easy to reproduce bug report.