Differences between JDK 1.5 1.6 override and jdkoverride
An error is reported for some projects during the update today.
After searching online, according to the online description, a batch of configuration changes will not work:
Http://bestchenwu.iteye.com/blog/997420 (method 2 in this, that is, the method I use later)
Http://blog.csdn.net/allenlinrui/article/details/5568817
Http://blog.sina.com.cn/s/blog_6419bc670100i6hc.html
Http://chen2337.blog.163.com/blog/static/34039920201041311718394/
Finally, I asked my colleague, he said he could modify the complier directly,
After 1.5 is changed to 1.6, it is okay to compile again. In Preferences, set Compiler for all projects. All project exceptions are solved:
To sum up the reasons:
The keyword override is in 1.5.It can only be used for class inheritance and cannot be used for interface implementation,It should be said that it is a 1.5 bug,If it is a class inheritance, the method can be added or not added before, and the JVM will be overwritten by default during compilation.(Added to Eclipse by default );But if it is the implementation of the interface, that is, only the method declaration, no method body, this annotation cannot be added before the method. Once this annotation is added, the compiler will report an error during compilation, as described in
However, this problem is fixed in 1.6, that is, it can be used for interface implementation or class inheritance. Therefore, in 1.6, when an interface is inherited or implementedBoth adding or not adding @ Override are considered as rewriting by default, and Eclipse will add
@ Override, as described in