Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting errors on incorrect lines in Eclipse? What can I do about it?

My script works seemed to be working perfectly well, but Eclipse 3.7.2 was telling me I had multiple errors on a random set of empty lines:

Screenshot of Eclipse's spurious error markers

When I deleted the lines, all the errors bunched up into one lump, like this:

All the errors bunched into one line

Here's the list it was giving me:

enter image description here


EDIT

It turns out I did have an error in my code - I was using = to check for equality in an if statement. When I corrected this, ALL of the errors disappeared.

Why did that mistake cause the effects above?

like image 694
Jasper Mogg Avatar asked Dec 11 '25 20:12

Jasper Mogg


1 Answers

This appears to be eclipse getting out of sync. I would do a clean and/or a refresh. In Eclipse sometimes things get cached. Sometimes I have to restart eclipse with the -clean option and everything clears up.

Since the script is working, that is what I'd try first.

Again, I know there are settings in eclipse that you can change for errors, but I don't believe any settings changes will show or hide errors on blank lines. At least that I'm aware of.

I assume that while you were working on the script there was originally no errors, but at some point during that process or when you completed it and saved it, then the errors showed up, correct? Did you try a full reboot?

It looks like eclipse is caching an old version of the file. To find out and stop guessing, use Firefox with firebug.

Steps:

  1. Go to the net tab and ensure the script is loaded,
  2. then look at the code in the script tab (be sure to select yours) to ensure it's what you are seeing in eclipse. If the loaded code is identical to your code, then you still have the problem and go to 3. otherwise, you know the issue is it's not loading the script properly.
  3. Show us the script code.
  4. Look in the console, if there is a javascript error in the script, it will show up there.

I've had this throw me more than once, thinking a script was loaded when it was an older version of it and didn't load the newest. I've also had eclipse cache older versions of server side code and not refresh changes.

Here are some screenshots of firebug tabs during debugging:

Firebug Net tab loaded scripts example

Firebug Console tab with simple error example

like image 55
James Drinkard Avatar answered Dec 14 '25 10:12

James Drinkard