MethodParameters attributes in v51 classfiles
Jonathan Gibbons
jonathan.gibbons at oracle.com
Wed Nov 9 00:40:13 UTC 2016
On 11/08/2016 04:31 PM, Liam Miller-Cushon wrote:
> If -parameters is passed, javac will write MethodParameters attributes
> when source/target < 8. It also reports -Xlint:classfile warnings
> about MethodParameters attributes in < v52 classfiles:
>
> class X {
> void f(int a) {}
> }
> class Y {
> X x;
> }
>
> $ javac -source 7 -target 7 -parameters X.java
> $ javac -Xlint:classfile -sourcepath : Y.java
> ./X.class: warning: [classfile] MethodParameters attribute introduced
> in version 52.0 class files is ignored in version 51.0 class files
>
> Is that deliberate? I expected it to either not write the attribute
> for old classfile versions, or not warn about it.
Since the code that generates the warning is a general warning for any
future attribute, and not specific to MethodParameters, it would seem
more appropriate to not generate the attribute for versions for which it
is not appropriate.
-- Jon
More information about the compiler-dev
mailing list