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]

Reply via email to