Repository navigation
Fix inherited method resolution for invokespecial #228
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
4 commits
Select commit
Hold shift + click to select a range
d04e3dc
Fix superclass method lookup for invokespecial
dlunch c51a61a
Exercise special resolution errors through Java fixtures
dlunch 048f06c
Use nested class fixtures for special resolution errors
dlunch 3debcd4
Resolve maximally specific inherited interface methods
dlunch 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 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,3 @@ | ||
| java.lang.NoSuchMethodError | ||
| java.lang.IncompatibleClassChangeError | ||
| java.lang.AbstractMethodError |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
|---|---|---|
|
|
@@ -3,3 +3,7 @@ | |
| 2 | ||
| test | ||
| test | ||
| leaf | ||
| test | ||
| 2 | ||
| 2 | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Replace only these targets after compiling SpecialResolutionErrors.java. | ||
| // The stale callers must report linkage errors rather than use inherited | ||
| // constructors, invoke static methods, or execute abstract methods. | ||
| class SpecialResolutionErrors { | ||
| static class ConstructorBase { | ||
| ConstructorBase() {} | ||
| ConstructorBase(int value) {} | ||
| } | ||
|
|
||
| static class ConstructorChild extends ConstructorBase { | ||
| ConstructorChild() {} | ||
| } | ||
|
|
||
| static class StaticBase { | ||
| static int method() { return 1; } | ||
| } | ||
|
|
||
| static abstract class AbstractBase { | ||
| abstract int method(); | ||
| } | ||
| } |
56 changes: 56 additions & 0 deletions
56
test-data/src/special-resolution/SpecialResolutionErrors.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,56 @@ | ||
| // Rebuild from the repository root with JDK 22 or newer: | ||
| // classes=$(mktemp -d) | ||
| // javac --release 22 -d test-data test-data/src/special-resolution/SpecialResolutionErrors.java | ||
| // javac --release 22 -d "$classes" test-data/src/special-resolution/RuntimeTargets.java | ||
| // cp "$classes"/'SpecialResolutionErrors$ConstructorChild.class' test-data/ | ||
| // cp "$classes"/'SpecialResolutionErrors$StaticBase.class' test-data/ | ||
| // cp "$classes"/'SpecialResolutionErrors$AbstractBase.class' test-data/ | ||
| // rm -r "$classes" | ||
| public class SpecialResolutionErrors { | ||
| public static void main(String[] args) { | ||
| try { | ||
| new ConstructorChild(1); | ||
| } catch (NoSuchMethodError e) { | ||
| System.out.println(e.getClass().getName()); | ||
| } | ||
| try { | ||
| new StaticChild().call(); | ||
| } catch (IncompatibleClassChangeError e) { | ||
| System.out.println(e.getClass().getName()); | ||
| } | ||
| try { | ||
| new AbstractChild().call(); | ||
| } catch (AbstractMethodError e) { | ||
| System.out.println(e.getClass().getName()); | ||
| } | ||
| } | ||
| static class ConstructorBase { | ||
| ConstructorBase() {} | ||
| ConstructorBase(int value) {} | ||
| } | ||
|
|
||
| static class ConstructorChild extends ConstructorBase { | ||
| ConstructorChild(int value) { super(value); } | ||
| } | ||
|
|
||
| static class StaticBase { | ||
| int method() { return 1; } | ||
| } | ||
|
|
||
| static class StaticParent extends StaticBase {} | ||
|
|
||
| static class StaticChild extends StaticParent { | ||
| int call() { return super.method(); } | ||
| } | ||
|
|
||
| static class AbstractBase { | ||
| int method() { return 1; } | ||
| } | ||
|
|
||
| static class AbstractParent extends AbstractBase {} | ||
|
|
||
| static class AbstractChild extends AbstractParent { | ||
| int method() { return 2; } | ||
| int call() { return super.method(); } | ||
| } | ||
| } |
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.