Skip to content

Conversation

Goooler
Copy link
Contributor

@Goooler Goooler commented Mar 5, 2024

Closes #271.

@fzhinkin fzhinkin self-assigned this Mar 5, 2024
@fzhinkin fzhinkin self-requested a review March 5, 2024 13:40
@fzhinkin fzhinkin removed their assignment Mar 5, 2024
public actual constructor(message: String?) : this(message, null)

public actual constructor() : this(null)
public actual constructor(cause: Throwable?) : this(null, cause)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usual behavior of this exception constructor is this(cause?.toString(), cause).

Copy link
Collaborator

@fzhinkin fzhinkin Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say it should be super(cause), and all other ctors should delegate to super ctors too.

Like here https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/wasm/src/kotlin/Exceptions.kt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secondary constructors call this for the primary constructor here, and this delegates to super, so we can't call super directly.

If we have to migrate the style to delegate to call supers, it would be great to address the fix to a follow-up, and remove primary constructors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap, we need to get rid of the primary ctor. I believe it could be done here along other changes, but don't mind making the change separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll send a new PR after this gets merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in #281.

@fzhinkin
Copy link
Collaborator

@Goooler thanks for opening the PR!
Please base the PR agains the develop branch, not the master (as per https://github.com/Kotlin/kotlinx-io/blob/master/CONTRIBUTING.md#submitting-changes).

@Goooler Goooler changed the base branch from master to develop March 12, 2024 01:49
@Goooler Goooler force-pushed the overload-io-exception branch from 4ec4006 to 388d25e Compare March 12, 2024 05:29
@fzhinkin fzhinkin self-requested a review March 12, 2024 09:57
@fzhinkin fzhinkin merged commit 0549884 into Kotlin:develop Mar 12, 2024
@Goooler Goooler deleted the overload-io-exception branch March 12, 2024 09:58
@martinkretzschmar
Copy link

Thank you @Goooler!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add IOException constructor(message: Throwable?)

3 participants