The following document contains the results of PMD's CPD 3.7.
| File | Line |
|---|---|
| org/apache/xbean/recipe/ReflectionUtil.java | 64 |
| org/apache/xbean/recipe/ReflectionUtil.java | 174 |
if (propertyName.contains("/")){
String[] strings = propertyName.split("/");
if (strings == null || strings.length != 2) throw new IllegalArgumentException("badly formed <class>/<attribute> property name: " + propertyName);
String className = strings[0];
propertyName = strings[1];
boolean found = false;
while(!typeClass.equals(Object.class) && !found){
if (typeClass.getName().equals(className)){
found = true;
break;
} else {
typeClass = typeClass.getSuperclass();
}
}
if (!found) throw new MissingAccessorException("Type not assignable to class: " + className, -1);
}
| |
| File | Line |
|---|---|
| org/apache/xbean/recipe/ReflectionUtil.java | 230 |
| org/apache/xbean/recipe/ReflectionUtil.java | 414 |
if (method.getReturnType() != Void.TYPE) {
if (matchLevel < 2) {
matchLevel = 2;
missException = new MissingAccessorException("Setter returns a value: " + method, matchLevel);
}
continue;
}
if (Modifier.isAbstract(method.getModifiers())) {
if (matchLevel < 3) {
matchLevel = 3;
missException = new MissingAccessorException("Setter is abstract: " + method, matchLevel);
}
continue;
}
if (!allowPrivate && !Modifier.isPublic(method.getModifiers())) {
if (matchLevel < 4) {
matchLevel = 4;
missException = new MissingAccessorException("Setter is not public: " + method, matchLevel);
}
continue;
}
| |
| File | Line |
|---|---|
| org/apache/xbean/recipe/ReflectionUtil.java | 508 |
| org/apache/xbean/recipe/ReflectionUtil.java | 621 |
throw new ConstructionException("Class is an interface: " + typeClass.getName());
}
// verify parameter names and types are the same length
if (parameterNames != null) {
if (parameterTypes == null) parameterTypes = Collections.nCopies(parameterNames.size(), null);
if (parameterNames.size() != parameterTypes.size()) {
throw new ConstructionException("Invalid ObjectRecipe: recipe has " + parameterNames.size() +
" parameter names and " + parameterTypes.size() + " parameter types");
}
} else if (!options.contains(Option.NAMED_PARAMETERS)) {
// Named parameters are not supported and no explicit parameters were given,
// so we will only use the no-arg constructor
parameterNames = Collections.emptyList();
parameterTypes = Collections.emptyList();
}
// get all methods sorted so that the methods with the most constructor args are first
List<Method> methods = new ArrayList<Method>(Arrays.asList(typeClass.getMethods()));
| |
| File | Line |
|---|---|
| org/apache/xbean/recipe/ReflectionUtil.java | 277 |
| org/apache/xbean/recipe/ReflectionUtil.java | 451 |
missException = new MissingAccessorException("Setter is static: " + method, matchLevel);
}
continue;
}
if (allowPrivate && !Modifier.isPublic(method.getModifiers())) {
setAccessible(method);
}
if (RecipeHelper.isInstance(methodParameterType, propertyValue)) {
// This setter requires no conversion, which means there can not be a conversion error.
// Therefore this setter is perferred and put a the head of the list
validSetters.addFirst(method);
} else {
validSetters.add(method);
}
}
}
if (!validSetters.isEmpty()) {
// remove duplicate methods (can happen with inheritance)
return new ArrayList<Method>(new LinkedHashSet<Method>(validSetters));
}
if (missException != null) {
throw missException;
} else {
StringBuffer buffer = new StringBuffer("Unable to find a valid setter ");
| |