Bug 40534 - Declare warning/error output - more detail required.
Summary: Declare warning/error output - more detail required.
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.0   Edit
Hardware: All Windows XP
: P2 enhancement (vote)
Target Milestone: 1.1.1   Edit
Assignee: Mik Kersten CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-20 12:16 EDT by George Harley CLA
Modified: 2003-08-28 06:41 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 George Harley CLA 2003-07-20 12:16:58 EDT
At present the declare warning and declare error functionality of the compiler 
provides no detailed information about what it is in the user code that has led 
to the generation of the compile-time warning or error. 

Consider the following test case...

public class A
{
  public static void main(String[] args)
  {
    A a = new A();
    a.doSomething();
    System.out.println("All done");
  }

  void doSomething()
  {
    System.out.println("Doing something");
  }
} // end of class A


public aspect MyAspect
{
  pointcut noDoing() :
    call(* *.doSomething(..));

  declare warning : noDoing() :
    "Don't do it!";
} 

When I compile these two files I get the following warning ...

c:\src\A.java:16 Don't do it!

..which is great if all I want to know is where the offending code is. But not 
nearly enough if I want to know what it is on the line that is contravening the 
policy (or policies) that I have specified in my aspect. In the above example it 
would be even more useful if the warning message was something like ...

c:\src\A.java:16 Don't do it! : calling method : void A.doSomething()

For large projects where there is an architectural imperative to reduce or 
completely remove coupling between certain components declare warning/error 
would be of far greater use if it could return more detailed info to say *why* 
not just *where* the desired enforcement rules have been broken.
Comment 1 Wes Isberg CLA 2003-08-04 05:37:48 EDT
Is this different from 31724?  It seems to be part of the residual issue keeping
that bug open.  (The issue is more general: *any* warning or error (not just
declare warning/error) generated during weaving rather than during the compiler
pass will produce a message without source context.)  I actually prefer this bug
priority, so if Mik has a fix perhaps 31724 should be closed with a note saying
this bug is to deal with the remaining issue.  If that bug is closed, any
context-related failing test cases should be associated instead with this bug
(and/or more tests written...).  But since we originally thought this was an
issue that Jim/Erik would have to think together about since the source context
info is not available to the weaver, perhaps this should be closed as a
duplicate of 31724.  
Comment 2 Mik Kersten CLA 2003-08-07 11:20:38 EDT
Fixed in 1.1.1
Comment 3 Adrian Colyer CLA 2003-08-28 06:41:58 EDT
updated target milestone field to 1.1.1