Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-4073

JDK14 features still declared as preview (e.g. switch) - Project contains "file with errors"

    XMLWordPrintableJSON

Details

    • Patch

    Description

      With configuration NB11.2 and JDK13 I used the flag --enable-preview to use the new switch command for example. In JDK14  the new switch command is not longer a preview feature, it's implemented in the JDK now.

      However, in NB11.3 and JDK14 I cannot use the --enable-preview flag. Running/compiling with this flag results in error. If I remove the flag, application is compiling and running in JDK14.

      The Netbeans IDE itself shows in the project still "files with errors" and at every program run it displays the message "project still has failures. Continue?". If I look at the marked files with error, it shows me the files where the new switch command is used. The hint is "Use --enable-preview flag" which can not be used anymore.

      To reproduce:

      • Create Java App - Source level and JDK version 14
      • Use new switch statement in code

       

      switch (b) {
         case 1 -> System.out.println("1");
         default -> System.out.println("other");
      }

      Attachments

        1. switch_expression.png
          23 kB
          Klaus Ahrenberg

        Activity

          People

            Unassigned Unassigned
            klaus.ahrenberg Klaus Ahrenberg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: