Uploaded image for project: 'Commons BCEL'
  1. Commons BCEL
  2. BCEL-245

Type class includes constants that reference subclasses

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0
    • Component/s: None
    • Labels:
      None

      Description

      FindBugs notes that the Type class tries to use the ObjectType class before it has been initialised:

      public static final BasicType CHAR = new BasicType(Constants.T_CHAR);
      public static final ObjectType OBJECT = ObjectType.getInstance("java.lang.Object");
      

      Now both BasicType and ObjectType are sub-classes of Type.
      However FindBugs only complains about the ObjectType call.
      Perhaps this is because it uses a static method?
      The getInstance() method could be replaced with the equivalent:

      public static final ObjectType OBJECT = new ObjectType("java.lang.Object");
      

      But why does FindBugs not complain about the other references?
      Surely BasicType cannot be constructed until Type has been constructed?
      It's not (yet) clear what is going on here...

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sebb@apache.org Sebb
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: