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

Misleading compiler errors when using lambda expressions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P3
    • 9
    • 9
    • 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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: