<div dir="ltr">This ended up getting filed as <a href="https://bugs.openjdk.java.net/browse/JDK-8190452">https://bugs.openjdk.java.net/browse/JDK-8190452</a>. I've seen a few other reports of it.<div><br></div><div>> <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">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.</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Since this didn't get fixed in time for 9, and there are now class files in the wild that have this issue, would you consider relaxing the warning for MethodParameters attributes?</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I'm interested in contributing a fix (to relax the warning and/or only emit the attributes for appropriate class file versions) if someone is interested in sponsoring it.</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Thanks,</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 8, 2016 at 5:22 PM, Liam Miller-Cushon <span dir="ltr"><<a href="mailto:cushon@google.com" target="_blank">cushon@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I'd be happy to have MethodParameters attributes in older class file versions, but not wanting to special-case future attribute diagnostics makes sense.</div><div><br></div><div>This came up because of a bad interaction between future attribute diagnostics and rawtypes warnings. The same issue might affect other future attribute warnings or other diagnostic kinds, so it's probably worth tracking separately:</div><div><br></div><div>public class A<E, F extends B> { public A(F f) {} }</div><div>public class B { public void t(int i) {} }</div><div>public class Test {</div><div>  public void f() {</div><div>  Â  new A(new B());</div><div>  }</div><div>}</div><div><br></div><div>javac -parameters -source 7 -target 7 A.java B.java</div><div>javac -Xlint:all -sourcepath : Test.java</div><div><div>./A.class: warning: [classfile] MethodParameters attribute introduced in version 52.0 class files is ignored in version 51.0 class files</div><div>./B.class: warning: [classfile] MethodParameters attribute introduced in version 52.0 class files is ignored in version 51.0 class files</div><div>2 warnings</div><div>An exception has occurred in the compiler (9-ea). Please file a bug against the Java compiler via the Java bug reporting page (<a href="http://bugreport.java.com" target="_blank">http://bugreport.java.com</a>) after checking the Bug Database (<a href="http://bugs.java.com" target="_blank">http://bugs.java.com</a>) for duplicates. Include your program and the following diagnostic in your report. Thank you.</div><div>java.lang.AssertionError: Missing type variable in where clause: E</div><div><span class="m_422987034716439356gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>at com.sun.tools.javac.util.<wbr>RichDiagnosticFormatter.<wbr>unique(jdk.compiler@9-ea/<wbr>RichDiagnosticFormatter.java:<wbr>247)</div><div><span class="m_422987034716439356gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>at com.sun.tools.javac.util.<wbr>RichDiagnosticFormatter.<wbr>access$100(jdk.compiler@9-ea/<wbr>RichDiagnosticFormatter.java:<wbr>71)</div><div><span class="m_422987034716439356gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>at com.sun.tools.javac.util.<wbr>RichDiagnosticFormatter$<wbr>RichPrinter.visitTypeVar(jdk.<wbr>compiler@9-ea/<wbr>RichDiagnosticFormatter.java:<wbr>398)</div><div><span class="m_422987034716439356gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>at com.sun.tools.javac.util.<wbr>RichDiagnosticFormatter$<wbr>RichPrinter.visitTypeVar(jdk.<wbr>compiler@9-ea/<wbr>RichDiagnosticFormatter.java:<wbr>340)</div></div><div><br></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 8, 2016 at 4:40 PM, Jonathan Gibbons <span dir="ltr"><<a href="mailto:jonathan.gibbons@oracle.com" target="_blank">jonathan.gibbons@oracle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_422987034716439356HOEnZb"><div class="m_422987034716439356h5"><br>
<br>
On 11/08/2016 04:31 PM, Liam Miller-Cushon wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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:<br>
<br>
class X {<br>
  void f(int a) {}<br>
}<br>
class Y {<br>
  X x;<br>
}<br>
<br>
$ javac -source 7 -target 7 -parameters X.java<br>
$ javac -Xlint:classfile -sourcepath : Y.java<br>
./X.class: warning: [classfile] MethodParameters attribute introduced in version 52.0 class files is ignored in version 51.0 class files<br>
<br>
Is that deliberate? I expected it to either not write the attribute for old classfile versions, or not warn about it.<br>
</blockquote>
<br></div></div>
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.<br>
<br>
-- Jon<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>