Take the 2-minute tour ×

I've downloaded an open-source Java project, JMapViewer.


After importing it into Eclipse, there are numerous compiler errors, all regarding @Override notations preceding methods which are being implemented from an interface. I completely understand this error, since I would only use the @Override notation for a method which overrides a superclass method (an extension, not an implementation), which I believe is the only intended usage (and even then I don't think it's required).

This project has not been maintained for 4 months, but it does have a long history of revisions and community contributions. I cannot figure out why those @Override annotations are there if they prevent it from compiling, but in my inexperience I have to consider that those who put them there, the previous project contributors, had some good reason that is not clear to me. The project documentation says it was intended for usage with JDK 1.5, so I've tried compiling it under 1.5, 1.6, and 1.7 alternately in Eclipse, and in each case the result is the same... the compiler is very unhappy with those notations being where they are.

So... what am I missing?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

The documentation you've seen is correct. @override should be accepted on methods that implement an interface method, by the compiler since JDK 1.6

Try compiling from the command line to make sure it's not eclipse still using the 1.5 compiler.

share|improve this answer
Hmm, I'm fairly new to Eclipse, but I just found the problem. In project properties, JDK Compliance was set to 1.5. Increasing to 1.6 or 1.7 does the trick. But I wonder how that value got set automatically to 1.5? I imported the source archive using a SVN plugin for Eclipse (also very new to SVN). I'm guessing somewhere in some file in the archive, a tag caused that 1.5 property to be chosen. Perhaps in the build.xml where the <javac> tag has attributes source and target equal to 1.5. But, I wonder why this project is continually checked into SVN with that value unchanged. –  The111 Dec 15 '12 at 8:46
It's been a while since I've used eclipse, so I'm afraid I can't help you there. –  bowmore Dec 15 '12 at 8:55
1.5 is the Eclipse default. But it looks like they checked in their Eclipse settings (a bad idea IMHO), set to 1.5: svn.openstreetmap.org/applications/viewer/jmapviewer/.settings/… –  artbristol Dec 15 '12 at 9:58
add comment

It depends whether you are using Java 5 or Java 6. @Override for interface overridden methods was only added in Java 6.

share|improve this answer
add comment

Your Answer


