Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hyee committed Feb 19, 2017
1 parent 25a84dd commit 516f564
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/com/esotericsoftware/reflectasm/ClassAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -1334,21 +1334,21 @@ public <T, V> T invokeWithMethodHandle(ANY instance, final int index, String typ
}
}

public <T, V> T invokeWithIndex(ANY instance, final int methodIndex, V... args) {
final public <T, V> T invokeWithIndex(ANY instance, final int methodIndex, V... args) {
Object[] arg = args;
if (!IS_STRICT_CONVERT) arg = reArgs(METHOD, methodIndex, args);
if (isInvokeWithMethodHandle.get()) return invokeWithMethodHandle(instance, methodIndex, METHOD, arg);
return accessor.invokeWithIndex(instance, methodIndex, arg);
}

public <T, V> T invoke(ANY instance, String methodName, V... args) {
Integer index = indexOf(methodName, METHOD);
if (index == null) index = indexOfMethod(null, methodName, args2Types(args));
return invokeWithIndex(instance, index, args);
final public <T, V> T invoke(ANY instance, String methodName, V... args) {
final int index = indexOfMethod(null, methodName, args2Types(args));
return invokeWithIndex(!methodName.equals(NEW) && Modifier.isStatic(classInfo.methodModifiers[index]) ? null : instance, index, args);
}

public <T, V> T invokeWithTypes(ANY instance, String methodName, Class[] paramTypes, V... args) {
return invokeWithIndex(instance, indexOfMethod(null, methodName, paramTypes), args);
final public <T, V> T invokeWithTypes(ANY instance, String methodName, Class[] paramTypes, V... args) {
final int index = indexOfMethod(null, methodName, paramTypes);
return invokeWithIndex(!methodName.equals(NEW) && Modifier.isStatic(classInfo.methodModifiers[index]) ? null : instance, index, args);
}

@Override
Expand All @@ -1361,24 +1361,24 @@ public MethodHandle[][] getMethodHandles() {
return new MethodHandle[0][];
}

public ANY newInstance() {
final public ANY newInstance() {
if (isNonStaticMemberClass())
throw new IllegalArgumentException("Cannot initialize a non-static inner class " + classInfo.baseClass.getCanonicalName() + " without specifing the enclosing instance!");
return accessor.newInstance();
}

public <V> ANY newInstanceWithIndex(int constructorIndex, V... args) {
final public <V> ANY newInstanceWithIndex(int constructorIndex, V... args) {
V[] arg = args;
if (!IS_STRICT_CONVERT) args = reArgs(NEW, constructorIndex, args);
if (isInvokeWithMethodHandle.get()) return invokeWithMethodHandle(null, constructorIndex, NEW, arg);
return accessor.newInstanceWithIndex(constructorIndex, args);
}

public <T> ANY newInstanceWithTypes(Class[] paramTypes, T... args) {
final public <T> ANY newInstanceWithTypes(Class[] paramTypes, T... args) {
return newInstanceWithIndex(indexOfMethod(null, NEW, paramTypes), args);
}

public ANY newInstance(Object... args) {
final public ANY newInstance(Object... args) {
Integer index = indexOf(NEW, METHOD);
if (index == null) {
Class[] paramTypes = new Class[args.length];
Expand All @@ -1388,7 +1388,7 @@ public ANY newInstance(Object... args) {
return newInstanceWithIndex(index, args);
}

public <T, V> void set(ANY instance, int fieldIndex, V value) {
final public <T, V> void set(ANY instance, int fieldIndex, V value) {
if (!IS_STRICT_CONVERT) try {
Class<T> clz = classInfo.fieldTypes[fieldIndex];
if (isInvokeWithMethodHandle.get())
Expand Down

0 comments on commit 516f564

Please sign in to comment.