Bug 71059 - Support problems with multiple source locations.
Summary: Support problems with multiple source locations.
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: UI (show other bugs)
Version: 1.1.11   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Matt Chapman CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-29 05:21 EDT by Andrew Clement CLA
Modified: 2004-08-05 05:45 EDT (History)
1 user (show)

See Also:


Attachments
screenshot of prototype (10.60 KB, image/png)
2004-08-03 10:50 EDT, Matt Chapman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2004-07-29 05:21:33 EDT
Some messages from AspectJ have multiple source locations of interest.  For
example if you use args() twice in a pointcut, this is an error, and you get the
location where the pointcut matched as well as the location of the args()
declaration.  AJDT needs to support multiple locations.

Now, the default problems view only allows one error location. The options seem
to be:
- replace the problems view with our own.
- Dock a small secondary view next to the problems view, which for particular
error messages selected in the problems view will give you the other locations.
 Think of it as an 'extra info' for certain problems.

I quite like the second approach.

There is work required in AJDE to get the second location out of the compiler. 
I will do that bit once we decide what the UI side will look like.
Comment 1 Mik Kersten CLA 2004-07-29 11:36:20 EDT
I agree.  I'd suggested this on an earlier report, but had trouble finding it 
and am guessing that it was set to resolved once the compiler supported this 
(in the future I will link this stuffo on the UI design page).  In that report 
I noted that this is not just an AspectJ-specific issue, but related to any 
problems message that involves a relationship rather than a location (e.g. 
consider a "must implement" error message on a sub-type--you might need to go 
to the super type and add a parameter to the signature there). 

In general I think that adding a view should be avoided unless there is a big 
benefit.  I suggest this alternative:

1. Provide a context menu item, in addition to the existing "Go to" called "Go 
to additional location".  This is the least invasive, scales (since that menu 
could fan out) and is well-integrated with JDT behavior.

2. If we decide that this makes it too hidden, also add another column to the 
Problems list, showing the additional source location info.  I add my own 
columns in another plugin by sublassing ProblemView, but it could be done less 
invasively by manipulating the existing problems view.
Comment 2 Mik Kersten CLA 2004-07-29 13:06:00 EDT
I just realized that there is another JDT analogy that could work well for 
this: Quick Fix.  The UI is:

- A different error icon on the message, which indicates that it supports 
the "Quick Fix" action (with a lightbulb).

- The "Quick Fix" action is available anywhere that the marker shows up 
(gutter, problems list).

We could use the same UI, and use Markers to store the additional source 
information.  Note that we might need a subclass of error marker that 
understands the extra source location attributes and renders the 
different "Multiple source location" error/warning message icon.
Comment 3 Matt Chapman CLA 2004-07-30 10:14:36 EDT
For the record here is an example that results in an error with multiple
locations (thanks Andy):

public class Game {
    public static void main(String[] args) {
        if ( args.length == 0 )
            new Game("1").run();
        new Game(args[0]).run();
    }

    public Game(String mode) {}
    
    public void run() {}
}

public aspect Display {
	pointcut pc(String mode) : call(Game+.new(String)) && (args(mode) || args(mode));
	
	after(String mode) returning(Game game) : pc(mode) {
	}
}
Comment 4 Matt Chapman CLA 2004-08-03 10:50:02 EDT
Created attachment 13726 [details]
screenshot of prototype

The attachment shows my prototype in action. It is basically Mik's first
suggestion, of adding an entry to the context menu for the marker, with a
submenu for all of the additional locations. I propose we try that for now, and
if we need to do something more obvious later, we can consider adding another
view, or altering the problems view. I don't think using the quick fix entry is
quite right as we are not offering any form of fix. Let me know what you think.
Comment 5 Mik Kersten CLA 2004-08-03 12:29:41 EDT
Excellent.  Yes, I agree that it belongs in it's current context menu path and 
not in quick fix.  

This is already helpful to release as is.  The additional thing that would 
help is to make the errors with multiple source locations have a different 
icon.  However, I think that the best way of doing that for now is to have the 
declare error/warning icons have the same icon in the problems list that they 
have in the gutter.  That way users can expect this additional menu on those 
problems.

Note that I described this in the older bug 41708.  Note that this report also 
states that we need to navigate to multiple locations, which is resolved by 
Matt's latest prototype.
Comment 6 Matt Chapman CLA 2004-08-05 05:45:50 EDT
Okay, the code is in, so I'm marking this as resolved. Bug 41708 covers changes
to the declare warning/error icons in the problems view.