We regularly see people on this list complaining that things compile in Eclipse but not with Maven (or vice versa). Eventually it comes down to differences in JDT and javac. That's why I asked what I did...
Wayne On 3/5/08, Adrian Herscu <[EMAIL PROTECTED]> wrote: > Checked the eclipse.tools.jdt newsgroup; seems that there are many more > inconsistencies like these between the JDT compiler and javac, all of > those which I saw are regarded to generics. > Adrian. > P.S. And there is no switch in Eclipse to make it compile with javac, > except making it create and ANT build file. > > Adrian Herscu wrote: > > I thought about this... Problem is, that there are more than ten > > dependencies and the sources are stored into three different > > directories... Configuring javac for this, seems like a nightmare! > > > > I have changed the return type of the method from V to AbstractView, > > added a cast to V somewhere, and that solved the problem with Maven. > > Knew that these generics are more trouble than worth! > > > > Is there some switch in Eclipse to make it compile with javac? > > > > Wayne Fay wrote: > >> Can you try compiling with the Sun JDK 1.6 directly eg javac ...? > >> > >> Wayne > >> > >> On 3/5/08, Adrian Herscu <[EMAIL PROTECTED]> wrote: > >>> Hi all, > >>> > >>> I have this generic method which compiles fine under Eclipse 3.3: > >>> > >>> public abstract class AbstractApplication<M extends AbstractModel, V > >>> extends AbstractView, C extends AbstractControl> { > >>> ... > >>> private V getViewFor(final Class<? extends V> viewClass) { > >>> class InternalRunnable > >>> implements Runnable { > >>> private V frame; > >>> > >>> public void run() { > >>> try { > >>> frame = viewClass.newInstance(); > >>> frame > >>> .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); > >>> frame.setVisible(true); > >>> } catch (final InstantiationException e) { > >>> // TODO Auto-generated catch block > >>> e.printStackTrace(); > >>> } catch (final IllegalAccessException e) { > >>> // TODO Auto-generated catch block > >>> e.printStackTrace(); > >>> } > >>> } > >>> } > >>> ... > >>> } > >>> > >>> And the code runs OK on the Sun JRE 6.0. > >>> > >>> Now, I discovered that under Maven 2 with the following > >>> maven-compiler-plugin configuration: > >>> <configuration> > >>> <source>1.6</source> > >>> <target>1.6</target> > >>> </configuration> > >>> > >>> the build fails with the following compilation error: > >>> > >>> [INFO] Compilation failure > >>> C:\documents\pm\project-trunks\wirexn\sandbox\swing-client-sample\src\main\java\ > >>> > >>> org\wirexn\sandbox\wsgui\AbstractApplication.java:[103,23] incompatible > >>> types > >>> found : org.wirexn.sandbox.wsgui.view.AbstractView > >>> required: V > >>> > >>> > >>> > >>> C:\documents\pm\project-trunks\wirexn\sandbox\swing-client-sample\src\main\java\ > >>> > >>> org\wirexn\sandbox\wsgui\AbstractApplication.java:[103,23] incompatible > >>> types > >>> found : org.wirexn.sandbox.wsgui.view.AbstractView > >>> required: V > >>> > >>> Any suggestions? > >>> > >>> Thanks in advance, > >>> Adrian. > >>> > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: [EMAIL PROTECTED] > >>> For additional commands, e-mail: [EMAIL PROTECTED] > >>> > >>> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]