Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349861 - Getting source code positions for advice
Summary: Getting source code positions for advice
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.6.5   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-20 14:49 EDT by yoav CLA
Modified: 2011-06-21 16:20 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yoav CLA 2011-06-20 14:49:18 EDT
Build Identifier: 20110301-1815

Source code position is not available in BcelAdvice

Reproducible: Always

Steps to Reproduce:
I'm trying to extract source file information during the weaving process. I 
wrote the following code to fetch the beginning and end of an advice:

public String getAdviceFormatString(BcelAdvice adv)
{
     ISourceLocation pos = adv.getSourceLocation(); int startLine = 
pos.getLine();
     int endLine = pos.getEndLine(); // do the rest
}

I always get that startLine == endLine which correspond to the first line of 
the advice declaration.
Comment 1 Andrew Clement CLA 2011-06-21 15:42:25 EDT
Do you want to contribute a patch for this?  I would say take a look at where the sourcelocations are setup for advice and see if the information is just not being passed through.
Comment 2 yoav CLA 2011-06-21 15:46:44 EDT
If it's just some assignment missing I can try. Can you point me where to look? I'm not familiar with the front end code.
Comment 3 Andrew Clement CLA 2011-06-21 16:09:15 EDT
the more i think about it, the more I'm just not sure you'll get what you want - do you want the line with the last bit of code on or the line with the closing curly brace on?  When binary weaving without a preceeding compile, the position of the final closing } just cannot be determined, but the location of the final bit of code should be there (as it will be the last occuring entry in the line number table).  Perhaps the simplest thing to do here is just understand why you can't get what you want from the line number table.
Comment 4 yoav CLA 2011-06-21 16:20:54 EDT
I'm porting a code that was based on the ABC compiler which queries for this info. I'm not sure if it was used for anything useful though.  I will try for now to use the info from the line number table.