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

JDK-8290011: IGV: Remove dead code and cleanup #10197

Closed
wants to merge 63 commits into from

Conversation

tobiasholenstein
Copy link
Contributor

@tobiasholenstein tobiasholenstein commented Sep 7, 2022

Cleanup of the code in IGV without changing the functionality.

  • removed dead code (unused classes, functions, variables) from the IGV code base
  • merged (and removed) redundant functions
  • added explicit position arguments to layer.xml - This avoids the position warning during building of IGV
  • ordered the inputs alphabetically, and used wildcards if >= 5 imports of a particular package
  • made class variables final whenever possible
  • removed this. in this.funtion() funciton calls when it was not needed
  • used lambdas instead of anonymous class if possible
  • fixed whitespace issues (e.g. double whitespace)
  • removed not needed copy of RangeSliderModel tempModel in RangeSliderModel.java
  • changed EditorTopComponent to take InputGraph as argument in constructor instead of Diagram and moved the creation of the Diagram to DiagramViewModel.java to increased encapsulation/modularity

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

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10197

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

Using diff file

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

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 4, 2022
@tobiasholenstein
Copy link
Contributor Author

This changeset goes beyond trivial cleanups (removing dead code, trailing whitespace, legacy functionality, etc.), and it would help if you could summarize (and motivate if necessary) the main changes in it.

I found that switching among opened graphs from different groups does not update anymore the highlighted graphs in the Outline window, nor the content of the Bytecode and Control Flow windows. Maybe an effect of splitting #10164?

A few more comments:

  • I would also prefer to leave the toString() methods in, for ease of debugging.
  • Why are some tests in InputGraphTest.java removed? Were they not run before?
  • I agree with enforcing alphabetic order of imports, but I would personally prefer to import explicitly all individual classes rather than using wildcards (matter of taste though, I do not think we have any style guidelines for tools like IGV).
  • Please update the copyright headers, at least for files with non-trivial changes.

Hi @robcasloz ,
I updated the PR to the current master to resolve merge conflicts. Further I re-added toString() and printing functions as well as all the removed tests (InputGraphTest.java).

Regarding wildcards in imports I decided to leave them in since they were already used in the code before. The book Code Complete suggests to use wildcards for imports, whereas the google style guide for java argues against wildcards. I could not find anything in our style-guide, but personally I have no strong opinion on this matter.

I think the copyright headers are updated for all non-trivial changes, or where is it missing?

The PR should now be ready to be reviewed again.
Thanks!

Copy link
Contributor

@robcasloz robcasloz left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my comments, Tobias!

I tested the changeset manually and hit the following exception when placing the mouse pointer on graph edges to show their tooltips:

[INFO] java.lang.ClassCastException: class com.sun.hotspot.igv.view.widgets.InputSlotWidget cannot be cast to class com.sun.hotspot.igv.graph.Figure (com.sun.hotspot.igv.view.widgets.InputSlotWidget is in unnamed module of loader org.netbeans.StandardModule$OneModuleClassLoader @17b716f7; com.sun.hotspot.igv.graph.Figure is in unnamed module of loader org.netbeans.StandardModule$OneModuleClassLoader @6fcf432a)
[INFO] 	at com.sun.hotspot.igv.view.widgets.LineWidget$1.select(LineWidget.java:142)
[INFO] 	at org.netbeans.modules.visual.action.SelectAction.mouseReleased(SelectAction.java:86)
[INFO] 	at org.netbeans.api.visual.widget.SceneComponent$Operator$3.operate(SceneComponent.java:535)
[INFO] 	at org.netbeans.api.visual.widget.SceneComponent.processLocationOperator(SceneComponent.java:250)
[INFO] 	at org.netbeans.api.visual.widget.SceneComponent.mouseReleased(SceneComponent.java:137)
[INFO] 	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
[INFO] 	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6635)
[INFO] 	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
[INFO] 	at java.desktop/java.awt.Component.processEvent(Component.java:6400)
[INFO] 	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
[INFO] 	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
[INFO] 	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
[INFO] 	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
[INFO] 	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
[INFO] 	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
[INFO] 	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
[INFO] 	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
[INFO] 	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
[INFO] 	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
[INFO] 	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
[INFO] 	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
[INFO] 	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
[INFO] 	at java.base/java.security.AccessController.doPrivileged(Native Method)
[INFO] 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
[INFO] 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
[INFO] 	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
[INFO] 	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
[INFO] 	at java.base/java.security.AccessController.doPrivileged(Native Method)
[INFO] 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
[INFO] 	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
[INFO] 	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
[INFO] [catch] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
[INFO] 	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
[INFO] 	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
[INFO] 	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
[INFO] 	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[INFO] 	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

