Bug 72531

Summary: declare warning warns at wrong points
Product: [Tools] AspectJ Reporter: Rohith Ajjampur <ajjampur>
Component: CompilerAssignee: Adrian Colyer <adrian.colyer>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.2   
Target Milestone: 1.2.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Contains all the classes to reproduce this bug none

Description Rohith Ajjampur CLA 2004-08-24 14:42:12 EDT
I have a "declare warning" declaration that warns on usage of any method that
returns an array of any POJO type, this should point to the methods that in
reality return an array, but i see warnings at points other than these array
returning methods, and also those that have void in their signature. In the
attached files i get a warning at statements like:

>        PrinterWorld p = new PrinterWorld();[in main()method]
>        System.out.println("Hello World!"); 
>    	 return new Integer(3);

and these being the first/only lines in their respective methods.
Comment 1 Rohith Ajjampur CLA 2004-08-24 14:42:44 EDT
Created attachment 14156 [details]
Contains all the classes to reproduce this bug
Comment 2 Adrian Colyer CLA 2004-08-24 15:46:16 EDT
With the fix for bug 37020, the declare warning statements at least now report 
the correct lines (the previous behaviour was to report the line number of the 
first bytecodes in the body of the method), giving the output below:

C:\temp\de\rohith\HelloWorld.java:4 [warning] *[] returning method called
public static void main(String[] args) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        method-execution(void de.rohith.HelloWorld.main(java.lang.String[]))
        see also: C:\temp\de\rohith\HelloWorldAspect.java:17
C:\temp\de\rohith\PrinterWorld.java:7 [warning] *[] returning method called
public void print() {
^^^^^^^^^^^^^^^^^^^^^
        method-execution(void de.rohith.PrinterWorld.print())
        see also: C:\temp\de\rohith\HelloWorldAspect.java:17
C:\temp\de\rohith\PrinterWorld.java:11 [warning] *[] returning method called
public Integer returnInt() {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        method-execution(java.lang.Integer de.rohith.PrinterWorld.returnInt())
        see also: C:\temp\de\rohith\HelloWorldAspect.java:17
C:\temp\de\rohith\PrinterWorld.java:15 [warning] *[] returning method called
public Integer[] returnArrayWithCloning() {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        method-execution(java.lang.Integer[] de.rohith.PrinterWorld.returnArrayW
ithCloning())
        see also: C:\temp\de\rohith\HelloWorldAspect.java:17
C:\temp\de\rohith\PrinterWorld.java:22 [warning] *[] returning method called
public Integer[] returnArrayWithoutCloning() {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        method-execution(java.lang.Integer[] de.rohith.PrinterWorld.returnArrayW
ithoutCloning())
        see also: C:\temp\de\rohith\HelloWorldAspect.java:17

5 warnings

There remains the issue that the pattern (*[]) seems to be matching any type, 
not any array type. I will look at this tomorrow.
Comment 3 Adrian Colyer CLA 2004-08-24 17:15:27 EDT
Fixed in tree. Will close bug report once this fix is available in a public 
build. The bug involved the processing of a "*" pattern when postfixed with one 
or more array dimensions. Type patterns other than "*[]" were unaffected by this 
bug.
Comment 4 Adrian Colyer CLA 2004-08-25 03:10:41 EDT
Fix now available from the AspectJ download page.
Comment 5 Adrian Colyer CLA 2004-10-21 04:32:34 EDT
Fix released as part of AspectJ 1.2.1