Prechádzať zdrojové kódy

[java] Do not throw if one of the overloads doesn't have a valid number argument

Ref #6398
Caue Waneck 7 rokov pred
rodič
commit
dbe1772177

+ 2 - 1
std/java/_std/Type.hx

@@ -161,7 +161,8 @@ enum ValueType {
 						case 'short' | 'java.lang.Short':
 							callArguments[argNum] = (cast arg : java.lang.Number).shortValue();
 						case _:
-							throw 'Unknown expected number subclass of type $name';
+							valid = false;
+							break;
 					}
 				} else {
 					valid = false;

+ 0 - 2
tests/unit/src/unit/TestReflect.hx

@@ -230,7 +230,6 @@ class TestReflect extends Test {
 	}
 
 	function testCreate() {
-		#if !java
 		var i = Type.createInstance(MyClass,[33]);
 		t( (i is MyClass) );
 		eq( i.get(), 33 );
@@ -249,7 +248,6 @@ class TestReflect extends Test {
 		exc( function() Type.createEnum(MyEnum,__unprotect__("A"),[0]) );
 		exc( function() Type.createEnum(MyEnum,__unprotect__("C")) );
 		exc( function() Type.createEnum(MyEnum,"Z",[]) );
-		#end
 	}
 
 	static function compareMethodsDummy() {}