Avoid NPE
- Fix a bunch of errors in message building along the way
This commit is contained in:
+9
-6
@@ -100,7 +100,7 @@ import java.util.logging.Logger;
|
||||
@Override
|
||||
public JavaTypeDefinition getGenericType(final String parameterName) {
|
||||
for (JavaTypeDefinition currTypeDef = this; currTypeDef != null;
|
||||
currTypeDef = currTypeDef.getEnclosingClass()) {
|
||||
currTypeDef = currTypeDef.getEnclosingClass()) {
|
||||
|
||||
int paramIndex = getGenericTypeIndex(currTypeDef.getType().getTypeParameters(), parameterName);
|
||||
if (paramIndex != -1) {
|
||||
@@ -111,16 +111,16 @@ import java.util.logging.Logger;
|
||||
// throw because we could not find parameterName
|
||||
StringBuilder builder = new StringBuilder("No generic parameter by name ").append(parameterName);
|
||||
for (JavaTypeDefinition currTypeDef = this; currTypeDef != null;
|
||||
currTypeDef = currTypeDef.getEnclosingClass()) {
|
||||
currTypeDef = currTypeDef.getEnclosingClass()) {
|
||||
|
||||
builder.append("\n on class ");
|
||||
builder.append(clazz.getSimpleName());
|
||||
builder.append(currTypeDef.getType().getSimpleName());
|
||||
}
|
||||
|
||||
LOG.log(Level.FINE, builder.toString());
|
||||
// TODO: throw eventually
|
||||
//throw new IllegalArgumentException(builder.toString());
|
||||
return null;
|
||||
return forClass(Object.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -282,8 +282,11 @@ import java.util.logging.Logger;
|
||||
sb.append(jtd.shallowString()).append(", ");
|
||||
}
|
||||
|
||||
return sb.replace(sb.length() - 3, sb.length() - 1, "]") // last comma to bracket
|
||||
.append(", isGeneric=").append(isGeneric)
|
||||
if (!genericArgs.isEmpty()) {
|
||||
sb.replace(sb.length() - 3, sb.length() - 1, ""); // remove last comma
|
||||
}
|
||||
|
||||
return sb.append("], isGeneric=").append(isGeneric)
|
||||
.append("]\n").toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user