Skip to content

Conversation

@jonath4ndev
Copy link
Contributor

@jonath4ndev jonath4ndev commented Nov 28, 2024

This PR includes a suggested change in behaviour of javap -l without -v or -c.
Previously it was possible to print LineNumberTable and LocalVariableTable without disassembled code output. This didn't make much sense, as there is no context for this output. This PR proposes to output a warning for this case, as well as not print the LineNumberTableand LocalVariableTable attrubutes. They are nested attributes of the CodeAttribute and thus should only be printed if the CodeAttribute is also printed.

Small changes were also made to existing tests, which seem unproblematic to adjust.

Before: `javac -l EmptyLoop`
Compiled from "EmptyLoop.java"
public class EmptyLoop {
  public EmptyLoop();
    Code:
      LineNumberTable:
        line 1: 0

  public void emptyLoop();
    Code:
      LineNumberTable:
        line 3: 0
        line 5: 14
}
After: `javac -l EmptyLoop`
Warning: bad combination of options: -l without -c - line number and local variable tables will not be printed
Compiled from "EmptyLoop.java"
public class EmptyLoop {
  public EmptyLoop();

  public void emptyLoop();
}

Stems from discussion in: #22359


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8345145: Display javap LineNumberTable and LocalVariableTable iff disassembled code output with -c or -v (Enhancement - P5)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22434/head:pull/22434
$ git checkout pull/22434

Update a local copy of the PR:
$ git checkout pull/22434
$ git pull https://git.openjdk.org/jdk.git pull/22434/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22434

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22434.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 28, 2024

👋 Welcome back jonath4ndev! 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
Copy link

openjdk bot commented Nov 28, 2024

@jonath4ndev 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:

8345145: Display javap LineNumberTable and LocalVariableTable iff disassembled code output with `-c` or `-v`

Reviewed-by: mcimadamore, liach

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

  • 3b21a29: 8345175: Further cleanup in java.logging and jdk.internal.logger after JEP 486 integration
  • 7dc00d3: 8345154: IGV: Show Parse and Assertion Predicate type as extra label
  • 1e086b1: 8340103: Add internal set_flag function to VMATree
  • db535c8: 8313367: SunMSCAPI cannot read Local Computer certs w/o Windows elevation
  • edfe285: 8344306: RISC-V: Add zicond

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@mcimadamore, @liach) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot changed the title 8345145 8345145: Display javap LineNumberTable and LocalVariableTable iff disassembled code output with -c or -v Nov 28, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 28, 2024
@openjdk
Copy link

openjdk bot commented Nov 28, 2024

@jonath4ndev The following labels will be automatically applied to this pull request:

  • compiler
  • core-libs

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

@openjdk openjdk bot added core-libs core-libs-dev@openjdk.org compiler compiler-dev@openjdk.org labels Nov 28, 2024
@mlbridge
Copy link

mlbridge bot commented Nov 28, 2024

Webrevs

Copy link
Contributor

@mcimadamore mcimadamore left a comment

Choose a reason for hiding this comment

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

Nice work!

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 28, 2024
@jonath4ndev
Copy link
Contributor Author

Thanks for the review and previous input!
Tier 1-3 testing was successful.

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Nov 28, 2024
@openjdk
Copy link

openjdk bot commented Nov 28, 2024

@jonath4ndev
Your change (at version ed67de0) is now ready to be sponsored by a Committer.

Copy link
Member

@liach liach left a comment

Choose a reason for hiding this comment

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

Looks good. However, note that per our guide https://openjdk.org/guide, we usually integrate after about 24 hours to allow sufficient time for all reviewers. So I may sponsor later.

@jonath4ndev
Copy link
Contributor Author

Looks good. However, note that per our guide https://openjdk.org/guide, we usually integrate after about 24 hours to allow sufficient time for all reviewers. So I may sponsor later.

Oh my bad. Thanks for the heads-up!

@jonath4ndev
Copy link
Contributor Author

I made a change to javap.properties to make this new change in behaviour more clear in the documentation.
I just noticed that there is also javap_de.properties, javap_ja.properties and javap_zh_CN.properties, which I have not touched.

I guess leaving out my change in english might be best, to avoid inconsitency between translations? Likely this extra info doesn't provide much value, as one gets the same insight in the warning.

Note: It seems this approach is taken for other cases of incompatible arguments. For example in the case -public, -protected there is an Error, but no information about the incompatibility in the help output from javap.properties:

javap -l -c -private -public EmptyLoop
Error: bad combination of options: -private -public

@nizarbenalla
Copy link
Member

nizarbenalla commented Nov 28, 2024

While I am not sure, I don't think you should worry about inconsistencies between translations. Looking at JDK-8322041 and JDK-8333827, it seems that the translations are updated by certain people after RDP1 and then are backported.

At least, it seems out of scope for this change.

@liach
Copy link
Member

liach commented Nov 29, 2024

It's been over 24 hours. Thanks for everyone's review and patience!

/sponsor

@openjdk
Copy link

openjdk bot commented Nov 29, 2024

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

  • e9136b5: 8345223: Remove stray doPrivileged in java.base java.net and sun.net classes after JEP 486 integration
  • a80ccf2: 8345039: IGV: save user-defined node colors to XML
  • 28b0f3e: 8343705: IGV: Interactive Node Moving in Hierarchical Layout
  • 4da7c35: 8314512: IGV: clean up hierarchical layout code
  • 6bea1b6: 8344727: [JVMCI] Export the CompileBroker compilation activity mode for Truffle compiler control
  • 8858de3: 8338571: [TestBug] DefaultCloseOperation.java test not working as expected wrt instruction after JDK-8325851 fix
  • ece0401: 8345052: Harden StampedLock
  • 095e769: 8345237: 32-bit Zero builds fail with assert(has_klass_gap()) failed: precondition
  • 1a7a184: 8344293: Remove empty Test files left over from JDK-8305895
  • f2c0d18: 8344989: Test java/foreign/TestLinker.java failed with zero: IllegalStateException: libffi call failed with status: FFI_BAD_TYPEDEF
  • ... and 9 more: https://git.openjdk.org/jdk/compare/d33ad07c32f23aee799750c9964ab26d0cbe56f4...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 29, 2024
@openjdk openjdk bot closed this Nov 29, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Nov 29, 2024
@openjdk
Copy link

openjdk bot commented Nov 29, 2024

@liach @jonath4ndev Pushed as commit ed03f0d.

💡 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

compiler compiler-dev@openjdk.org core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

4 participants