# HG changeset patch # User Jaroslav Tulach # Date 1458499027 -3600 # Node ID 0267fb5bc8d59ae2b0352d4cbc6e53e5abbff5e3 # Parent c3dee54ecc15e04ede6a7a3209fffad2d3afaf7e Return null if there is not the requested annotation on a method diff -r c3dee54ecc15 -r 0267fb5bc8d5 rt/emul/compacttest/src/test/java/org/apidesign/bck2brwsr/tck/ReflectionAnnotationTest.java --- a/rt/emul/compacttest/src/test/java/org/apidesign/bck2brwsr/tck/ReflectionAnnotationTest.java Sun Mar 20 15:26:19 2016 +0100 +++ b/rt/emul/compacttest/src/test/java/org/apidesign/bck2brwsr/tck/ReflectionAnnotationTest.java Sun Mar 20 19:37:07 2016 +0100 @@ -167,6 +167,18 @@ } @Compare + public boolean noAnnotationSingle() { + Annotation arr = ReflectionAnnotationTest.class.getAnnotation(Ann.class); + return arr == null; + } + + @Compare + public boolean noAnnotationOnMethodSingle() throws Exception { + Annotation arr = ReflectionAnnotationTest.class.getMethod("noAnnotationOnMethodSingle").getAnnotation(Ann.class); + return arr == null; + } + + @Compare public String noDeclaredAnnotation() { Annotation[] arr = ReflectionAnnotationTest.class.getDeclaredAnnotations(); if (arr == null) { diff -r c3dee54ecc15 -r 0267fb5bc8d5 rt/emul/mini/src/main/java/java/lang/reflect/Method.java --- a/rt/emul/mini/src/main/java/java/lang/reflect/Method.java Sun Mar 20 15:26:19 2016 +0100 +++ b/rt/emul/mini/src/main/java/java/lang/reflect/Method.java Sun Mar 20 19:37:07 2016 +0100 @@ -667,10 +667,11 @@ @JavaScriptBody(args = { "ac" }, body = - "var a = this._data().anno;" - + "if (a) {" - + " return a['L' + ac.jvmName + ';'];" - + "} else return null;" + "var a = this._data().anno;\n" + + "if (a) {\n" + + " a = a['L' + ac.jvmName + ';'];\n" + + "}\n" + + "return a ? a : null;" ) private native Object getAnnotationData(Class annotationClass);