-
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.
- Loading branch information
1 parent
8b3b5f7
commit bae6d74
Showing
7 changed files
with
214 additions
and
6 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/HiddenSuperFieldAndUnsolvedLocal.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 if Specimin will work properly where there is a super variables call while | ||
* the parent class file is not in the root directory physically | ||
*/ | ||
public class HiddenSuperFieldAndUnsolvedLocal { | ||
@Test | ||
public void runTest() throws IOException { | ||
SpeciminTestExecutor.runTestWithoutJarPaths( | ||
"HiddenSuperFieldAndUnsolvedLocal", | ||
new String[] {"com/example/Child.java"}, | ||
new String[] {"com.example.Child#returnLocalName()"}); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/resources/HiddenSuperFieldAndUnsolvedLocal/expected/com/example/Child.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 com.example; | ||
|
||
import sample.pack.MyType; | ||
|
||
public class Child extends Parent { | ||
|
||
public MyType returnLocalName() { | ||
if (3 > 4) { | ||
MyType thisName = new MyType(); | ||
return thisName; | ||
} else if (4 > 7) { | ||
MyType thatName = new MyType(); | ||
return thatName; | ||
} else { | ||
return theName; | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/test/resources/HiddenSuperFieldAndUnsolvedLocal/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,6 @@ | ||
package com.example; | ||
|
||
public class Parent { | ||
|
||
public MyType theName = null; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/test/resources/HiddenSuperFieldAndUnsolvedLocal/expected/sample/pack/MyType.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 sample.pack; | ||
|
||
public class MyType { | ||
|
||
public MyType() { | ||
throw new Error(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/resources/HiddenSuperFieldAndUnsolvedLocal/input/com/example/Child.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 com.example; | ||
|
||
import sample.pack.MyType; | ||
|
||
public class Child extends Parent { | ||
// for Specimin, an implicit called superfield and a variable with an unsolved type will both be seen as unsolved NameExpr instances. This test is to make sure that Specimin will not confuse between those two cases. | ||
public MyType returnLocalName() { | ||
if (3 > 4) { | ||
MyType thisName = new MyType(); | ||
return thisName; | ||
} else if (4 > 7) { | ||
MyType thatName = new MyType(); | ||
return thatName; | ||
} else { | ||
return theName; | ||
} | ||
} | ||
} |