Skip to content

8272135: jshell: Method cannot use its overloaded version #5111

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

Closed
wants to merge 1 commit into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Aug 13, 2021

Consider separate snippets like:

int m(int i) { return 1; }

and:

int m(String s) { return m(0); }

If these are independent snippets, JShell will currently compile first the first snippet (say into class called A), and then the second snippet. The actual code for the second snippet will be in this direction:

import static A.m;
public class B {
    int m(String s) { return m(0); }
}

Note that here the method resolution, when seeing method name m, will not see the m(int) method at all, as the lookup will stop on the current class' method called m and will never proceed to look at the m method from the first snippet/class A.

JShell generally tries to coalescence processing of overloading methods (in the Unit.setWrap method), but the overloaded methods must be together part of the input, which is not the case in the above example.

The proposed solution is to detect the possibility of the above situation (call of a method that has the same name as the current snippet's method), and add all same-named overloads to the processing set.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8272135: jshell: Method cannot use its overloaded version

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5111/head:pull/5111
$ git checkout pull/5111

Update a local copy of the PR:
$ git checkout pull/5111
$ git pull https://git.openjdk.java.net/jdk pull/5111/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5111

View PR using the GUI difftool:
$ git pr show -t 5111

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5111.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 13, 2021

👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 13, 2021
@openjdk
Copy link

openjdk bot commented Aug 13, 2021

@lahodaj The following label will be automatically applied to this pull request:

  • kulla

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the kulla kulla-dev@openjdk.org label Aug 13, 2021
@mlbridge
Copy link

mlbridge bot commented Aug 13, 2021

Webrevs

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@openjdk
Copy link

openjdk bot commented Aug 18, 2021

@lahodaj This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8272135: jshell: Method cannot use its overloaded version

Reviewed-by: vromero

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 101 new commits pushed to the master branch:

  • 96107e3: 8272573: Redundant unique_concrete_method_4 dependencies
  • 4d6593c: 8272124: Cgroup v1 initialization causes NullPointerException when cgroup path contains colon
  • 30b0f82: 8272626: Avoid C-style array declarations in java.*
  • e8f1219: 8271276: C2: Wrong JVM state used for receiver null check
  • 79a06df: 8272567: [IR Framework] Make AbstractInfo.getRandom() static
  • 481c1f0: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked
  • 5189047: 8272558: IR Test Framework README misses some flags
  • ec63957: 8272398: Update DockerTestUtils.buildJdkDockerImage()
  • 14623cd: 8270835: regression after JDK-8261006
  • fe72197: 8272551: mark hotspot runtime/modules tests which ignore external VM flags
  • ... and 91 more: https://git.openjdk.java.net/jdk/compare/a86ac0d1e3a6f02e587362c767abdf62b308d321...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 18, 2021
@lahodaj
Copy link
Contributor Author

lahodaj commented Sep 7, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Sep 7, 2021

Going to push as commit 70157c7.
Since your change was applied there have been 271 commits pushed to the master branch:

  • 5caa77b: 8263364: sun/net/www/http/KeepAliveStream/KeepAliveStreamCloseWithWrongContentLength.java wedged in getInputStream
  • a522d6b: 8273376: Zero: Disable vtable/itableStub gtests
  • 3cd95a2: 8231356: Fix broken ResourceObj::operator new[] in debug builds
  • 81c719b: 8273333: Zero should warn about unimplemented -XX:+LogTouchedMethods
  • 649c22c: 8270832: Aarch64: Update algorithm annotations for MacroAssembler::fill_words
  • eb22181: 8273386: Remove duplicated code in G1DCQS::abandon_completed_buffers
  • fc546d6: 8273378: Shenandoah: Remove the remaining uses of os::is_MP
  • 7bd4f49: 8264207: CodeStrings does not honour fixed address assumption.
  • 2cabec8: 8253343: Extract G1 Young GC algorithm related code from G1CollectedHeap
  • 44c5c23: 8272164: DumpAllocStats shouldn't subclass from ResourceObj
  • ... and 261 more: https://git.openjdk.java.net/jdk/compare/a86ac0d1e3a6f02e587362c767abdf62b308d321...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Sep 7, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 7, 2021
@openjdk
Copy link

openjdk bot commented Sep 7, 2021

@lahodaj Pushed as commit 70157c7.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated kulla kulla-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

2 participants