Skip to content

Pointless cast warning #94

@cushon

Description

@cushon

Original issue created by drichter@google.com on 2013-02-26 at 08:59 PM


Casts degrade program readability, and ones that are not automatically removed by the JRE hurt performance.

Here's an example extracted from real code:

class A {}
class B : A {}

List<B> someList;

for (A a : someList) // Line 1
{ ... ((B)a) ... } // Line 2

Line 2 should trigger the warning, citing the needless up-cast on Line 1.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions