Jochen Theodorou a écrit :
> Hi all,
>
> someone showed my a rather strange thing with javac. It is not possible
> to express this in normal Java, so I am not sure it works as intended.
>
> imagine an interface:
>
> interface A {
> void foo();
> }
>
>
> and an implementing class:
>
> abstract class B implements A {
> synthetic void foo() {}
> }
>
> you will notice two possibly odd things here, the class B is abstract
> even though it implements all methods, but that is legal. The other
> thing is that he foo implementation is synthetic, which is a flag for
> the method, but not a valid keyword in Java. Anyway, just imagine you
> would have those two classe precompiled and now you want to compile this:
>
> class C extends B{}
>
> Now javac does not compile this. It complains that foo is not
> implemented. And that is strange, because B does implement the method.
> The only thing here is that the implementation method is synthetic. I
> confirmed this here with 1.7.0-ea-b24 and someone else with other
> versions of javac.
>
> If I go and remove synthetic in B, then javac does compile it.
>
> Now my question here is if javac is behaving correctly or not.
>
I don't know if there is a spec for synthetic.
In javac, during the method lookup, synthetic method aren't take into
account.
Synthetic method is an artifact used by the compiler to fill the holes
between the jls spec and the jvm spec.
>
> bye Jochen
>
Rémi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---