JDK-6559572 : Add a special case in JVMS for synthetic parameters of RuntimeVisibleParameterAnnotations
  • Type: Bug
  • Component: specification
  • Sub-Component: vm
  • Affected Version: 6
  • Priority: P5
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2007-05-18
  • Updated: 2014-12-19
  • Resolved: 2007-06-12
Related Reports
Relates :  
Description
JVMS states that num_parameters is the same as the number of parameters
given by the method descriptor. Perhaps we'd better add a special case 
in the spec here. Because there's no point to list the synthetic parameters 
in this attribute (the content is always empty). We don't want to waste a
few bytes simply to list something useless. Besides, num_parameters will 
no longer be duplicated.

Comments
EVALUATION To clarify that synthetic parameters can have annotations, JVMS 3ed will change "signature" to "descriptor" in: parameter_annotations Each value of the parameter_annotations table represents all of the runtime-visible annotations on a single parameter. The sequence of values in the table corresponds to the sequence of parameters in the method signature. for RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations.
12-06-2007

EVALUATION RuntimeVisibleParameterAnnotations is concerned with Java programming language annotations, but this does not imply that RVPA forbids annotations on synthetic parameters. I'd be surprised if a compiler emitted annotations on synthetic parameters today, but there is no reason to forbid it. So we should not require num_parameters to merely equal the number of formals in the source. (In any case, it would not be possible to do so since the Signature attribute is optional.) We could allow num_parameters to be <= the number of parameters in the descriptor, up to the number of ACC_SYNTHETIC parameters in the method. But this will make the parameter_annotations table more complicated, because its entries currently map 1:1 to formals in the descriptor. Also, relaxing the existing rule will break programs that rely on the existing equality. I would prefer not to do it. If that means some wasted bytes, so be it. (All this holds for RuntimeInvisibleParameterAnnotations too.)
21-05-2007