JDK-8334870 : javac does not accept classfiles with certain permitted RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations attributes
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-06-24
  • Updated: 2024-09-16
  • Resolved: 2024-09-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b15Fixed
Related Reports
CSR :  
Relates :  
Sub Tasks
JDK-8339641 :  
Description
JVMS 4.7.18 and 4.7.19 say this about the entries in the RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations attributes:

The i'th entry in the parameter_annotations table may, but is not required to, correspond to the i'th parameter descriptor in the method descriptor (ยง4.3.3).

I.e. there is no requirement for this attribute to contain entries for all parameters, and it is not required for this attribute to not contain additional entries. (It also does not specify the ordering of the annotations.) javac only accepts these attributes if the number of entries matches the number of parameters in the Signature attribute, or the number of parameters in the method descriptor if the Signature attribute is not present.

javac should be adjusted to tolerate other attributes as well, possibly by ignoring them, if it cannot heuristically assign the annotations to the parameters.

Comments
Changeset: 5e822c24 Branch: master Author: Jan Lahoda <jlahoda@openjdk.org> Date: 2024-09-10 06:13:36 +0000 URL: https://git.openjdk.org/jdk/commit/5e822c24bb42e9027c8d9090d498bca7125d1963
10-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/19860 Date: 2024-06-24 15:06:01 +0000
09-07-2024