-
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 #101 from LoiNguyenCS/preserve-solved-interface
Handling interfaces
- Loading branch information
Showing
32 changed files
with
417 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
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
15 changes: 15 additions & 0 deletions
15
src/test/java/org/checkerframework/specimin/InterfaceImplementedTest.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 org.checkerframework.specimin; | ||
|
||
import java.io.IOException; | ||
import org.junit.Test; | ||
|
||
/** This test checks if Specimin can properly remove unused method signatures from an interface. */ | ||
public class InterfaceImplementedTest { | ||
@Test | ||
public void runTest() throws IOException { | ||
SpeciminTestExecutor.runTestWithoutJarPaths( | ||
"interfaceimplemented", | ||
new String[] {"com/example/Foo.java"}, | ||
new String[] {"com.example.Foo#doSomething()"}); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/java/org/checkerframework/specimin/InterfaceMethodWithUnsolvedTypeTest.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 makes sure that Specimin will not crash if methods from interfaces have unsolved return | ||
* types. | ||
*/ | ||
public class InterfaceMethodWithUnsolvedTypeTest { | ||
@Test | ||
public void runTest() throws IOException { | ||
SpeciminTestExecutor.runTestWithoutJarPaths( | ||
"interfacemethodwithunsolvedtype", | ||
new String[] {"com/example/Foo.java"}, | ||
new String[] {"com.example.Foo#doSomething(String)"}); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/java/org/checkerframework/specimin/InterfaceWithGenericTypeTest.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 org.checkerframework.specimin; | ||
|
||
import java.io.IOException; | ||
import org.junit.Test; | ||
|
||
/** This test checks if Specimin can work for interfaces with generic types. */ | ||
public class InterfaceWithGenericTypeTest { | ||
@Test | ||
public void runTest() throws IOException { | ||
SpeciminTestExecutor.runTestWithoutJarPaths( | ||
"interfacewithgenerictype", | ||
new String[] {"com/example/Foo.java"}, | ||
new String[] {"com.example.Foo#doSomething(String)"}); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/java/org/checkerframework/specimin/InterfaceWithUnsolvedSymbols.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 org.checkerframework.specimin; | ||
|
||
import java.io.IOException; | ||
import org.junit.Test; | ||
|
||
/** This test makes sure that Specimin will not crash if an interface contains unsolved symbols. */ | ||
public class InterfaceWithUnsolvedSymbols { | ||
@Test | ||
public void runTest() throws IOException { | ||
SpeciminTestExecutor.runTestWithoutJarPaths( | ||
"interfacewithunsolvedsymbols", | ||
new String[] {"com/example/Foo.java"}, | ||
new String[] {"com.example.Foo#doSomething(String)"}); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/java/org/checkerframework/specimin/UnsolvedInterfaceTest.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 org.checkerframework.specimin; | ||
|
||
import java.io.IOException; | ||
import org.junit.Test; | ||
|
||
/** This test checks if Specimin can properly remove an unsolved interface. */ | ||
public class UnsolvedInterfaceTest { | ||
@Test | ||
public void runTest() throws IOException { | ||
SpeciminTestExecutor.runTestWithoutJarPaths( | ||
"unsolvedinterface", | ||
new String[] {"com/example/Foo.java"}, | ||
new String[] {"com.example.Foo#doManyThing()"}); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/java/org/checkerframework/specimin/UnusedInterfaceTest.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 org.checkerframework.specimin; | ||
|
||
import java.io.IOException; | ||
import org.junit.Test; | ||
|
||
/** This test checks if Specimin can properly remove unused interfaces. */ | ||
public class UnusedInterfaceTest { | ||
@Test | ||
public void runTest() throws IOException { | ||
SpeciminTestExecutor.runTestWithoutJarPaths( | ||
"unusedinterface", | ||
new String[] {"com/example/Foo.java"}, | ||
new String[] {"com.example.Foo#doManyThing()"}); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/test/resources/interfaceimplemented/expected/com/example/Baz.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 interface Baz { | ||
|
||
void doSomething(); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/test/resources/interfaceimplemented/expected/com/example/Foo.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,9 @@ | ||
package com.example; | ||
|
||
class Foo implements Baz { | ||
|
||
@Override | ||
public void doSomething() { | ||
System.out.println("Foo is doing something!"); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/test/resources/interfaceimplemented/input/com/example/Baz.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,9 @@ | ||
package com.example; | ||
|
||
// Baz.java | ||
public interface Baz { | ||
void doSomething(); | ||
void doOneThing(); | ||
void doNothing(); | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
src/test/resources/interfaceimplemented/input/com/example/Foo.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,10 @@ | ||
package com.example; | ||
|
||
// Foo.java | ||
class Foo implements Baz { | ||
@Override | ||
public void doSomething() { | ||
System.out.println("Foo is doing something!"); | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/test/resources/interfacemethodwithunsolvedtype/expected/com/example/Baz.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; | ||
|
||
import org.testing.UnsolvedType; | ||
|
||
public interface Baz<T> { | ||
|
||
UnsolvedType doSomething(T value); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/resources/interfacemethodwithunsolvedtype/expected/com/example/Foo.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,11 @@ | ||
package com.example; | ||
|
||
import org.testing.UnsolvedType; | ||
|
||
class Foo implements Baz<String> { | ||
|
||
@Override | ||
public UnsolvedType doSomething(String value) { | ||
System.out.println("Foo is doing something with: " + value); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/test/resources/interfacemethodwithunsolvedtype/expected/org/testing/UnsolvedType.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 org.testing; | ||
|
||
public class UnsolvedType { | ||
} |
Oops, something went wrong.