You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2023/07/29 12:31:00 UTC

[jira] [Comment Edited] (LANG-1704) ImmutablePair and ImmutableTriple not actually final as documented

    [ https://issues.apache.org/jira/browse/LANG-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17748816#comment-17748816 ] 

Gary D. Gregory edited comment on LANG-1704 at 7/29/23 12:30 PM:
-----------------------------------------------------------------

WRT: "This is a problem because you can now subclass those and, for example, make an effectively mutable object that could be passed to a method with a parameter of type ImmutablePair."

If you create or use a subclass, then you are in a different use case. There is code everywhere where subclassing _can_ "subvert" the intent of the parent class.

I will update the Javadoc.


was (Author: garydgregory):
WRT: "This is a problem because you can now subclass those and, for example, make an effectively mutable object that could be passed to a method with a parameter of type ImmutablePair."

If you create or use a subclass, then you are in a different use case. There is code everywhere where subclassing _can_ "subvert" the intent of the parent class.

 

> ImmutablePair and ImmutableTriple not actually final as documented
> ------------------------------------------------------------------
>
>                 Key: LANG-1704
>                 URL: https://issues.apache.org/jira/browse/LANG-1704
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.tuple.*
>    Affects Versions: 3.13.0
>            Reporter: Dan Ziemba
>            Priority: Minor
>
> As of commons-lang3 3.13.0, the ImmutablePair and ImmutableTriple classes are no longer final, even though their javadocs claim that they are. This is a problem because you can now subclass those and, for example, make an effectively mutable object that could be passed to a method with a parameter of type ImmutablePair.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)