mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
Fixed ArrayStoreException introduced by a recent change.
This commit is contained in:
parent
e15d4deeff
commit
ed290e9aad
1 changed files with 2 additions and 2 deletions
|
@ -106,7 +106,7 @@ public abstract class ArrayUtil {
|
|||
if (obj == null)
|
||||
return array;
|
||||
if (array == null || array.length == 0) {
|
||||
Class c = array != null ? array.getClass().getComponentType() : obj.getClass();
|
||||
Class c = array != null ? array.getClass().getComponentType() : Object.class;
|
||||
array = (T[]) Array.newInstance(c, DEFAULT_LENGTH);
|
||||
array[0] = obj;
|
||||
return array;
|
||||
|
@ -534,7 +534,7 @@ public abstract class ArrayUtil {
|
|||
if (n <= 0)
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
T[] newArgs = (T[]) Array.newInstance(args.getClass().getComponentType(), n-1);
|
||||
T[] newArgs = (T[]) Array.newInstance(args.getClass().getComponentType(), n - 1);
|
||||
for (int i = 1; i < n; i++) {
|
||||
newArgs[i - 1] = args[i];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue