Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » @Override annotation on interface implementation with source level 1.5
@Override annotation on interface implementation with source level 1.5 [message #1138992] Tue, 15 October 2013 13:12 Go to next message
Csaba Koncz is currently offline Csaba KonczFriend
Messages: 49
Registered: July 2009
Member
Hi all,

My problem is the following: I need to work on a project that is managed by Maven and is being developed with an IDE other than Eclipse.
As a result there are Java classes that have @Override annotation on methods that implement interface methods.
With Java source level 1.5 (Maven default) this is not allowed, but seemingly it is not a problem for people/tools using javac to compile the sources.

With Eclipse I need to specify a Java compliance level of 1.6 in the project preferences. The drawback is that when I execute a "Maven->Update project" this setting is lost. Is there another way to get the JDT compiler behave like javac in this case?

Here is a sample class that I would like to compile with source level 1.5:
public class Test {
	interface A {
		void myMethod();
	}
	class B implements A {
		@Override
		public void myMethod() {
		}
	}
}


Best regards,
Csaba

Re: @Override annotation on interface implementation with source level 1.5 [message #1139101 is a reply to message #1138992] Tue, 15 October 2013 14:38 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Don't try to force JDT compiler into incorrect behavior, at compliance level 1.5 this @Override is an error and must be reported as such.
Rather try to tell Maven that this is a 1.6 project using standard Maven mechanisms.
Edit: From there also "Maven->Update project" should pick up this information and configure JDT for 1.6 accordingly.

[Updated on: Tue, 15 October 2013 14:39]

Report message to a moderator

Re: @Override annotation on interface implementation with source level 1.5 [message #1140341 is a reply to message #1139101] Wed, 16 October 2013 09:36 Go to previous message
Csaba Koncz is currently offline Csaba KonczFriend
Messages: 49
Registered: July 2009
Member
I do not want JDT to do something illegal, I would like to ask it not to be more strict as javac is (starting with version 1.6) in this case.

Unfortunately I can not change the Maven settings - and the others will not do it just because I am working with Eclipse.
Previous Topic:Tomee Deployment descriptor
Next Topic:Best UML Design and Code generator plugins
Goto Forum:
  


Current Time: Thu Mar 28 18:02:40 GMT 2024

Powered by FUDForum. Page generated in 0.03248 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top