Can work with methods without return type
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 07 Jan 2013 18:40:20 +0100
changeset 416b2464b3fd015
parent 415 d7e5500d6cb7
child 418 c0bbf144c2c6
Can work with methods without return type
emul/src/main/java/java/lang/reflect/Method.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/ReflectionTest.java
vmtest/src/test/java/org/apidesign/bck2brwsr/tck/StaticUse.java
     1.1 --- a/emul/src/main/java/java/lang/reflect/Method.java	Mon Jan 07 18:33:03 2013 +0100
     1.2 +++ b/emul/src/main/java/java/lang/reflect/Method.java	Mon Jan 07 18:40:20 2013 +0100
     1.3 @@ -148,7 +148,7 @@
     1.4              case 'B': return Byte.TYPE;
     1.5              case 'Z': return Boolean.TYPE;
     1.6              case 'S': return Short.TYPE;
     1.7 -//            case 'V': return Void.TYPE;
     1.8 +            case 'V': return Void.TYPE;
     1.9              case 'L': try {
    1.10                  int up = sig.indexOf("_2");
    1.11                  String type = sig.substring(1, up);
     2.1 --- a/vmtest/src/test/java/org/apidesign/bck2brwsr/tck/ReflectionTest.java	Mon Jan 07 18:33:03 2013 +0100
     2.2 +++ b/vmtest/src/test/java/org/apidesign/bck2brwsr/tck/ReflectionTest.java	Mon Jan 07 18:40:20 2013 +0100
     2.3 @@ -61,12 +61,12 @@
     2.4      }
     2.5      
     2.6      @Compare public String cannotCallNonStaticMethodWithNull() throws Exception {
     2.7 -        try {
     2.8 -            StaticUse.class.getMethod("instanceMethod").invoke(null);
     2.9 -            return "should not happen";
    2.10 -        } catch (Exception ex) {
    2.11 -            return ex.getClass().getName() + ":" + ex.getMessage();
    2.12 -        }
    2.13 +        StaticUse.class.getMethod("instanceMethod").invoke(null);
    2.14 +        return "should not happen";
    2.15 +    }
    2.16 +
    2.17 +    @Compare public Object voidReturnType() throws Exception {
    2.18 +        return StaticUse.class.getMethod("instanceMethod").getReturnType();
    2.19      }
    2.20      
    2.21      @Compare public String newInstanceFails() throws InstantiationException {
     3.1 --- a/vmtest/src/test/java/org/apidesign/bck2brwsr/tck/StaticUse.java	Mon Jan 07 18:33:03 2013 +0100
     3.2 +++ b/vmtest/src/test/java/org/apidesign/bck2brwsr/tck/StaticUse.java	Mon Jan 07 18:40:20 2013 +0100
     3.3 @@ -22,7 +22,6 @@
     3.4      private StaticUse() {
     3.5      }
     3.6      
     3.7 -    public int instanceMethod() {
     3.8 -        return 0;
     3.9 +    public void instanceMethod() {
    3.10      }
    3.11  }