Skip to content
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

8261606: Surprising behavior of step over in String switch #2569

wants to merge 1 commit into from


Copy link

@lahodaj lahodaj commented Feb 15, 2021

Consider code like:

public class Test {
    public static void main(String... args) {
        new Test().test("a");
    private void test(String s) {
        if (s != null) {
            switch (s) {
                case "a":
                    System.out.println("a"); //breakpoint here, and continue with step-over
                    System.out.println("default"); //the program counter will be shown here eventually
        } else {

Placing breakpoint at the marked line (with System.out.println("a");), running debugger and performing step-over, the execution eventually is shown to stop at the line with System.out.println("default");.

The reason for this is (roughly) because the switch-over-string is desugared into a block, but that block does not have an end position set. So the LineNumberTable point for the closing bracket of the block is not generated, and hence the last previous point is used, which is the last line of the last case (branch) of the switch.

The proposal is to set the end position for the synthetic block generated for the switch-over-string.


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


  • JDK-8261606: Surprising behavior of step over in String switch



$ git fetch pull/2569/head:pull/2569
$ git checkout pull/2569

Copy link

bridgekeeper bot commented Feb 15, 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 Feb 15, 2021
Copy link

openjdk bot commented Feb 15, 2021

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

  • compiler

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 compiler label Feb 15, 2021
Copy link

mlbridge bot commented Feb 15, 2021


Copy link

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

looks sensible

Copy link

openjdk bot commented Feb 17, 2021

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

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

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

8261606: Surprising behavior of step over in String switch

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 78 new commits pushed to the master branch:

  • d547e1a: 8261123: Augment discussion of equivalence classes in Object.equals and comparison methods
  • 2677f6f: 8261675: ObjectValue::set_visited(bool) sets _visited false
  • e7e20d4: 8261711: Clhsdb "versioncheck true" throws NPE every time
  • 55d7bbc: 8261607: SA attach is exceeding JNI Local Refs capacity
  • 0a50688: 8241372: Several test failures due to Connection reset
  • 61a659f: 8260415: Remove unused class ReferenceProcessorMTProcMutator
  • 6b6f794: 8248223: KeyAgreement spec update on multi-party key exchange support
  • 8ba390d: 8261753: Test java/lang/System/ still failing on BigSur patch versions after JDK-8253702
  • 16bd7d3: 8261336: IGV: enhance default filters
  • 3f8819c: 8261501: Shenandoah: reconsider heap statistics memory ordering
  • ... and 68 more:

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 Feb 17, 2021
Copy link
Contributor Author

lahodaj commented Mar 2, 2021


@openjdk openjdk bot closed this Mar 2, 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 Mar 2, 2021
Copy link

openjdk bot commented Mar 2, 2021

@lahodaj Since your change was applied there have been 246 commits pushed to the master branch:

  • be67aaa: 8262726: AArch64: C1 StubAssembler::call_RT can corrupt stack
  • 0f6122b: 8262819: gc/shenandoah/compiler/ fails with release VMs
  • dd33a8e: 8262461: handle wcstombsdmp return value correctly in unix awt_InputMethod.c
  • 3b350ad: 8261710: SA DSO objects have sizes that are too large
  • fdd1093: 8261552: s390: MacroAssembler::encode_klass_not_null() may produce wrong results for non-zero values of narrow klass base
  • f5ab7f6: 8262472: Buffer overflow in UNICODE::as_utf8 for zero length output buffer
  • 6635d7a: 8261670: Add javadoc for the XML processing limits
  • 85b774a: 8255859: Incorrect comments in log.hpp
  • c3eb80e: 8262500: HostName entry in should be a new line
  • 9f0f0c9: 8260933: runtime/cds/serviceability/ fails without CompactStrings
  • ... and 236 more:

Your commit was automatically rebased without conflicts.

Pushed as commit 85a5ae8.

💡 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
compiler integrated Pull request has been integrated
2 participants