Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden. Du solltest ein Upgrade durchführen oder ein alternativer Browser verwenden.
Yupp, ich weiß, JDeveloper ist Schrott. Falls trotzdem jemand dieses Dingens installiert hat, wäre es absolut cool, wenn derjenige mal folgendes für mich ausprobieren könnte (ich bekomme einen Fehler angezeigt, mein amerikanischer Kollege will mir nicht so richtig glauben):
Macht ein package "example", packt folgende 3 Interfaces und 1 Klasse hinein:
Java:
public interface A<SubA extends A<SubA>> {
<SubB extends B<SubA>> SubB getB(AB<SubA, SubB> ab);
}
public interface B <SubA extends A<SubA>> { }
public interface AB<SubA extends A<SubA>, SubB extends B<SubA>> { }
public class AImpl implements A<AImpl> {
public <SubB extends B<AImpl>> SubB getB(AB<AImpl, SubB> ab) { return null; }
}
JDeveloper beschwert sich bei mir wie folgt: Error(3,14): class example.AImpl should be declared abstract; it does not define method getB(example.AB<SubA,SubB>) of interface example.A
Der Code ist zwar nicht besonders sinnvoll, meiner bescheidenen Meinung nach aber absolut korrekt (auch mein oller JBuilder schluckt ihn ohne Probleme).
Meine JDeveloper-Version ist 11.1.1.1.0 (sollte eigentlich aktuell sein)
Danke, gut gesehen! Ich habe mich vertippt, ist jetzt korrigiert. Der Fehler ist jetzt:
Error(3,14): class example.AImpl should be declared abstract; it does not define method getB(example.AB<SubA,SubB>) of interface example.A
Error(4,40): method getB(example.AB<example.AImpl,SubB>) does not implement method getB(example.AB<SubA,SubB>) in interface example.A<example.AImpl>, but has same erasure
[edit]: Habe NetBeans damit gefüttert, compiliert anstandslos.
Mein amerikanischer Kollege hat es endlich eingesehen und den Code im Oracle-Forum gepostet. Übrigens lässt sich JDeveloper einfach vom internen Compiler ojc auf javac umstellen, wodurch man das Problem umgangen hat.
Die Antwort von Oracle finde ich so köstlich, dass ich sie euch nicht vorenthalten will:
Yes, this appears to be a bug in OJC based on the fact that Javac compiles it. (JBuilder uses Javac under the hood). I will file a bug for this. This kind of code is highly unusual (and frankly not easy to comprehend) so I doubt many people run into this bug. I recommend trying to simplify your class hierarchy, and not use type parameters defined in terms of themselves, to work around the bug. Alternatively, you can start using Javac as the project's compiler, which you can set in the compiler page of project properties.