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]

Reply via email to