Skip to content

Commit 27b0414

Browse files
committed
ensuring statics finalized
1 parent 2d339d7 commit 27b0414

File tree

1 file changed

+7
-5
lines changed
  • sources/net.sf.j2s.java.core/src/java/lang/reflect

1 file changed

+7
-5
lines changed

sources/net.sf.j2s.java.core/src/java/lang/reflect/Method.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,24 +109,26 @@ public Method(Class<?> declaringClass, String name, Class<?>[] parameterTypes, C
109109
public Object invoke(Object receiver, Object... args)
110110
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
111111

112-
// proxy does
112+
// proxy does uses this.Class_ as its receiver and ensures initialization
113+
boolean isProxy = this.isProxy;
113114
Object[] a = Class.getArgumentArray(parameterTypes, args, isProxy);
114115
Object c = (isProxy ? receiver : this.Class_);
115116
Object m = null, val = null;
116117
/**
117118
* @j2sNative
118119
*
119-
* if (!this.isProxy) c = c.$clazz$;
120+
* if (!isProxy) {c = c.$clazz$;}
121+
* c.$load$ && Clazz.load(c,2);
120122
* m= c[this.signature] || c.prototype && c.prototype[this.signature];
121123
* val = (m == null ? null : m.apply(receiver,a));
122-
* if (val != null && !this.isProxy) val = this.wrap$O(val);
123124
*/
124-
if (m == null) {
125+
126+
if (m == null) {
125127
String message = "Method " + getDeclaringClass().getName()
126128
+ "." + signature + " was not found";
127129
throw new IllegalArgumentException(message);
128130
}
129-
return val;
131+
return (val == null || isProxy ? val : wrap(val));
130132
}
131133

132134
Object wrap(Object o) {

0 commit comments

Comments
 (0)