Cristiano, Whatever gets you through the night is alright...to quote John Lennon, but we need to know if JBehave is 1.5 src or 1.6 src. If it's 1.6, then we need to be 1.6 and if not we should be seeing errors during our continuous integration builds, no?
B ----- Original message ----- From: "Cristiano Gavião" <[email protected]> To: [email protected] Cc: "Dan Godfrey" <[email protected]> Date: Mon, 31 Jan 2011 11:00:19 -0300 Subject: Re: [jbehave-dev] weird compiler error on two classes at eclipse... Dan, Brian, thanks for the explanation... Well spoted, m2eclipse configures the classpath according to POM.xml. in case J2SE-1.5 for Jbehave. The interesting thing is that I have only one JDK6 and I haven't any jdk5 installed. All compiler settings of eclipse is pointing to JDK6... The J2SE-1.5 execution environment itself is pointing to JDK6. But even with all this settings, its still following 1.5 rules... :-) So, I prefered to change manually the .classpath instead to change the pom.xml (just to avoid git messages when doing fetch/merge with something not commited): <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.int ernal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> thanks again cheers Cristiano On 29/01/11 18:56, Dan Godfrey wrote: 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 <[1][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" <[2][email protected]> To: [3][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 [4]LearnThinkCode, Inc. email: [5][email protected] phone: +1 612 229 6779 References 1. mailto:[email protected] 2. mailto:[email protected] 3. mailto:[email protected] 4. http://www.learnthinkcode.com/ 5. mailto:[email protected] --- Brian Repko LearnThinkCode, Inc. http://www.learnthinkcode.com email: [email protected] phone: +1 612 229 6779
