-
Notifications
You must be signed in to change notification settings - Fork 273
Exception handling fixes #1725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Exception handling fixes #1725
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
test.class | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
This test verifies that catches are executed in the correct order | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class A extends RuntimeException {} | ||
class B extends A {} | ||
|
||
// This test verifies that catches are executed in the correct order | ||
public class test { | ||
public static void main (String args[]) { | ||
int i = 0; | ||
try { | ||
try { | ||
throw new A(); | ||
} | ||
catch(A exc) { | ||
i++; | ||
throw new B(); | ||
} | ||
finally | ||
{ | ||
// Make sure A threw into the catch | ||
assert(i==1); | ||
i++; | ||
} | ||
} | ||
catch(B exc) { | ||
// Make sure finally was executed | ||
assert(i==2); | ||
i++; | ||
} | ||
// Make sure B was rethrown by finally | ||
assert(i==3); | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CORE | ||
test.class | ||
VERIFICATION SUCCESSFUL | ||
-- | ||
^warning: ignoring | ||
-- | ||
Tests embedded try-catch-finally to ensure the catching order is correct | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit pick: no newline at end-of-file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import org.cprover.CProver; | ||
class A extends RuntimeException {} | ||
class B extends A {} | ||
|
||
// This test verifies that catches are executed in the correct order | ||
public class test { | ||
public static void main (String args[]) { | ||
int i = 0; | ||
int j = 0; | ||
try { | ||
try { | ||
try { | ||
if (CProver.nondetBoolean()) throw new A(); | ||
else throw new B(); | ||
} | ||
catch(B exc) { | ||
i++; | ||
} | ||
catch(A exc) { | ||
i++; | ||
throw new B(); | ||
} | ||
finally | ||
{ | ||
// Make sure A threw into the catch | ||
assert(i==1); | ||
i++; | ||
} | ||
assert(i==2); | ||
// Account for the rethrow in finally | ||
j++; | ||
} | ||
catch(B exc) { | ||
// Make sure finally was executed | ||
assert(i==2); | ||
i++; | ||
throw new B(); | ||
} | ||
finally | ||
{ | ||
assert ((i+j) == 3); | ||
} | ||
// Account for the rethrow in finally | ||
j++; | ||
} | ||
catch(B exc) | ||
{ | ||
i++; | ||
} | ||
// Make sure B was rethrown by finally when A was thrown | ||
// or if B was thrown there was no rethrow | ||
assert(i+j == 4); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit pick: missing newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it, but it's not showing here (same for the other one below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine now, github is no longer showing that red warning sign.