-
Notifications
You must be signed in to change notification settings - Fork 11
Add support for the permits keyword
#453
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
09064c8
fix crash when resolving method declarations in annotations
theron-wang ffe18bf
move resolution logic into `Resolver` and fix another JavaParser bug …
theron-wang 6d48d01
fix missing documentation
theron-wang 9192a39
address CR comments + failing compilation in specimin-evaluation
theron-wang e5aac73
coderabbit + match method references for error prone check as well
theron-wang c175c16
fix gradle test logic and make addAllMatchingCallablesToListImpl work…
theron-wang 024a6a6
fix missing logic from last commit
theron-wang 6377a49
workaround for javaparser constraint type is assignable check bug
theron-wang c4396e7
coderabbit, again
theron-wang db29e06
add support for the `permits` keyword
theron-wang 9ab9cb9
coderabbit
theron-wang 9e31b9d
more coderabbit
theron-wang 00b1634
Merge branch 'main' into permits
theron-wang 7d7b32d
address CR comments + ensure certain files are LF
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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -4,3 +4,5 @@ | |
| # These are explicitly windows files and should use crlf | ||
| *.bat text eol=crlf | ||
|
|
||
| *.sh text eol=lf | ||
| gradlew text eol=lf | ||
This file contains hidden or 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/main/java/org/checkerframework/specimin/unsolved/Sealedness.java
This file contains hidden or 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.unsolved; | ||
|
|
||
| /** | ||
| * The "sealedness" of a synthetic type; i.e., the keyword that goes in front of the class | ||
| * declaration. | ||
| * | ||
| * <p>For example, {@link Sealedness#NON_SEALED} corresponds with {@code non-sealed class Foo}. | ||
| */ | ||
| public enum Sealedness { | ||
| /** No sealedness --> {@code class Foo} */ | ||
| NONE, | ||
| /** Non-sealed --> {@code non-sealed class Foo} */ | ||
| NON_SEALED, | ||
| /** Sealed --> {@code sealed class Foo} */ | ||
| SEALED, | ||
| /** Final --> {@code final class Foo} */ | ||
| FINAL | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
16 changes: 16 additions & 0 deletions
16
src/test/java/org/checkerframework/specimin/PermitsTest.java
This file contains hidden or 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,16 @@ | ||
| package org.checkerframework.specimin; | ||
|
|
||
| import java.io.IOException; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| /** | ||
| * This test checks that types in permits clauses are preserved, in addition to relevant keywords | ||
| * like final, sealed, and non-sealed in child classes. | ||
| */ | ||
| public class PermitsTest { | ||
| @Test | ||
| public void runTest() throws IOException { | ||
| SpeciminTestExecutor.runTestWithoutJarPaths( | ||
| "permits", new String[] {"com/example/Foo.java"}, new String[] {"com.example.Foo#foo()"}); | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
src/test/java/org/checkerframework/specimin/UnsolvedPermitsTest.java
This file contains hidden or 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.jupiter.api.Test; | ||
|
|
||
| /** | ||
| * This test checks that unsolved types in permits clauses are generated with a correct keyword (in | ||
| * best effort run mode, this would be final, unless we have evidence otherwise). | ||
| */ | ||
| public class UnsolvedPermitsTest { | ||
| @Test | ||
| public void runTest() throws IOException { | ||
| SpeciminTestExecutor.runTestWithoutJarPaths( | ||
| "unsolvedpermits", | ||
| new String[] {"com/example/Foo.java"}, | ||
| new String[] {"com.example.Foo#foo()"}); | ||
| } | ||
| } |
This file contains hidden or 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; | ||
|
|
||
| public sealed class Foo permits Bar, Baz, Qux { | ||
| void foo() { } | ||
| } | ||
|
|
||
| final class Bar extends Foo { } | ||
| non-sealed class Baz extends Foo { } | ||
| sealed class Qux extends Foo permits Quux { } | ||
|
|
||
| final class Quux extends Qux { } |
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.
Uh oh!
There was an error while loading. Please reload this page.