[pmd-devel] [ pmd-Bugs-2023757 ] BeanMembersShouldSerialize doesn't understand boolean naming
A source code analyzer
Brought to you by:
adangel,
juansotuyo
From: SourceForge.net <no...@so...> - 2010-04-24 03:23:03
|
Bugs item #2023757, was opened at 2008-07-21 17:02 Message generated for change (Comment added) made by sf-robot You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=479921&aid=2023757&group_id=56262 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: pmd Group: None >Status: Closed Resolution: None Priority: 5 Private: No Submitted By: Don Kirkby (imfurry) Assigned to: Nobody/Anonymous (nobody) Summary: BeanMembersShouldSerialize doesn't understand boolean naming Initial Comment: Bug 962782 seems to have reappeared or still be present in PMD for Eclipse 3.2.4.v200804111600. This class breaks the rule: package com.pets; public class Dog { private boolean isCute; /** * @return the isCute */ public boolean isCute() { return isCute; } /** * @param isCute the isCute to set */ public void setCute(boolean isCute) { this.isCute = isCute; } } This class doesn't break the BeanMembersShouldSerialize rule, but does break BooleanGetMethodName. package com.pets; public class Cat { private boolean isCute; /** * @return the isCute */ public boolean getIsCute() { return isCute; } /** * @param isCute the isCute to set */ public void setIsCute(boolean isCute) { this.isCute = isCute; } } ---------------------------------------------------------------------- >Comment By: SourceForge Robot (sf-robot) Date: 2010-04-24 02:20 Message: This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 500 days (the time period specified by the administrator of this Tracker). ---------------------------------------------------------------------- Comment By: Jan Ruzicka (ruza) Date: 2009-08-19 21:38 Message: can this issue be be updated to be marked as false positive? Other issues seem to use False + for start of title. ---------------------------------------------------------------------- Comment By: Romain PELISSE (rpelisse) Date: 2008-12-09 23:21 Message: hum, no answer to Xavier on this one... Set this entry to pending. ---------------------------------------------------------------------- Comment By: Xavier Le Vourch (xlv) Date: 2008-09-02 20:02 Message: Logged In: YES user_id=1373398 Originator: NO I implemented a fix but I'm not sure it should be changed as the field has the same name as the method and triggers AvoidFieldNameMatchingMethodName. Maybe we should just document the fact that a boolean field is not supposed to start with "is"? The original fix for bug 962782 deals with the field named "cute" instead of "isCute". ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=479921&aid=2023757&group_id=56262 |