-
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.
Merge pull request #35 from LoiNguyenCS/inner-to-nested
Fix bugs with static nested classes
- Loading branch information
Showing
6 changed files
with
63 additions
and
2 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
21 changes: 21 additions & 0 deletions
21
src/test/java/org/checkerframework/specimin/StaticNestedClass.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,21 @@ | ||
package org.checkerframework.specimin; | ||
|
||
import java.io.IOException; | ||
import org.junit.Test; | ||
|
||
/** | ||
* This test checks that if Specimin will work properly where there are static nested classes in the | ||
* input code | ||
*/ | ||
public class StaticNestedClass { | ||
@Test | ||
public void runTest() throws IOException { | ||
SpeciminTestExecutor.runTestWithoutJarPaths( | ||
"staticnestedclass", | ||
new String[] {"com/example/OuterFamily.java"}, | ||
new String[] { | ||
"com.example.OuterFamily#getLastName()", | ||
"com.example.OuterFamily.InnerFamily#getLastName()" | ||
}); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/test/resources/staticnestedclass/expected/com/example/Maternal.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 Maternal { | ||
|
||
public String maternalLastName = null; | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/resources/staticnestedclass/expected/com/example/OuterFamily.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,15 @@ | ||
package com.example; | ||
|
||
class OuterFamily extends Maternal { | ||
|
||
static class InnerFamily extends Paternal { | ||
|
||
public String getLastName() { | ||
return paternalLastName; | ||
} | ||
} | ||
|
||
public String getLastName() { | ||
return maternalLastName; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/test/resources/staticnestedclass/expected/com/example/Paternal.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 Paternal { | ||
|
||
public String paternalLastName = null; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/test/resources/staticnestedclass/input/com/example/OuterFamily.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,13 @@ | ||
package com.example; | ||
|
||
class OuterFamily extends Maternal { | ||
static class InnerFamily extends Paternal { | ||
public String getLastName() { | ||
return paternalLastName; | ||
} | ||
} | ||
// point A | ||
public String getLastName() { | ||
return maternalLastName; | ||
} | ||
} |