Removing target_type distinctions between constructors and methods

Michael Ernst mernst at
Wed Apr 17 07:23:21 PDT 2013

Currently, the Type Annotations (JSR 308) Specification uses different
TargetType enum constants and target_type values for constructors and
methods.  For example, here are target_type values:

0x45  constructor reference receiver
0x46  method reference receiver

0x48  type argument in constructor call
0x49  type argument in method call

0x4A  type argument in constructor reference
0x4B  type argument in method reference

These distinctions seem irrelevant.  You can tell whether an annotation
relates to a constructor or method from where it appears in the class file,
so it doesn't seem to be necessary to also encode this in target_type.

Perhaps these distinctions were put in the JSR 308 spec because an earlier
version of the lambda spec made these distinctions in its grammar (and
possibly elsewhere).

I propose that we eliminate this distinction, using only 3 instead of 6
target_type values and TargetType enum constants.  I'd like to hear
reactions from others (both on and off the Expert Group) before making this
change, though.  Thoughts?



More information about the type-annotations-spec-experts mailing list