Bug 209372 - Compile error: IllegalArgumentException thrown: negative line: -1
Summary: Compile error: IllegalArgumentException thrown: negative line: -1
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.6.1   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-09 14:27 EST by Jonathan Brown CLA
Modified: 2008-06-09 12:53 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 Jonathan Brown CLA 2007-11-09 14:27:51 EST
If line numbers have not been added to the generated class files the following exception is thrown:

java.lang.IllegalArgumentException
at org.aspectj.bridge.SourceLocation.validLine(SourceLocation.java:41)
at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:96)
at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:85)
at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:70)
at org.aspectj.ajdt.internal.core.builder.EclipseSourceContext.makeSourceLocation(EclipseSourceContext.java:57)
at org.aspectj.we ... reUtility.java:155)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Compile error: IllegalArgumentException thrown: negative line: -1



An easy way to reproduce the problem is to uncheck the corresponding checkbox in the Classfile Generation section of the Java Compiler options in Eclipse.  A full build is performed during which an AspectJ Internal Compiler Error is thrown.

My Eclipse feature version is org.eclipse.ajdt_1.5.0.200706070619.
Comment 1 Greg Hoffman CLA 2008-05-07 16:49:38 EDT
I have also run into the same exception. After cleaning the project eclipse would proceed to rebuild. Once the rebuild was complete it wouldn't throw the exception right away but, if you waited a good 30 seconds or so the window would pop up with this exception. I also noticed if I modified an aspect and rebuilt either automatically or by hand it would throw the exception while it was building, so it appears it is some sort of an issue not with the initial build but with any following builds. Has this issue been explored since the original bug was posted?

java.lang.IllegalArgumentException
at org.aspectj.bridge.SourceLocation.validLine(SourceLocation.java:41)
at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:96)
at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:85)
at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:70)
at org.aspectj.ajdt.internal.core.builder.EclipseAdapterUtils.makeMessage(EclipseAdapterUtils.java:136)
at org.aspectj.ajdt.inter ... oBuildJob.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Compile error: IllegalArgumentException thrown: negative line: -1

Version: 1.5.2.200804241330
AspectJ version: 1.6.0.20080423100000

Eclipse Platform
Version: 3.3.0
Build id: I20070621-1340
Comment 2 Andrew Clement CLA 2008-05-07 17:15:31 EDT
Doesn't happen for me - I tried turning off 'include line numbers' in the compiler options page and I have about 20 projects (some AspectJ/some Java) in my workspace, they all build just fine.

I believe it is failing for a special kind of message that it wants to put out (a message which includes multiple related source locations).  So I'll stick in a guard for now to cope with it and the likely effect is that when a message has supplementary source locations that it wants to tell you about, you won't see them because it can't find them, you'll just see the primary message.
Comment 3 Andrew Clement CLA 2008-06-09 12:53:46 EDT
guard is in now (latest builds of AJ and AJDT) - please reopen if still a problem as I never was able to recreate.