JDK 1.7 breaks backward compatibility? (generics)

后端 未结 2 991
心在旅途
心在旅途 2020-12-11 15:27

I\'ve found similar topics, but overly complicated and not quite the same. So the thing is. Here\'s the(minimal) code which is fine on 1.6, but doesn\'t compile with 1.7 jav

2条回答
  •  猫巷女王i
    2020-12-11 15:51

    You're quite right, under JLS3 this code should never have compiled and this was a bug in 1.6.

    For the release of 1.7 much of the underlying type system was updated and this bug was fixed, the result is better type handling at the cost of some backward compatibility issues.

    As for getting it to work in 1.7, I believe re-factoring is your only option.

提交回复
热议问题