File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed
sources/net.sf.j2s.java.core/src/java/lang/reflect Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -109,18 +109,33 @@ public Object invoke(Object receiver, Object... args)
109109 // proxy does
110110 Object [] a = Class .getArgumentArray (parameterTypes , args , isProxy );
111111 Object c = (isProxy ? receiver : this .Class_ );
112+ Object m = null ;
112113 /**
113114 * @j2sNative
114115 *
115116 * if (!this.isProxy) c = c.$clazz$;
116- * var m= c[this.signature] || c.prototype && c.prototype[this.signature];
117- * if (m != null)
118- * return m.apply(receiver,a);
117+ * m= c[this.signature] || c.prototype && c.prototype[this.signature];
118+ * if (m != null) {
119+ * m = this.wrap(m.apply(receiver,a));
120+ * }
119121 */
120-
122+ if ( m == null ) {
121123 String message = "Method " + getDeclaringClass ().getName ()
122124 + "." + signature + " was not found" ;
123- throw new IllegalArgumentException (message );
125+ throw new IllegalArgumentException (message );
126+ }
127+ return m ;
128+ }
129+
130+ private Object wrap (Object o ) {
131+ switch (/** @j2sNative typeof o || */ "" ) {
132+ case "number" :
133+ double d = (/** @j2sNative 1 ? o : */ 0 );
134+ return (d == (int ) d ? Integer .valueOf ((int ) d ) : Double .valueOf (d ));
135+ case "boolean" :
136+ return Boolean .valueOf (/** @j2sNative o || */ false );
137+ }
138+ return o ;
124139 }
125140
126141 public TypeVariable <Method >[] getTypeParameters () {
You can’t perform that action at this time.
0 commit comments