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

Dead code: Methods isNullOrReference() in Type class and all subclasses (Type.java) are not in use

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8, 9
    • Fix Version/s: 9
    • Component/s: tools
    • Subcomponent:
    • Introduced In Version:
      9

      Description

      Only the point javac called these methods was the class/method:
       src/share/classes/com/sun/tools/javac/comp/Check.java
       method checkNullOrRefType(DiagnosticPosition pos, Type t)

      The methods isNullOrReference() in Type.java was initially introduced in revision:

      changeset: 1373:c002fdee76fd
      user: jjg
      date: Thu Oct 25 11:09:36 2012 -0700
      summary: 7200915: convert TypeTags from a series of small ints to an enum

      It was used in Check.checkNullOrRefType method:

           Type checkNullOrRefType(DiagnosticPosition pos, Type t) {
               if (t.isNullOrReference())
                   return t;
               else
                   return typeTagError(pos,
                                       diags.fragment("type.req.ref"),
                                       t);
           }

      This code was in use up to revision:

      changeset: 1825:9851071b551a
      user: vromero
      date: Tue Jun 18 19:02:48 2013 +0100
      summary: 8016267: javac, TypeTag refactoring has provoked performance issues

      After this change method checkNullOrRefType() looks this way:

          Type checkNullOrRefType(DiagnosticPosition pos, Type t) {
              if (t.isReference() || t.hasTag(BOT))
                  return t;
              else
                  return typeTagError(pos,
                                      diags.fragment("type.req.ref"),
                                      t);
          }

      That is isNullOrReference() call gone from the code. It is not a part of public API. So methods isNullOrReference() in Type class and all subclasses are not in use anymore and could be removed.

        Attachments

          Activity

            People

            • Assignee:
              vromero Vicente Arturo Romero Zaldivar
              Reporter:
              spikalev Sergei Pikalev (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: