-
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
b44badd
commit 1352279
Showing
8 changed files
with
190 additions
and
37 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
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/AnonymousClass.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 org.junit.Test; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* This test checks that if Specimin will work if there is an anonymous class inside the target method | ||
*/ | ||
public class AnonymousClass { | ||
@Test | ||
public void runTest() throws IOException { | ||
SpeciminTestExecutor.runTestWithoutJarPaths( | ||
"anonymousclass", | ||
new String[] {"com/example/Simple.java"}, | ||
new String[] {"com.example.Simple#testAnonymous()"}); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/resources/anonymousclass/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,18 @@ | ||
package com.example; | ||
|
||
import com.nameless.SomeClass; | ||
|
||
public class Simple { | ||
|
||
public int testAnonymous() { | ||
int localVar = 42; | ||
SomeClass myObject = new SomeClass() { | ||
|
||
@Override | ||
public int getLocalVar() { | ||
return localVar; | ||
} | ||
}; | ||
return 0; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/resources/anonymousclass/expected/com/nameless/SomeClass.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,12 @@ | ||
package com.nameless; | ||
|
||
public class SomeClass { | ||
|
||
public SomeClass() { | ||
throw new Error(); | ||
} | ||
|
||
public int getLocalVar() { | ||
throw new Error(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/test/resources/anonymousclass/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,22 @@ | ||
package com.example; | ||
|
||
import com.nameless.SomeClass; | ||
|
||
public class Simple { | ||
public int testAnonymous() { | ||
int localVar = 42; // An effectively final variable | ||
|
||
SomeClass myObject = new SomeClass() { | ||
@Override | ||
public int getLocalVar() { | ||
return localVar; | ||
} | ||
}; | ||
return 0; | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|