You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Elliotte Rusty Harold (Jira)" <ji...@apache.org> on 2023/12/28 12:24:00 UTC

[jira] [Updated] (IO-830) Rethink AbstractOrigin

     [ https://issues.apache.org/jira/browse/IO-830?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Elliotte Rusty Harold updated IO-830:
-------------------------------------
    Description: 
UnuspportedOperationException is a code smell that indicates the class hierarchy doesn't really fit the problem and violates the Liskov Subsitution Principle

See https://softwareengineering.stackexchange.com/questions/337850/is-expecting-the-api-user-to-implement-an-unsupportedoperationexception-okay

It doesn't work to treat all origins the same. E.g. CharSequences really, really need a character set before they can be converted to byte arrays or input streams, but byte arrays and files don't. In reverse files need a character set to be converted to a reader but char sequences don't.

Different classes need different arguments, whether you use a builder or a constructor. There's not common type here. 


  was:
UnuspportedOperationException is a code smell that indicates the class hierarchy doesn't really fit the problem.

See https://softwareengineering.stackexchange.com/questions/337850/is-expecting-the-api-user-to-implement-an-unsupportedoperationexception-okay

It doesn't work to treat all origins the same. E.g. CharSequences really, really need a character set before they can be converted to byte arrays or input streams, but byte arrays and files don't. In reverse files need a character set to be converted to a reader but char sequences don't.

Different classes need different arguments, whether you use a builder or a constructor. There's not common type here. 



> Rethink AbstractOrigin
> ----------------------
>
>                 Key: IO-830
>                 URL: https://issues.apache.org/jira/browse/IO-830
>             Project: Commons IO
>          Issue Type: Bug
>            Reporter: Elliotte Rusty Harold
>            Priority: Critical
>
> UnuspportedOperationException is a code smell that indicates the class hierarchy doesn't really fit the problem and violates the Liskov Subsitution Principle
> See https://softwareengineering.stackexchange.com/questions/337850/is-expecting-the-api-user-to-implement-an-unsupportedoperationexception-okay
> It doesn't work to treat all origins the same. E.g. CharSequences really, really need a character set before they can be converted to byte arrays or input streams, but byte arrays and files don't. In reverse files need a character set to be converted to a reader but char sequences don't.
> Different classes need different arguments, whether you use a builder or a constructor. There's not common type here. 



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