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

javac suggests to use var even when var is used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 11
    • 10
    • tools
    • None
    • b07
    • generic
    • generic

      File: Main.java


      class Main {
         public void func() {
            var i = 33;
         }
      }

      $ javac -XDfind=local Main.java

      Main.java:3: warning: Redundant type for local variable (replace explicit type with 'var').
            var i = 33;
                ^
      1 warning

            mcimadamore Maurizio Cimadamore
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: