commons-issues mailing list archives

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

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

Sebb updated BCEL-245:
----------------------
    Description: 
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...

  was:
FindBugs notes that the Type classe 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...


> 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
>
> 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