You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Craig Russell <ap...@gmail.com> on 2023/03/30 17:58:02 UTC
Proposal for code smell Use ... "Collections.addAll" or "System.arraycopy" instead.
Two methods with different names but identical implementation:
public static void string2Set(String names, Collection<String> list)
public static void string2List(String names, List<String> list)
The behavior only depends on the actual type of the "list" parameter.
Proposal: change implementations of both methods from iterating over the split list of the argument to use the addAll of the second parameter
Both methods are used in the TCK:
clr% grep -R "string2Set" .
./exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java: PropertyUtils.string2Set(dblist, dbs);
./exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java: PropertyUtils.string2Set(identitytypes, idtypes);
./exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java: PropertyUtils.string2Set(cfgList, cfgs);
./exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java: PropertyUtils.string2Set(cfgList, cfgs);
./exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java: PropertyUtils.string2Set(dblist, dbs);
./exectck/src/main/java/org/apache/jdo/exectck/InstallSchema.java: PropertyUtils.string2Set(identitytypes, idtypes);
./exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java: public static void string2Set(String names, Collection<String> list) {
./exectck/src/main/java/org/apache/jdo/exectck/Enhance.java: PropertyUtils.string2Set(identitytypes, idtypes);
clr% grep -R "string2List" .
./exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java: PropertyUtils.string2List(cfgList, (List<String>) cfgs);
./exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java: PropertyUtils.string2List(cfgList, (List<String>) cfgs);
./exectck/src/main/java/org/apache/jdo/exectck/PropertyUtils.java: public static void string2List(String names, List<String> list) {
Craig L Russell
clr@apache.org