target_info structure of a method receiver

Joel Borggren-Franck joel.franck at oracle.com
Fri Sep 12 14:58:23 UTC 2014


Hi,

The table 4.7.20-A and section 4.7.20.1 in JVMS says that a method
receiver target kind is followed by the empty_target target info, noting
that "Only one type appears in each of these locations, so there is no
per-type information to represent in the target_info union.", yet the
following program compiles with both 8 and 9 javac:

--- 8< ---

import java.lang.annotation.*;
import java.lang.reflect.*;

public class Receiver<T, U> {

   @Target(ElementType.TYPE_USE)
   @Retention(RetentionPolicy.RUNTIME)
   @interface A {
   }

   class Foo {
      Foo(@A Receiver<@A T, @A U> Receiver.this) {
      }
   }

   public void m(@A Receiver<@A T, @A U> this, int j) { ; }
}

--- 8< ---

Isn't this 3 type uses in both the ctor and the method?

I haven't found anything in JLS to indicate if javac or JVMLS is wrong
here.

cheers
/Joel


More information about the compiler-dev mailing list