-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve MustImplementMethodsVisitor
method type ancestors
#329
Merged
Merged
Changes from 9 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
56b410c
MustImplementMethodsVisitor should include return types
theron-wang f7e8096
branch change conflict changes
theron-wang 74fe580
Merge branch 'main' of https://github.com/njit-jerse/specimin into ab…
theron-wang eb84c4e
fix bugs + add test cases
theron-wang e9404d6
spotless
theron-wang c2782cc
Fix UnsolvedSymbolException
theron-wang 77cb844
Adjust test case to match recent changes
theron-wang 3d7579e
`getQualifiedSignature()` can also throw UnsolvedSymbolException
theron-wang fa721f7
Method name code was wrong
theron-wang 9d0eda2
Handle interface/abstract methods a different way
theron-wang b4203b8
Add thrown exceptions
theron-wang 8138707
changes should only apply to abstract methods
theron-wang 791b4af
reflect latest changes for test cases
theron-wang af9d177
Only handle abstract classes in ancestorMethodPreservedAndAbstract
theron-wang e8e7835
fix no `@return` warning
theron-wang 4c73f0e
fix integration test bugs?
theron-wang d7f65ad
fix errors
theron-wang a49c092
add comment
theron-wang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
20 changes: 20 additions & 0 deletions
20
src/test/java/org/checkerframework/specimin/Issue103Test.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,20 @@ | ||
package org.checkerframework.specimin; | ||
|
||
import java.io.IOException; | ||
import org.junit.Test; | ||
|
||
/** | ||
* This test checks if Specimin will preserve ancestors of types added in | ||
* MustImplementMethodsVisitor. It also checks to see if methods whose direct override is abstract, | ||
* but original definition is JDK are preserved. Test code derived from a modified, minimized | ||
* version of NullAway issue 103. | ||
*/ | ||
public class Issue103Test { | ||
@Test | ||
public void runTest() throws IOException { | ||
SpeciminTestExecutor.runTestWithoutJarPaths( | ||
"issue103", | ||
new String[] {"com/example/Simple.java"}, | ||
new String[] {"com.example.Simple#foo()"}); | ||
} | ||
} |
104 changes: 104 additions & 0 deletions
104
src/test/resources/issue103/expected/com/example/AbstractLinkedDeque.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,104 @@ | ||
package com.example; | ||
|
||
import java.util.AbstractCollection; | ||
|
||
public abstract class AbstractLinkedDeque<E> extends AbstractCollection<E> implements LinkedDeque<E> { | ||
|
||
public int size() { | ||
throw new Error(); | ||
} | ||
|
||
public abstract boolean contains(Object o); | ||
|
||
public E peek() { | ||
throw new Error(); | ||
} | ||
|
||
public E peekFirst() { | ||
throw new Error(); | ||
} | ||
|
||
public E peekLast() { | ||
throw new Error(); | ||
} | ||
|
||
public E getFirst() { | ||
throw new Error(); | ||
} | ||
|
||
public E getLast() { | ||
throw new Error(); | ||
} | ||
|
||
public E element() { | ||
throw new Error(); | ||
} | ||
|
||
public boolean offer(E e) { | ||
throw new Error(); | ||
} | ||
|
||
public boolean offerFirst(E e) { | ||
throw new Error(); | ||
} | ||
|
||
public boolean offerLast(E e) { | ||
throw new Error(); | ||
} | ||
|
||
public void addFirst(E e) { | ||
throw new Error(); | ||
} | ||
|
||
public void addLast(E e) { | ||
throw new Error(); | ||
} | ||
|
||
public E poll() { | ||
throw new Error(); | ||
} | ||
|
||
public E pollFirst() { | ||
throw new Error(); | ||
} | ||
|
||
public E pollLast() { | ||
throw new Error(); | ||
} | ||
|
||
public E remove() { | ||
throw new Error(); | ||
} | ||
|
||
public E removeFirst() { | ||
throw new Error(); | ||
} | ||
|
||
public boolean removeFirstOccurrence(Object o) { | ||
throw new Error(); | ||
} | ||
|
||
public E removeLast() { | ||
throw new Error(); | ||
} | ||
|
||
public boolean removeLastOccurrence(Object o) { | ||
throw new Error(); | ||
} | ||
|
||
public void push(E e) { | ||
throw new Error(); | ||
} | ||
|
||
public E pop() { | ||
throw new Error(); | ||
} | ||
|
||
public PeekingIterator<E> iterator() { | ||
throw new Error(); | ||
} | ||
|
||
public PeekingIterator<E> descendingIterator() { | ||
throw new Error(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/test/resources/issue103/expected/com/example/AccessOrderDeque.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; | ||
|
||
import java.util.Deque; | ||
|
||
public final class AccessOrderDeque<E> extends AbstractLinkedDeque<E> { | ||
|
||
public boolean contains(Object o) { | ||
throw new Error(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/test/resources/issue103/expected/com/example/LinkedDeque.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; | ||
|
||
import java.util.Deque; | ||
import java.util.Iterator; | ||
|
||
public interface LinkedDeque<E> extends Deque<E> { | ||
|
||
interface PeekingIterator<E> extends Iterator<E> { | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/resources/issue103/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,12 @@ | ||
package com.example; | ||
|
||
public class Simple<K> { | ||
|
||
AccessOrderDeque<K> bar() { | ||
throw new Error(); | ||
} | ||
|
||
void foo() { | ||
AccessOrderDeque<K> x = bar(); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the values in this map also need to include thrown exceptional types. The new code exposes a problem caused by not doing that in CF-6060, which it looks like is why that integration test fails.