Use Class.isInstance instead of Class.isAssignableFrom where applicable

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P5
    • 19
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • b24

      Method `Class.isAssignableFrom` is often used in form of:

          if (clazz.isAssignableFrom(obj.getClass())) {

      Such condition could be simplified to more shorter and performarnt code

          if (clazz.isInstance(obj)) {
          
      Replacement is equivalent if it's known that `obj != null`.
      In JDK codebase there are many such places.

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

              Created:
              Updated:
              Resolved: