mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-03 21:07:49 +08:00
In-place default primitive adjustment for ConstructorExpression
This commit is contained in:
parent
df8c1e82f1
commit
5c38c2208f
@ -201,16 +201,13 @@ public class ConstructorExpression<T> extends ExpressionBase<T> implements Facto
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
private T doNewInstance(Object... cargs) throws InvocationTargetException, InstantiationException, IllegalArgumentException, IllegalAccessException {
|
||||
Object[] safeArgs = new Object[cargs.length];
|
||||
for (int i = 0; i < parameterTypes.length; i++) {
|
||||
Object actualArg = cargs[i];
|
||||
if (parameterTypes[i].isPrimitive() && actualArg == null) {
|
||||
safeArgs[i] = defaultPrimitives.get(parameterTypes[i]);
|
||||
} else {
|
||||
safeArgs[i] = actualArg;
|
||||
cargs[i] = defaultPrimitives.get(parameterTypes[i]);
|
||||
}
|
||||
}
|
||||
return (T) constructor.newInstance(safeArgs);
|
||||
return (T) constructor.newInstance(cargs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user