commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (BCEL-245) Type class includes constants that reference subclasses
Date Sun, 23 Aug 2015 22:37:46 GMT

     [ https://issues.apache.org/jira/browse/BCEL-245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sebb resolved BCEL-245.
-----------------------
       Resolution: Fixed
    Fix Version/s: 6.0

Findbugs seems to be happy with the following fix:

URL: http://svn.apache.org/r1697218
Log:
BCEL-245 FindBugs: class may not have been constructed warning when using getInstance

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/Type.java

URL: http://svn.apache.org/r1697271
Log:
BCEL-245 Type class includes constants that reference subclasses

Modified:
    commons/proper/bcel/trunk/src/changes/changes.xml



> Type class includes constants that reference subclasses
> -------------------------------------------------------
>
>                 Key: BCEL-245
>                 URL: https://issues.apache.org/jira/browse/BCEL-245
>             Project: Commons BCEL
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 6.0
>
>
> FindBugs notes that the Type class tries to use the ObjectType class before it has been
initialised:
> {code}
> public static final BasicType CHAR = new BasicType(Constants.T_CHAR);
> public static final ObjectType OBJECT = ObjectType.getInstance("java.lang.Object");
> {code}
> 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:
> {code}
> public static final ObjectType OBJECT = new ObjectType("java.lang.Object");
> {code}
> 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...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message