Better HN
topnewbestaskshowjobs
Log inSign up

bassman7755

1 karma · joined Aug 27, 2014 (12y ago) · 1 submissions

Submissions

comment 12y ago · link · parent

The problem is that you cant add computed accessor methods to java without breaking code backwards compatibility. This is because a public fields and a public methods have different inheritance semantics - public field access does not trigger polymorphic resolution. Hence auto replacing it with a access method would break any code that relies on the static resolution of the public field (i.e. resolution by referencing type). To fair there probably isnt much code out there that would fall foul of this since there isnt any good reason to write code that relies on public field "hiding" by subclasses, but it would be technically non backwards compatible.