[ checkstyle-Bugs-3516686 ] invalid "Conditional logic can be removed"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[ checkstyle-Bugs-3516686 ] invalid "Conditional logic can be removed"

SourceForge.net
Bugs item #3516686, was opened at 2012-04-10 18:03
Message generated for change (Tracker Item Submitted) made by lyashko
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397078&aid=3516686&group_id=29721

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core Framework
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: olegvl (lyashko)
Assigned to: Oliver Burn (oburn)
Summary: invalid "Conditional logic can be removed"

Initial Comment:
Checkstyle is reporting problem:
Check.java:10:16: Conditional logic can be removed

for the sample class as follows

public final class Check {
    private Check() {
    }
    public static boolean checkClass(final Class<?> cls) {
        if (java.sql.Timestamp.class.isAssignableFrom(cls)) {
            return true;
        } else if (String.class.isAssignableFrom(cls)) {
            return true;
        } else {
            return false;
        }
    }
}





----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397078&aid=3516686&group_id=29721

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Checkstyle-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-devel
Reply | Threaded
Open this post in threaded view
|

Re: [ checkstyle-Bugs-3516686 ] invalid "Conditional logic can be removed"

aslfjlasdkfj2
This post has NOT been accepted by the mailing list yet.
else if (String.class.isAssignableFrom(cls)) {
        return true;
} else {
        return false;
}

That's the issue. This could be replaced by:

else {
        return String.class.isAssignableForm(cls);
}