RFR: JDK-8198945: Invalid RuntimeVisibleTypeAnnotations for annotation on anonymous class type parameter

Martin Buchholz martinrb at google.com
Mon Sep 17 18:00:41 UTC 2018


I'm not a compiler engineer, but I am a Reviewer, and this change
looks good to me.

Here are things I might do differently:

debugAnnotation, printElementValue

I might name these toDebugString.  I don't like methods named printXX
that don't print.

I might rename testEnclosingMethod to testTopLevelMethod and
testInsideInnerClass to testInnerClassMethod for clarity.

I might refactor code body annotation finding code into a method that
returns a Set of Annotation

+        if (method.attributes.get(Attribute.RuntimeVisibleTypeAnnotations)
!= null) {
+            throw new AssertionError(
+                    "expected no RuntimeVisibleTypeAnnotations
attribute on enclosing method");
+        }
+        Code_attribute code = (Code_attribute)
method.attributes.get(Attribute.Code);
+        RuntimeVisibleTypeAnnotations_attribute rvta =
+                (RuntimeVisibleTypeAnnotations_attribute)
+
code.attributes.get(Attribute.RuntimeVisibleTypeAnnotations);

On Tue, Sep 11, 2018 at 4:40 PM, Liam Miller-Cushon <cushon at google.com> wrote:
> On Fri, Jul 27, 2018 at 1:25 PM Werner Dietl <wdietl at gmail.com> wrote:
>>
>> Hi Liam,
>>
>> thanks, this looks very nice! Removing all this incorrect code is
>> great. The examples I tried worked correctly.
>
>
> Thanks Werner!
>
> I have rebased the patch, and confirmed the tests are still passing. Here's
> the latest version:
>
> http://cr.openjdk.java.net/~cushon/8198945/webrev.05/
>
> Is there any additional feedback on this change?


More information about the compiler-dev mailing list