Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8289126

Cleanup unnecessary null comparison before instanceof check in jdk.hotspot.agent

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P5
    • 20
    • None
    • hotspot
    • b04

    Description

      Update code checks both non-null and instance of a class in jdk.hotspot.agent module classes.
      The checks and explicit casts could also be replaced with pattern matching for the instanceof operator.
      For example:
          The following code:
                    Object node = tree.getLastSelectedPathComponent();
                    if (node != null && node instanceof SimpleTreeNode) {
                      showInspector((SimpleTreeNode)node);
                    }
          Can be simplified to:
                    Object node = tree.getLastSelectedPathComponent();
                    if (node instanceof SimpleTreeNode simpleNode) {
                      showInspector(simpleNode);
                    }

      Attachments

        Issue Links

          Activity

            People

              aturbanov Andrey Turbanov
              aturbanov Andrey Turbanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: