Skip to content

Why X.class? #3

@oliviercailloux

Description

@oliviercailloux

I love your approach! This is the way to go for those who, like me, don’t like sneaky throws.

I just reviewed several popular SO questions that deal with the “streams and checked exceptions” issue, and found only your library as a solution for those who want no library that sneaky throw among their dependencies, among the ones that these questions reference (though I may have missed some):

Now to my question. Why do you require a class parameter designating the exception thrown, when creating a ThrowingStream? This seems unnecessary to me, and makes usage less elegant from the caller’s point of view. At least, the example in the wiki can be modified so as to avoid usage of the parameter Class<X> x in the StreamAdapter constructor (I just did it). Is there something that has escaped me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions