RFR: JDK-8290011: IGV: Remove dead code and cleanup [v20]

Christian Hagedorn chagedorn at openjdk.org
Wed Oct 19 12:36:22 UTC 2022


On Mon, 17 Oct 2022 15:40:59 GMT, Tobias Holenstein <tholenstein at openjdk.org> wrote:

>> 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
>
> Tobias Holenstein has updated the pull request incrementally with one additional commit since the last revision:
> 
>   re-add ConnectionSet class
>   
>   is needed to highlight hovered edges

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

src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterInputSlotNode.java line 105:

> 103:     public Dimension getSize() {
> 104:         int SIZE = 0;
> 105:         return new Dimension(SIZE, SIZE);

You could directly inline `SIZE`:
Suggestion:

        return new Dimension(0, 0);

src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/ClusterOutputSlotNode.java line 106:

> 104:     public Dimension getSize() {
> 105:         int SIZE = 0;
> 106:         return new Dimension(SIZE, SIZE);

Suggestion:

        return new Dimension(0, 0);

src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/DiagramScene.java line 466:

> 464:     private JScrollPane getScrollPane() {
> 465:         return scrollPane;
> 466:     }

You could directly replace the usages of `getScrollPane()` inside this class by a field access to `scrollPane`.

src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/DiagramScene.java line 1245:

> 1243:     private boolean getUndoRedoEnabled() {
> 1244:         return undoRedoEnabled;
> 1245:     }

You could directly modify the field instead of going over the private setter/getter.

-------------

Marked as reviewed by chagedorn (Reviewer).

PR: https://git.openjdk.org/jdk/pull/10197


More information about the hotspot-compiler-dev mailing list