Do Java 8 default methods break source compatibility?

后端 未结 5 1231
日久生厌
日久生厌 2020-11-30 05:24

It has generally been the case the Java source code has been forward compatible. Until Java 8, as far as I know, both compiled classes and source have been forward

5条回答
  •  自闭症患者
    2020-11-30 05:48

    Doesn't JDK 1.8 introduce a forward incompatibility for Java source code due to default methods?

    Yes as you've seen your self.

    Is this the first such forward incompatible change?

    No. Java 5 enumkeyword was also breaking because before that you could have variables named that which would no longer compile in Java 5 +

    Was this considered or discussed when default methods where designed and implemented? Is it documented anywhere?

    Yes Orcale Java 8 source incompatibility description

    Was the (admittedly small) inconvenience discounted versus the benefits?

    Yes

提交回复
热议问题