Skip to content

Conversation

@NthPortal
Copy link
Contributor

@NthPortal NthPortal commented Nov 22, 2018

Use granular hierarchy for exception suppression in Using.resource.

The motivation for this PR is that it seemed odd to me that a NonLocalReturnControl should be thrown in preference to a VirtualMachineError.

@scala-jenkins scala-jenkins added this to the 2.13.0-RC1 milestone Nov 22, 2018
case _: InterruptedException | _: ThreadDeath => 2
case _: ControlThrowable => 0
case e if !NonFatal(e) => 1 // in case this method gets out of sync with NonFatal
case _ => -1
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any chance to make this 4,3,2,1,0,-1 to be named constants?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

does that improve clarity? They're only used here, and I would think it's clearer when you can see their values (since they're not quite in sorted order)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(because ControlThrowable sorts below other fatals, it needs to be matched before NonFatal, or they'll end up with the same score/rank)

@NthPortal NthPortal force-pushed the topic/using-suppression/PR branch from 58fc438 to 6129108 Compare November 23, 2018 02:20
case _: InterruptedException | _: ThreadDeath => 2
case _: ControlThrowable => 0
case e if !NonFatal(e) => 1 // in case this method gets out of sync with NonFatal
case _ => -1
Copy link
Contributor Author

@NthPortal NthPortal Nov 23, 2018

Choose a reason for hiding this comment

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

I am open to discussing whether this is in fact the best hierarchy

@NthPortal
Copy link
Contributor Author

review @Ichoran

Use granular hierarchy for exception suppression in
`Using.resource`.
@NthPortal NthPortal force-pushed the topic/using-suppression/PR branch from 9763a18 to f1ef66c Compare December 15, 2018 06:17
@dwijnand dwijnand merged commit f1ef66c into scala:2.13.x Dec 26, 2018
@NthPortal NthPortal deleted the topic/using-suppression/PR branch December 26, 2018 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants