Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Andreas Leitgeb Newsgroups: comp.lang.java.programmer Subject: Re: How to assign an object to another in it method? Date: Thu, 13 Jul 2017 19:19:40 -0000 (UTC) Organization: A noiseless patient Spider Lines: 15 Message-ID: References: <46334961-cc18-491f-828c-32e7401c7832@googlegroups.com> Reply-To: avl@logic.at Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 13 Jul 2017 19:19:40 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="891ec2ce37e0ba46fd2b2385f5ad4a6c"; logging-data="509"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181evBBIyZOCymESRSi+nMc" User-Agent: slrn/1.0.2 (Linux) Cancel-Lock: sha1:O53PKOO5hYDDUINwvKAWTzTM/YM= Xref: csiph.com comp.lang.java.programmer:36912 Arne Vajhøj wrote: > On 7/13/2017 2:09 PM, Andreas Leitgeb wrote: >> Arne Vajhøj wrote: >>> I am objecting two these two: >>>>>>> Ideally, a subclass should be allowed to "remove" methods >>>>>> In this case why wouldn't you override Rectangle.setDimensions() with a >>>>>> variant that throws an exception if the two dimensions differ >>> Sub classes should not remove functionality. >> Maybe there's still some confusion about what "removing" means here. > I consider overriding a method and unconditionally throw an > exception toe be removing. By this definition, the unmodifiableList|Set|Map wouldn't be a List|Set|Map either...