Spot on. m2eclipse will select JDK5 for the project if the source and target levels in maven are configured for 1.5, which they are for jbehave. However, if you're running maven with JDK6, it will allow the use of @override on interface method implementations, even if you have source and target configured as 1.5. @override isn't retained after compilation anyway, to give the compiler information, so it makes sense.
And even though JBehave is configured for 1.5 source and target in the pom.xml, the hudson plugin requires JDK6 to build correctly. The configuration needs to be updated to reflect this. Also, unless it's changed recently, one of the classes uses String#isEmpty() as well, which was added in JDK6. You can fix this in eclipse by changing the source and target to 1.6 and then updating the maven configuration. Dan. On 29 January 2011 21:30, Brian Repko <[email protected]>wrote: > > In Java5, @Override can not be use for implementation of an interface > method. > Its only valid for super/subclass overriding. > > In Java6, @Override can be used for that implementation of an interface > method > as well. > > Eclipse uses the JDK for the project/workspace - Maven's compile plugin > uses > the configuration in the pom.xml for what level of conformity to use. > > Not sure if that helps but hope it points in the right direction... > > Brian > > ----- Original message ----- > From: "Cristiano Gavião" <[email protected]> > To: [email protected] > Date: Sat, 29 Jan 2011 17:31:48 -0300 > Subject: [jbehave-dev] weird compiler error on two classes at eclipse... > > Hi, > > I just have fetched a new version of Jbehave and I'm getting a compiler > error at eclipse... maven's build is ok. > > I'm using a new eclipse helios 3.6.1 and maybe could be some about compiler > defaults configuration on jdk 6 at eclipse... I don't remember to have > change anything... > > On AbsolutePathCalculator.java and RelativePathCalculator.java, IDE is > complaing about "@Override" statement: > > "The method calculate(String, String) of type AbsolutePathCalculator must > override a superclass method AbsolutePathCalculator.java > /jbehave-core/src/main/java/org/jbehave/core/io line 8 Java Problem" > > "The method calculate(String, String) of type RelativePathCalculator must > override a superclass method RelativePathCalculator.java > /jbehave-core/src/main/java/org/jbehave/core/io line 15 Java Problem" > > public class AbsolutePathCalculator implements PathCalculator { > @Override > public String calculate(String root, String path) { > return path; > } > } > > it works ok after have removed the statement... > > Should we use Override just when we extend some class from now? and why > maven build don't give me anything? :-s > > did somebody already saw something like that? > > regards > > Cristiano > --- > Brian Repko > LearnThinkCode, Inc. <http://www.learnthinkcode.com> > email: [email protected] > phone: +1 612 229 6779 >
