fb-contrib: Bug Descriptions

ABC_ARRAY_BASED_COLLECTIONS
method passes an array as the key to a Map, element in a Set, or item in a List when the contains method is used on the List. Since arrays do not, and cannot override the equals method, collection inclusion is based on the reference's address, which is probably not desired. In the case that this is a TreeMap or TreeSet, consider passing a Comparator to the map's constructor.
ACEM_ABSTRACT_CLASS_EMPTY_METHODS
method is empty or merely throws an exception. Since the class it is defined in is abstract, it may be more correct to define this method as abstract instead, so that proper subclass behavior is enforced.
AFBR_ABNORMAL_FINALLY_BLOCK_RETURN
class returns or throws exceptions from a finally block. This will mask real program logic in the try block, and short-circuit normal method termination.
AOM_ABSTRACT_OVERRIDDEN_METHOD
abstract method is derived from a concrete method implementation. It is highly suspect that the super class method's implementation would be cast away.
AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE
method uses a one element array to wrap an object that is to be past to a method as an argument to simulate call by pointer ala C++. It is better to define a proper return class type that holds all the relevant information retrieved from the called method.
BAS_BLOATED_ASSIGNMENT_SCOPE
IS DETECTOR IS HIGHLY EXPERIMENTAL AND IS LIKELY TO CREATE A LOT OF FUD</b> This method assigns a value to a variable in an outer scope compared to where the variable is actually used. Assuming this evaluation does not have side effects, the assignment can be moved into the inner scope (if block) so that its execution time isn't taken up if the if guard is false. Care should be taken however that the right hand side of the assignment does not contain side effects that are required to happen, or that changes are not made further down that will effect the execution of the assignment when done later on.
BSB_BLOATED_SYNCHRONIZED_BLOCK
methods implements a synchronized block, but the code found at the beginning of this block only accesses local variables, and not member variables, or this. To be better performance move the code that access local variables only, above the synchronized block, and leave the synchronized block only for field accesses, or access to this object.
CAO_CONFUSING_AUTOBOXED_OVERLOADING
class defines two methods that differ only by a parameter being defined as Character vs. int, long, float or double. As autoboxing is present, it may be assumed that a parameter of 'a' would map to the Character version, but does not.
CBX_CUSTOM_BUILT_XML
method generates an xml based string by concatenating together various xml fragments, and variable values. Doing so makes the code difficult to read, modify and validate. It is much more clean to built xml structures in external files that are read in and transformed into the final product, thru modification by Transformer.setParameter.
CC_CYCLOMATIC_COMPLEXITY
method has a high cyclomatic complexity figure, which calculates the number of branch points. It is likely difficult to test, and is brittle to change. Consider refactoring this method into several to reduce the risk.
CE_CLASS_ENVY
IS DETECTOR IS HIGHLY EXPERIMENTAL AND IS LIKELY TO CREATE A LOT OF FUD</b></p> <p>This method makes extensive use of methods from another class over methods of it's own class. Typically this means that the functionality that is accomplished by this method most likely belongs with the class that is being used so liberally. Consider refactoring this method to be contained in that class, and to accept all the parameters needed in the method signature.
CFS_CONFUSING_FUNCTION_SEMANTICS
method appears to modify a parameter, and then return this parameter as the methods return value. This will be confusing to callers of this method, as it won't be apparent that the 'original' passed in parameter will be changed as well. If the purpose of this method is to change the parameter, it would be more clear to change the method to a have a void return value. If a return type is required due to interface or superclass contract, perhaps a clone of the parameter should be made.
CLI_CONSTANT_LIST_INDEX
method accesses an array or list using a constant integer index. Often, this is a typo where a loop variable is intended to be used. If however, specific list indices mean different specific things, then perhaps replacing the list with a first-class object with meaningful accessors would make the code less brittle.
COM_COPIED_OVERRIDDEN_METHOD
method is implemented using an exact copy of it's super class method's implementation, which usually means that this method can just be removed.
DDC_DOUBLE_DATE_COMPARISON
method compares dates with two comparisons, rather than using the reverse comparison. So This pattern <pre> if ((date1.equals( date2 )) || (date1.after( date2 ))) </pre> could become <pre> if (!date2.before( date1 )) </pre> and <pre> if ((date1.equals( date2 )) || (date1.before( date2 ))) </pre> could become <pre> if (!date2.after( date1 )) </pre> and <pre> if ((date1.before( date2 )) || (date1.after( date2 ))) </pre> could become <pre> if (!date1.equals( date2 )) </
DLC_DUBIOUS_LIST_COLLECTION
class defines a field based on java.util.List, but uses it to some extent like a Set. Since lookup type operations are performed using a linear search for Lists, the performance for large Lists will be poor. Consider changing this fields implementation to a set based one. If order of iteration is important to maintain insert order, perhaps consider a LinkedHashSet.
DRE_DECLARED_RUNTIME_EXCEPTION
method declares a RuntimeException derived class in it's throws clause. This may indicate a misunderstanding as to how unchecked exceptions are handled. If is felt that a RuntimeException is so prevalent that it should be declared, it is probably a better idea to prevent the occurance in code.
DWI_DELETING_WHILE_ITERATING
method removes items from a collection using the remove method of the collection, while at the same time iterating across the collection. Doing this will invalidate the iterator, and further use of it, will cause ConcurrentModificationExceptions to be thrown. To avoid this, the remove method of the iterator should be used.
DWI_MODIFYING_WHILE_ITERATING
method modifies the contents of a collection using the collection api methods, while at the same time iterating across the collection. Doing this will invalidate the iterator, and further use of it, will cause ConcurrentModificationExceptions to be thrown.
EXS_EXCEPTION_SOFTENING_NO_CHECKED
method's exception signature is constrained by an interface or super class to not throw any checked exceptions. Therefore a caught checked exception was converted to an unchecked exception and thrown. However it appears that the class in question is owned by the same author as the constraining interface or superclass. Consider changes the signature of this method to include the checked exception.
EXS_EXCEPTION_SOFTENING_HAS_CHECKED
method's exception signature is constrained by an interface of super class to not throw a checked exception that was caught. Therefore this exception was converted to an unchecked exception and thrown. It would probably be better to throw the closest checked exception allowed, and to annotate the new exception with the original exception using the initial cause field.
EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS
method is not constrained by an interface or superclass, but converts a caught checked exception to unchecked exception and thrown. It would be more appropriate just throw the checked exception, adding the exception to the throws clause of the met
FCBL_FIELD_COULD_BE_LOCAL
class defines fields that are used in a locals only fashion, specifically private fields or protected fields in final classes that are accessed first in each method with a store vs. a load. This field could be replaced by one or more local variables.
FP_FINAL_PARAMETERS
method correctly does not write to a parameter. To help document this, and to perhaps help the jvm optimize the invocation of this method, you should consider defining these parameters as final.
FPL_FLOATING_POINT_LOOPS
method uses floating point variables to index a loop. Since floating point math is inprecise, rounding errors will accumulate over time each time the loop is executed. It is usually better to use integer indexing, and calculate the new value of the floating point number at the top of the loop body.
FPL_FLOATING_POINT_LOOPS
method uses floating point variables to index a loop. Since floating point math is inprecise, rounding errors will accumulate over time each time the loop is executed. It is usually better to use integer indexing, and calculate the new value of the floating point number at the top of the loop body.
ISB_EMPTY_STRING_APPENDING
method concatenates an empty string with a literal value, in order to convert the literal value into a string. It is more efficient to use String.valueOf() to do the same thing as you do not incur the cost of creating a StringBuffer/Builder and calling methods on it to accomplish this.
ISB_INEFFICIENT_STRING_BUFFERING
method uses StringBuffer or StringBuilder append to concatenate strings. However, it passes the result of doing a simple String concatenation to one of these append calls, thus removing any performance gains of using the StringBuffer or StringBuilder class.
ITC_INHERITANCE_TYPE_CHECKING
method uses the instanceof operator in a series of if/else statements to differentiate blocks of code based on type. If these types are related by inheritance, it is cleaner to just define a method in the base class, and use overridden methods in these classes.
JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT
method asserts that a value is equal to true or false. It is simpler to just use assertTrue, or assertFalse, instead.
JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE
method calls assert with two doubles or Doubles. Due to the inprecision of doubles, you should be using the assert method that takes a range parameter that gives a range of error.
JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT
method calls assert passing a constant value as the second of the two values. The assert method assumes that the expected value is the first parameter, and so it appears that the order of values has been swapped here.
JVR_JDBC_VENDOR_RELIANCE
method uses jdbc vendor specific classes and method to perform database work. This makes the code specific to this vendor, and unable to run on other databases.
LEST_LOST_EXCEPTION_STACK_TRACE
method catches an exception, and throws a different exception, without incorporating the original exception. Doing so hides the original source of the exception making debugging and fixing these problems difficult. It is better to use the constructor of this new exception that takes an original exception so that this detail can be passed along to the user.
LII_LIST_INDEXED_ITERATING
method uses an integer based for loop to iterator over a java.util.List, by calling List.get(i) each time thru the loop. The integer is not used for other reasons. It is better to use an Iterator instead, as depending on List implementation, iterators can perform better, and they also allow for exchanging of other collection types without issue.
LSC_LITERAL_STRING_COMPARISON
method calls the equals or compareTo methods on a String variable passing in a String literal. A NullPointerException may occur if the string variable is null. If instead the method was called on the string literal, and the variable was passed as an argument, this exception could never happen.
LSYC_LOCAL_SYNCHRONIZED_COLLECTION
method creates a synchronized collection and store the reference to it in a local variable. As local variables are by definition threadsafe, it seems questionable that this collection needs to be synchronized.</p> <p> <table> <tr><th>If you are using</th><th>consider using</th></tr> <tr><td>java.util.Vector</td><td>java.util.ArrayList</td></tr> <tr><td>java.util.Hashtable</td><td>java.util.HashMap</td></tr> <tr><td>java.lang.StringBuffer</td><td>java.lang.StringBuilder</td></tr> </table>
MAC_MANUAL_ARRAY_COPY
method copies data from one array to another manually using a loop. It is much better performing to use System.arraycopy as this method is native.
MOM_MISLEADING_OVERLOAD_MODEL
class 'overloads' the same method with both an instance and static version. As the use of these two models is different, it will be confusing to the users of these methods.
MRC_METHOD_RETURNS_CONSTANT
private or static method only returns one constant value. As this method is private or static, it's behavior can't be overridden, and thus the return of a constant value seems dubious. Either the method should be changed to return no value, or perhaps another return value was expected to be returned in another code path in this method.
NAB_NEEDLESS_BOXING_VALUEOF
method passes a String to a wrapped primitive object's parse method, which in turn calls the valueOf() method to convert to a boxed primitive. When it is desired to convert from a String to a boxed primitive object, it is simpler to use the BoxedPrimitive.valueOf(myString) method.
NAB_NEEDLESS_BOXING_PARSE
method passes a String to a wrapped primitive object's valueOf method, which in turn calls the boxedValue() method to convert to a primitive. When it is desired to convert from a String to a primitive value, it is simpler to use the BoxedPrimitive.parseBoxedPrimitive(myString) method.
NAB_NEEDLESS_BOX_TO_CAST
method constructs a Boxed Primitive from a primitive only to call the primitiveValue() method to cast the value to another primitive typee. It is simpler to just use casting</p> <pre> primitive i = new BoxedPrimitive(1.0).primitiveValue(); or primitive i = BoxedPrimitive.valueOf(1.0).primitiveValue(); should just use primitive i = (primitive)1.0; </
NAB_NEEDLESS_BOX_TO_UNBOX
method constructs a Boxed Primitive from a primitive only to call the primitiveValue() method to convert it back to a primitive. Just use the primitive value instead.</p> <pre> primitive i = new BoxedPrimitive(1).primitiveValue(); or primitive i = BoxedPrimitive.valueOf(1).primitiveValue(); should just use primitive i = 1; </
NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION
method assigns a Boxed boolean constant to a primitive boolean variable, or assigns a primitive boolean constant to a Boxed boolean variable. Use the correct constant for the variable desired. Use</p> <pre> boolean b = true; boolean b = false; or Boolean b = Boolean.TRUE; Boolean b = Boolean.FALSE; </
NAB_NEEDLESS_BOXING_STRING_CTOR
method passes a primitive value retrieved from a BoxedPrimitive.parseBoxedPrimitive("1") call to the same class's constructor. It is simpler to just pass the string to the BoxedPrimitives constructor.
NAB_NEEDLESS_AUTOBOXING_CTOR
method passes a wrapped primitive object to the same class's constructor. Since wrapper classes are immutable, you can just use the original object, rather than constructing a new one. This code works because of an abuse of autoboxing.
NAB_NEEDLESS_AUTOBOXING_VALUEOF
method passes a wrapped primitive object to the same class's .valueOf method. Since wrapper classes are immutable, you can just use the original object, rather than calling valueOf to create a new one. This code works because of an abuse of autoboxing.
NCMU_NON_COLLECTION_METHOD_USE
method makes calls to collection classes where the method is not defined by the Collections interface, and an equivalent method exists in the interface. By using the new methods, you can define this object by the Collections interface and allow better decoupling.
NCS_NEEDLESS_CUSTOM_SERIALIZATION
method implements the Serializable interface by performing the same operations that would be done if this method did not exist. Since this is the case, this method is not needed.
NIR_NEEDLESS_INSTANCE_RETRIEVAL
method calls a method to load a reference to an object, and then only uses it to load a static member of that instance's class. It is simpler and better performant to just load the static field from the class itself.
NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION
class defines a private collection member as synchronized. It appears however that this collection isn't only modified in a static initializer, or constructor. As these two areas are guaranteed to be thread safe, defining this collection as synchronized is unnecessary and a potential performance bottleneck.
NOS_NON_OWNED_SYNCHRONIZATION
method uses a synchronize block where the object that is being synchronized on, is not owned by this current instance. This means that other instances may use this same object for synchronization for its own purposes causing synchronization confusion. It is always cleaner and safer to only synchronize on private fields of this class. Note that 'this' is not owned by the current instance, but is owned by whomever assigns it to a field of its class. Synchronizing on 'this' is also not a good idea.
NRTL_NON_RECYCLEABLE_TAG_LIB
Tag library class implements an attribute who's associated backing store field is modified at another point in the tag library. In order for a taglibrary to be recycleable, only the container is allowed to change this attribute, through the use of the setXXX method of the taglib. By modifying the value programmatically, the container will not initialize the attribute correctly on reuse.
OCP_OVERLY_CONCRETE_PARAMETER
method uses concrete classes for parameters when only methods defined in an implemented interface or super class are used. Consider increasing the abstraction of the interface to make low impact changes easier to accomplish in the future.
ODN_ORPHANED_DOM_NODE
method creates a DOM node but does not attach it to a DOM document.
PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS
constructor makes a call to a non-final method. Since this method can be overriden, a subclasses implementation will be executing against an object that has not been initialized at the subclass level. You should mark all methods called from the constructor as final to avoid this problem.
PIS_POSSIBLE_INCOMPLETE_SERIALIZATION
method implements Serializable but is derived from a class that does not. The super class has fields that are not serialized because this class does not take the responsibility of writing these fields out either using Serializable's writeObject method, or Externalizable's writeExternal method. Therefore when this class is read from a stream, the superclass fields will only be initialized to the values specified in it's default constructor. If possible, change the superclass to implement Serializable, or implement Serializable or Externalizable methods in the child class.
PL_PARALLEL_LISTS
class appears to maintain two or more lists or arrays who's contains is related one-for-one through the index of the list or array. Consider creating a separate class to hold all the related pieces of information, and adding instances of this class to just one list or array.
PMB_POSSIBLE_MEMORY_BLOAT
class defines static fields that are collections or StringBuffers that do not appear to have any way to clear or reduce their size. This is a potential cause of memory bloat.
PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS
method makes two consecutive calls to the same method using the same constant parameters, on the same instance without any intervening changes to the objects. If this method does not make changes to the object, which it appears it doesn't, then making two calls is just a waste. These method calls could be combined by assigning the result into a temporary, and using the temporary the second t
S508C_NON_ACCESSIBLE_JCOMPONENT
class extends the JComponent gui control but does not implement the Accessibility interface. This makes this control unable to be processed by screen readers, etc, for people with reading/vision difficulties
S508C_NULL_LAYOUT
class passes null to setLayout, which specifies that components are to be laid out using absolute coordinates. This makes making changes for font sizes, etc, difficult as items will not reposition
S508C_NO_SETLABELFOR
class uses JLabels that do not specify what fields are being labeled. This hampers screen readers from given appropriate feed back to users. Use the JLabel.setLabelFor method to accomplish this.
S508C_SET_COMP_COLOR
method sets a Components explicitly foreground or background color which may cause difficulty with people with vision problems from using this application. Colors should be allowed to be set from the operating system.
S508C_NO_SETSIZE
class creates a window, and sizes the window using setSize. It is better to handle font size changes to use the pack method.
SACM_STATIC_ARRAY_CREATED_IN_METHOD
method creates an array initialized by constants. Each time this method is called this array will be recreated. It would be more performant to define the array as a static field of the class instead.
SCA_SUSPICIOUS_CLONE_ALGORITHM
lone method stores a value to a member field of the source object. Normally, all changes are made to the cloned object, and given that cloning is almost always considered a read-only operation, this seems incorrect.
SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR
class declares that it implements an interface, but does so by relying on methods supplied by superclasses, even though those superclasses know nothing about the interface in question. If you wish to have the child not implement all the methods of the interface, it would probably be better to declare the superclass as implementing the interface, and if that class does not provide all the methods, then declare that superclass abstract.
SCI_SYNCHRONIZED_COLLECTION_ITERATORS
method uses a synchronized collection, built from Collections.synchronizedXXXX, but accesses it through an iterator. Since an iterator is by definition, multithreaded unsafe, this is a conflict in concept. When using iterators, you should do the synchronization manually.
SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR
class declares that it implements an interface, but does so by relying on methods supplied by superclasses, even though those superclasses know nothing about the interface in question. If you wish to have the child not implement all the methods of the interface, it would probably be better to declare the superclass as implementing the interface, and if that class does not provide all the methods, then declare that superclass abstract.
SCR_SLOPPY_CLASS_REFLECTION
method accesses the class object of a class that is already statically bound in this context, with Class.forName. Using Class.forName makes reflection more fragile in regards to code transformations such as obfuscation, and is unneeded here, since the class in question is already 'linked' to this class.
SG_SLUGGISH_GUI
method implements an awt or swing listener and performs time consuming operations. Doing these operations in the gui thread will cause the interface to appear sluggish and non-responsive to the user. Consider using a separate thread to do the time consuming work so that the user has a better experience.
SIL_SQL_IN_LOOP
method executes sql queries inside of a loop. This pattern is often inefficient as the number of queries may mushroom in fencepost cases. It is probably more performant to loop over the input and collect the key data needed for the query for all items, and issue one query using an in clause, or similar construct, and then loop over this result set, and fetch all the data at once.
SJVU_SUSPICIOUS_JDK_VERSION_USE
method calls a method that does not exist, on a class that does not exist in the jdk that this class has been compiled for. This can happen if you compile the class specifying the -source and -target options, and use a version that is before the version of the compiler's JDK.
SMII_STATIC_METHOD_INSTANCE_INVOCATION
method makes a static method call on an instance reference. For reading comprehension of the code is better to call the method on the class, rather than an instance. Perhaps this method's static nature has changed since this code was written, and should be revisited.
SPP_NO_CHAR_SB_CTOR
method constructs a StringBuffer or a StringBuilder using the constructor that takes an integer, but appears to pass a character instead. It is probable that the author assumed that character would be appended to the StringBuffer/Builder, but instead the integer value of the character is used as an initial size for the buffer.
SPP_STUTTERED_ASSIGNMENT
method assigns a value twice in a row in a stuttered way such as <code>a = a = 5;</code> This is most probably a cut and paste error where the duplicate assignment can be removed.
SPP_EQUALS_ON_ENUM
method calls the equals(Object) method on an enum instance. Since enums values are singletons, you can use == to safely compare two enum values. In fact, the implementation for Enum.equals does just that.
SPP_INTERN_ON_CONSTANT
method calls intern on a constant string. As constant strings are already interned, this call is superfluous
SPP_USE_ISNAN
method compares a douhle or float to the constant Double.NaN or Float.NaN. You should use Double.isNaN(d) or Float.isNaN(f) if a primitive; or d.isNaN() or f.isNaN() if a boxed double, instead.
SPP_USE_STRINGBUILDER_LENGTH
method calls the toString method on a StringBuffer or StringBuilder only to call length() on the resulting string. It is faster, and less memory intensive to just call the length method directly on the StringBuffer or StringBuilder itself.
SPP_USE_CHARAT
method calls the toCharArray method on a String the fetch an array of characters, only to retrieve one of those characters by index. It is more performant to just use the charAt method.
SPP_NEGATIVE_BITSET_ITEM
method passes a constant negative value as a bit position to a java.util.BitSet. The BitSet class doesn't support negative values, and thus this method call will not work as expected.
SPP_USE_BIGDECIMAL_STRING_CTOR
method calls the BigDecimal constructor that takes a double, and passes a literal double constant value. Since the use of BigDecimal is to get better precision than double, by passing a double, you only get the precision of double number space. To take advantage of the BigDecimal space, pass the number as a string.
SPP_STRINGBUFFER_WITH_EMPTY_STRING
method calls the StringBuffer of StringBuilder constructor passing in a constant empty string (""). This is the same as calling the default constructor, but makes the code work harder. Consider passing in a default size inst
SPP_SUSPECT_STRING_TEST
method tests a string, and groups null values with real strings, leaving empty strings as another case. This might be perfectly valid, but normally, null strings and empty strings are logically handled the same way, and so this test may be flawed.</p> <p>Pattern found is one of the following <pre>if ((s == null) || (s.length() > 0))</pre> -- did you mean ((s == null) || (s.length() == 0))? <pre>if ((s == null) || (s.length() != 0))</pre> -- did you mean ((s == null) || (s.length() == 0))? <pre>if ((s != null) && (s.length() == 0))</pre> -- did you mean ((s != null) && (s.length() > 0))? or perhaps ((s == null) || (s.length() == 0))?
SPP_USELESS_TRINARY
method tests the value of a boolean and using a trinary operator to return either true or false. The trinary operator is completely unecessary, just use the original boolean value.
SPP_INVALID_BOOLEAN_NULL_CHECK
method attempts to check for null by just refering to the variable name as would be done in C++. This ordinarily would be considered a compile error, except the variable in question is a Boolean, which does an auto unbox to boolean.</p> <pre> if (b && b.booleanValue()) should be if ((b != null) && b.booleanValue()) </
SPP_USE_MATH_CONSTANT
method defines its own version of <b>PI</b> or <b>e</b> and the value is not as precise as the one defined in the constants Math.PI or Math.E. Use these constants instead.
STS_SPURIOUS_THREAD_STATES
method invokes the methods wait, notify or notifyAll on a Thread instance. Doing so will confuse the internal thread state behaviour causing spurious thread wakeups/sleeps because the internal mechanism also uses the thread instance for it's notifications.
SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT
method calls wait() on a on mutex defined in the java.util.concurrent package. These classes, define await, instead of wait, and it is most likely that await was intended.
TR_TAIL_RECURSION
method recursively calls itself as the last statement of the method (Tail Recursion). This method can be easily refactored into a simple loop, which will make it more performant, and reduce the stack size requirements.
UAA_USE_ADD_ALL
method uses a simple for loop to copy the contents of a set, list, map key/value, array or other collection to another collection. It is simpler and more straight forward to just call the addAll method of the destination collection passing in the source collection. In the case that the source is an array, you can use Array.asList method to massage the array into a collection
UCC_UNRELATED_COLLECTION_CONTENTS
method adds unrelated objects to a collection or array, requiring careful and brittle data access to that collection. Create a separate class with properties needed, and add an instance of this class to the collection or array, if possible.
UCPM_USE_CHARACTER_PARAMETERIZED_METHOD
method passes a constant literal String of length 1 as a parameter to a method, that exposes a similar method that takes a character. It is simpler and more expedient to handle one character, rather than pass a string.
UEC_USE_ENUM_COLLECTIONS
class uses an ordinary set or map collection and uses an enum class as the key type. It is better performant to use the jdk 1.5 EnumSet or EnumMap classes.
URV_INHERITED_METHOD_WITH_RELATED_TYPES
inherited method is defined to return a java.lang.Object. However, the return types returned from this method can be defined by a more specific class or interface. If possible consider changing the return type in the inheritance hierarchy of this method, otherwise the caller of this method will be brittle in handling of the return type.
URV_UNRELATED_RETURN_VALUES
method returns two or more unrelated types of objects (Related only through java.lang.Object). This will be very confusing to the code that must call it.
URV_CHANGE_RETURN_TYPE
method is defined to return a java.lang.Object. However, the return types returned from this method can be defined by a more specific class or interface. Since this method is not derived from a superclass or interface, it would be more clear to change the return type of this method.
USBR_UNNECESSARY_STORE_BEFORE_RETURN
method stores the return result in a local variable, and then immediately returns the local variable. It would be simpler just to return the value that is assigned to the local variable, directly.
USS_USE_STRING_SPLIT
method uses a StringTokenizer to split up a String and then walks thru the separated elements and builds an array from these enumerated values. It is simpler and easier to use the String.split method.</p> <p>PLEASE NOTE: String.split will return an array of 1 element when passed the empty string, as opposed to using StringTokenizer which returns false on the first hasMoreElements/hasMoreTokens call. So you may need to use</p> <pre> if (s.length() > 0) return s.split(";"); return new String[0]; </
UTA_USE_TO_ARRAY
method manually loops over a collection, pulling each element out and storing it in an array to build an array from the collection. It is easier, and clearer to use the built in collections method toArray. Given a collection 'mycollection' of type T, use mycollection.toArray(new T[mycollection.size(
WEM_WEAK_EXCEPTION_MESSAGING
method creates and throws an exception using a static string as the exceptions message. Without any specific context of this particular exception invocation, such as the value of parameters, key member variables, or local variables, it may be difficult to infer how this exception occurred. Consider adding context to the exception message.