Thursday, October 27, 2011

Eclipse, svn, javac and the filesystem have made my day horrible

I've got a strange issue out there that I have not been able to solve. At work, we use svn for source control. As is usual, when I get into the office in the morning, I update from svn and then start my day. At some point, I do a build to make sure everything works before I check code in.

We use ant to build all our projects and run unit tests, do static code analysis etc. When I was doing that today, I noticed that ant barfed on a couple of symbol not found errors. I checked our hudson continuous integration server to see if the build was fine and it was. So, I tracked down the classes in Eclipse. They had been updated recently (though one change was a few days old). However, everything was fine there. The symbols that were not found on the command line did exist in the code. Nearly all my projects in eclipse have warnings, but none had errors. A compile issue is an error in eclipse and would have been flagged as such. 

I was a bit confused. So I did a clean in eclipse, a clean in ant and then rebuilt from ant. Again, same issue. Then I searched for all class files that with the class name to see if something was hanging about. I found 2 class files for that class. But that turned out to be normal. Eclipse creates one and ant creates the other. Incidentally, using the file command against the class file will give you some information on what version of java it was compiled against etc. But none of it was useful in solving my mystery. I used javap to decompile the class files and both of them have the signature for the method in question (its a simple String getter).

I was at a loss as to what to do next. I tried to change the end-of-line characters to Unix to see if that made a difference, but it didn't. I deleted the files, updated it from svn and still have the same problem.

I am at a real loss on what to do next. I have got 4 other people to look at me, and they are stumped as well. None of this code is mine. This code runs fine on the CI server. It runs fine on other machines. 

So, it must be something on my environment. I had made some changes to it recently. I turned off a bunch of Eclipse validation because it was driving me nuts (it took far too long to do things). I turned off file system indexing on Windows (apparently, it will make eclipse faster if you do so). I put my file system in the exclusion list for Sophos anti-virus (apparently, that too will make it faster by disabling the on-access scan anti-virus software does).

None of these things should cause javac to not see a method in a class, especially when the file contains it (I checked the files on the file system as well and they methods are indeed there).

So, if anyone has suggestions on what else to try, let me know. I am going to blow away the entire project where the methods are 'missing' and check it out from svn again as my next step. I don't know if that will make any difference. All I know is, I have had a rather frustrating day where I spent time chasing after bogus errors that stopped me from checking in my code.