-
Notifications
You must be signed in to change notification settings - Fork 35
Logic for method overload with different types #172
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 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
beffa81
add logic for method overload with different types
CatarinaGamboa b14bb04
Update liquidjava-example/src/main/java/testSuite/classes/overload_co…
CatarinaGamboa b064cef
Update liquidjava-example/src/main/java/testSuite/classes/overload_co…
CatarinaGamboa 1da75ac
Reviewed Changes
rcosta358 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
16 changes: 16 additions & 0 deletions
16
liquidjava-example/src/main/java/testSuite/classes/overload_constructors_correct/Test.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 testSuite.classes.overload_constructors_correct; | ||
|
|
||
| public class Test{ | ||
| void test3(){ | ||
| Throwable t = new Throwable("Example"); | ||
| t.initCause(null); | ||
| t.getCause(); | ||
| } | ||
|
|
||
| void test4(){ | ||
| Throwable originT = new Throwable(); | ||
| Throwable t = new Throwable(originT); | ||
| t.getCause(); | ||
| } | ||
|
|
||
| } |
20 changes: 20 additions & 0 deletions
20
...e/src/main/java/testSuite/classes/overload_constructors_correct/ThrowableRefinements.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,20 @@ | ||
| package testSuite.classes.overload_constructors_correct; | ||
|
|
||
| import liquidjava.specification.StateSet; | ||
| import liquidjava.specification.StateRefinement; | ||
| import liquidjava.specification.ExternalRefinementsFor; | ||
|
|
||
| @StateSet({"start", "hasMessage", "hasCause"}) | ||
| @ExternalRefinementsFor("java.lang.Throwable") | ||
| public interface ThrowableRefinements { | ||
|
|
||
| // ##### Constructors ####### | ||
| @StateRefinement(to="hasMessage(this)") | ||
| public void Throwable(String message); | ||
|
|
||
| @StateRefinement(to="hasCause(this)") | ||
| public void Throwable(Throwable cause); | ||
|
|
||
| @StateRefinement(from="!hasCause(this)", to="hasCause(this)") | ||
| public Throwable initCause(Throwable cause); | ||
| } |
1 change: 1 addition & 0 deletions
1
liquidjava-example/src/main/java/testSuite/classes/overload_constructors_error/.expected
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 @@ | ||
| State Refinement Error |
17 changes: 17 additions & 0 deletions
17
liquidjava-example/src/main/java/testSuite/classes/overload_constructors_error/Test.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,17 @@ | ||
| package testSuite.classes.overload_constructors_error; | ||
|
|
||
| public class Test{ | ||
| void test3(){ | ||
| Throwable t = new Throwable("Example"); | ||
| t.initCause(null); | ||
| t.getCause(); | ||
| } | ||
|
|
||
| void test4(){ | ||
| Throwable originT = new Throwable(); | ||
| Throwable t = new Throwable(originT); | ||
| t.initCause(null);// should be an error but its not | ||
| t.getCause(); | ||
| } | ||
|
|
||
| } |
20 changes: 20 additions & 0 deletions
20
...ple/src/main/java/testSuite/classes/overload_constructors_error/ThrowableRefinements.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,20 @@ | ||
| package testSuite.classes.overload_constructors_error; | ||
|
|
||
| import liquidjava.specification.StateSet; | ||
| import liquidjava.specification.StateRefinement; | ||
| import liquidjava.specification.ExternalRefinementsFor; | ||
|
|
||
| @StateSet({"start", "hasMessage", "hasCause"}) | ||
| @ExternalRefinementsFor("java.lang.Throwable") | ||
| public interface ThrowableRefinements { | ||
|
|
||
| // ##### Constructors ####### | ||
| @StateRefinement(to="hasMessage(this)") | ||
| public void Throwable(String message); | ||
|
|
||
| @StateRefinement(to="hasCause(this)") | ||
| public void Throwable(Throwable cause); | ||
|
|
||
| @StateRefinement(from="!hasCause(this)", to="hasCause(this)") | ||
| public Throwable initCause(Throwable cause); | ||
| } |
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
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.
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.
Instead of adding a fallback everywhere this method is called, where if the lookup by exact parameter types returns
nullwe try to get the function by the number of parameters, we could just call it here: