-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parent synthetic classes should preserve method exceptions
- Loading branch information
1 parent
8710e4a
commit 16dfeca
Showing
7 changed files
with
117 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
18 changes: 18 additions & 0 deletions
18
src/test/java/org/checkerframework/specimin/InheritMethodExceptionTest.java
This file contains 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,18 @@ | ||
package org.checkerframework.specimin; | ||
|
||
import java.io.IOException; | ||
import org.junit.Test; | ||
|
||
/** | ||
* This test checks that, given an @Override method with a throws clause in a child class, Specimin | ||
* will preserve the exceptions in its synthetic parent definition | ||
*/ | ||
public class InheritMethodExceptionTest { | ||
@Test | ||
public void runTest() throws IOException { | ||
SpeciminTestExecutor.runTestWithoutJarPaths( | ||
"inheritmethodexception", | ||
new String[] {"com/example/Simple.java"}, | ||
new String[] {"com.example.Simple#foo()"}); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/test/resources/inheritmethodexception/expected/com/example/Parent.java
This file contains 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 @@ | ||
package com.example; | ||
|
||
public class Parent { | ||
|
||
public void foo() throws UnknownException { | ||
throw new Error(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/test/resources/inheritmethodexception/expected/com/example/Simple.java
This file contains 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 @@ | ||
package com.example; | ||
|
||
public class Simple extends Parent { | ||
|
||
public void foo() throws UnknownException { | ||
throw new Exception(); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/test/resources/inheritmethodexception/expected/com/example/UnknownException.java
This file contains 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,4 @@ | ||
package com.example; | ||
|
||
public class UnknownException extends java.lang.Throwable { | ||
} |
8 changes: 8 additions & 0 deletions
8
src/test/resources/inheritmethodexception/input/com/example/Simple.java
This file contains 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 @@ | ||
package com.example; | ||
|
||
public class Simple extends Parent { | ||
@Override | ||
public void foo() throws UnknownException { | ||
throw new Exception(); | ||
} | ||
} |