CPD Results
The following document contains the results of PMD's CPD 6.49.0.
Duplications
File |
Line |
org/apache/maven/api/plugin/testing/ResolverExpressionEvaluatorStub.java |
52 |
org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java |
37 |
public Object evaluate(String expr, Class<?> type) throws ExpressionEvaluationException {
Object value = null;
if (expr == null) {
return null;
}
String expression = stripTokens(expr);
if (expression.equals(expr)) {
int index = expr.indexOf("${");
if (index >= 0) {
int lastIndex = expr.indexOf("}", index);
if (lastIndex >= 0) {
String retVal = expr.substring(0, index);
if (index > 0 && expr.charAt(index - 1) == '$') {
retVal += expr.substring(index + 1, lastIndex + 1);
} else {
retVal += evaluate(expr.substring(index, lastIndex + 1));
}
retVal += evaluate(expr.substring(lastIndex + 1));
return retVal;
}
} |
File |
Line |
org/apache/maven/api/plugin/testing/MojoExtension.java |
357 |
org/apache/maven/plugin/testing/AbstractMojoTestCase.java |
635 |
public static Map<String, Object> getVariablesAndValuesFromObject(Class<?> clazz, Object object)
throws IllegalAccessException {
Map<String, Object> map = new HashMap<>();
Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (Field field : fields) {
map.put(field.getName(), field.get(object));
}
Class<?> superclass = clazz.getSuperclass();
if (!Object.class.equals(superclass)) {
map.putAll(getVariablesAndValuesFromObject(superclass, object));
}
return map;
} |