Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8076155

Misleading compiler errors when using lambda expressions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools

      Description


      Misleading compiler errors when using lambda expressions

      OS version: Microsoft Windows [Version 6.1.7601]

      Java version:
      java version "1.8.0_40"
      Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
      Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

      Also get identical output on JDK8 update 0, JDK 8 update 40 and JDK 9 (1.9.0-ea-b55)

      More concretely, the issues are:

         1. With respect to case 1, javac reification converts Testcase<String> to Testcase<Object>.
             Not sure if this is a bug or a limitation in the current reification implementation.

         2. With respect to case 2:
               1. If you compile the file without "-Xlint" you get a warning:

      [WARNING]
      /C:/Users/<userid>/Documents/NetBeansProjects/Testcase/src/main/java/Testcase.java:
      C:\Users\<userid>\Documents\NetBeansProjects\Testcase\src\main\java\Testcase.java uses unchecked or unsafe operations.
      [WARNING]
      /C:/Users/<userid>/Documents/NetBeansProjects/Testcase/src/main/java/Testcase.java: Recompile with -Xlint:unchecked for details.

               2. But, if you then enable "-Xlint:unchecked" the compiler does not produce any warnings at all. Expecting the compiler to provide detailed warnings in this case.

        Attachments

        1. Testcase.java
          2 kB
          Rajendrakumar Pallath

          Activity

            People

            Assignee:
            mcimadamore Maurizio Cimadamore
            Reporter:
            shadowbug Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: