Summary: | Improve error messages from compiler / weaver | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Adrian Colyer <adrian.colyer> |
Component: | Compiler | Assignee: | Adrian Colyer <adrian.colyer> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | ||
Version: | 1.2 | ||
Target Milestone: | 1.2 | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Adrian Colyer
2004-03-15 09:52:12 EST
Now giving source or binary context whenever we can, and printing warning or error in front of command-line messages where appropriate Samples of new message output: For compiling tests/errors/DeclareError.java: AspectJ 1.1.1 would output: C:\ColyerRoot\...\tests\errors\DeclareError.java:5 can only call bad from C AspectJ 1.2 outputs: C:\ColyerRoot\...\tests\errors\DeclareError.java:5 error can only call bad from C new C().bad(); ^^^^^^^^^^^^^^ see also: C:\ColyerRoot\...\tests\errors\DeclareError.java:25 (adds in source context information whenever it can). Here's how it looks when there is no source code available (i.e. we are passing binary source into the compiler). I took the contents of tests/errors/DeclareError.java and split each type into its own file, then compiled all but the aspect into cdd.jar. The resulting output is now the result of compiling A.java (the aspect) with -injars cdd.jar. AspectJ 1.1.1 would output: C:\ColyerRoot\...\org.aspectj.ajdt.core\D.java:6 can only call bad from C note that the file is reported as <working directory>\D.java. The D.java portion is the file name contained within D.class in cdd.jar. The prefix is appended by our message printer, even though in this case it is wrong (D.java was never in that directory). AspectJ 1.2 outputs: D.java:6 error can only call bad from C (no source information available) see also: C: \ColyerRoot\Data\AspectJDev\AspectJ_M6_Port\tests\errors\amctemp\A.java:5 see also: C: \ColyerRoot\Data\AspectJDev\AspectJ_M6_Port\tests\errors\amctemp\cdd.jar This informs the user that the error was found in binary source (no source information available), and adds a see also: line for the location of the binary source (in this case cdd.jar). The prefix is added to D.java only if file. exists(). Note that an alternate design would be to not include the "see also" for the jar, but instead output something like this: C:\ColyerRoot\Data\AspectJDev\AspectJ_M6_Port\tests\errors\amctemp\cdd.jar (D. java:6) error can only call bad from C (no source information available) see also: C: \ColyerRoot\Data\AspectJDev\AspectJ_M6_Port\tests\errors\amctemp\A.java:5 I didn't do this because (a) for classes in packages the first line will probably get too long, and (b) it means that the filename in the source location is not a valid filename, and clients of the API might reasonably expect it to be so. |