P
Philipp
Hello,
I have the following two interfaces.
//-----------------------
public class B extends A
//-----------------------
public interface IA {
public A getFormat();
public interface IB extends IA {
public B getFormat();
}
}
//-----------------------
Here, interface IB overrides the getFormat() method of its
super-interface IA. Instead of returning an A it now returns a B. Note
that B extends A.
In my eclipse, if I choose a compiler compliance level <= Java 1.4 this
gives an error "The return type is incompatible with IA.getFormat()". If
I choose a compliance level >= 5.0 it is OK without problem.
Is the overriding mechanism really different between Java 1.4 and 5?
(couldn't find any info about this on the new features page of J2SE 5.0)
What can I do to still use this construct on a Java 1.3 compatible JVM?
Thanks
Phil
I have the following two interfaces.
//-----------------------
public class B extends A
//-----------------------
public interface IA {
public A getFormat();
public interface IB extends IA {
public B getFormat();
}
}
//-----------------------
Here, interface IB overrides the getFormat() method of its
super-interface IA. Instead of returning an A it now returns a B. Note
that B extends A.
In my eclipse, if I choose a compiler compliance level <= Java 1.4 this
gives an error "The return type is incompatible with IA.getFormat()". If
I choose a compliance level >= 5.0 it is OK without problem.
Is the overriding mechanism really different between Java 1.4 and 5?
(couldn't find any info about this on the new features page of J2SE 5.0)
What can I do to still use this construct on a Java 1.3 compatible JVM?
Thanks
Phil