JDK-8194997 : compiler message file broken: key=compiler.misc.cant.resolve.args arguments=method, test, , , {4}, {5}, {6}, {7}
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8,9.0.4,10
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2018-01-11
  • Updated: 2018-05-14
  • Resolved: 2018-05-14
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 11
11Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64

A DESCRIPTION OF THE PROBLEM :
The following code being compiled gives incomprehensible error message:

public class A {

    public static void main(String[] args) {
        new Thread(((new I() {}))::test).start();
    }

    interface I {
        private void test() {
        }
    }

}

Error message:

A.java:5: error: invalid method reference
        new Thread(((new I() {}))::test).start();
                   ^
  compiler message file broken: key=compiler.misc.cant.resolve.args arguments=method, test, , , {4}, {5}, {6}, {7}
1 error


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac A.java


ERROR MESSAGES/STACK TRACES THAT OCCUR :
A.java:5: error: invalid method reference
        new Thread(((new I() {}))::test).start();
                   ^
  compiler message file broken: key=compiler.misc.cant.resolve.args arguments=method, test, , , {4}, {5}, {6}, {7}
1 error


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class A {

    public static void main(String[] args) {
        new Thread(((new I() {}))::test).start();
    }

    interface I {
        private void test() {
        }
    }

}
---------- END SOURCE ----------


Comments
Thanks for the investigation and explanation re: CheckResourceKeys. While it is intentional that we only look for string fragments, this is an annoying weakness. We might want to look to see if the migration to using the type-safe diagnostic framework means that we can improve CheckResourceKeys.
14-05-2018

this one is a duplicate of JDK-8194998, already fixed, and should be closed as a duplicate
14-05-2018

A related question is, why was this not caught by the CheckResourceKeys test, which aims to check that all resource keys used in javac have entries in the resource file?
07-05-2018

Incomprehensible error message seems to be exist for a long, i could verify it on 8 9 and 10. In 8 and before 9 ea b54 (JDK-8071453) error message was hidden along with other error messages. 8uxx - Fail 9.0.4 GA - Fail 10 ea b37 - fail Result on 10 ea b37 == -sh-4.2$ /scratch/fairoz/JAVA/jdk10/jdk-10-ea+37/bin/javac A.java A.java:4: error: invalid method reference new Thread(((new I() {}))::test).start(); ^ compiler message file broken: key=compiler.misc.cant.resolve.args arguments=method, test, , , {4}, {5}, {6}, {7} 1 error
12-01-2018