tobiasholenstein and others added 3 commits October 17, 2022 11:08
…pot/igv/data/InputEdge.java


add whitespace

Co-authored-by: Andrey Turbanov <turbanoff@gmail.com>
Co-authored-by: Andrey Turbanov <turbanoff@gmail.com>
Co-authored-by: Andrey Turbanov <turbanoff@gmail.com>
@tobiasholenstein
Copy link
Contributor Author

tobiasholenstein commented Oct 17, 2022

Thanks for addressing my comments, Tobias!

I tested the changeset manually and hit the following exception when placing the mouse pointer on graph edges to show their tooltips:

[INFO] java.lang.ClassCastException: class com.sun.hotspot.igv.view.widgets.InputSlotWidget cannot be cast to class com.sun.hotspot.igv.graph.Figure (com.sun.hotspot.igv.view.widgets.InputSlotWidget is in unnamed module of loader org.netbeans.StandardModule$OneModuleClassLoader @17b716f7; com.sun.hotspot.igv.graph.Figure is in unnamed module of loader org.netbeans.StandardModule$OneModuleClassLoader @6fcf432a)
[INFO] 	at com.sun.hotspot.igv.view.widgets.LineWidget$1.select(LineWidget.java:142)
[INFO] 	at org.netbeans.modules.visual.action.SelectAction.mouseReleased(SelectAction.java:86)
[INFO] 	at org.netbeans.api.visual.widget.SceneComponent$Operator$3.operate(SceneComponent.java:535)
[INFO] 	at org.netbeans.api.visual.widget.SceneComponent.processLocationOperator(SceneComponent.java:250)
[INFO] 	at org.netbeans.api.visual.widget.SceneComponent.mouseReleased(SceneComponent.java:137)
[INFO] 	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
[INFO] 	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6635)
[INFO] 	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
[INFO] 	at java.desktop/java.awt.Component.processEvent(Component.java:6400)
[INFO] 	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
[INFO] 	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
[INFO] 	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
[INFO] 	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
[INFO] 	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
[INFO] 	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
[INFO] 	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
[INFO] 	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
[INFO] 	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
[INFO] 	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
[INFO] 	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
[INFO] 	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
[INFO] 	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
[INFO] 	at java.base/java.security.AccessController.doPrivileged(Native Method)
[INFO] 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
[INFO] 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
[INFO] 	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
[INFO] 	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
[INFO] 	at java.base/java.security.AccessController.doPrivileged(Native Method)
[INFO] 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
[INFO] 	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
[INFO] 	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
[INFO] [catch] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
[INFO] 	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
[INFO] 	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
[INFO] 	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
[INFO] 	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[INFO] 	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Hi @robcasloz ,

This looks like this is https://bugs.openjdk.org/browse/JDK-8294565 ? If so, it was already present before this change-set

is needed to highlight hovered edges
Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

Otherwise, looks good! Thanks for doing the updates from my previous comments!

@openjdk
Copy link

openjdk bot commented Oct 19, 2022

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

8290011: IGV: Remove dead code and cleanup

Reviewed-by: chagedorn

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 218 new commits pushed to 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.

➡️ 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 Oct 19, 2022
tobiasholenstein and others added 6 commits October 19, 2022 14:42
Co-authored-by: Christian Hagedorn <christian.hagedorn@oracle.com>
Co-authored-by: Christian Hagedorn <christian.hagedorn@oracle.com>
Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

Updates look good, thanks!

@tobiasholenstein
Copy link
Contributor Author

@robcasloz , @turbanoff and @chhagedorn thanks for the reviews!

/integrate

@openjdk
Copy link

openjdk bot commented Oct 19, 2022

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

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 19, 2022
@openjdk openjdk bot closed this Oct 19, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 19, 2022
@openjdk
Copy link

openjdk bot commented Oct 19, 2022

@tobiasholenstein Pushed as commit e27bea0.

💡 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
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
4 participants