The diamond finder does not find diamond candidates in field initializers

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 17
    • Affects Version/s: 17
    • Component/s: tools
    • None
    • b21

      Consider code like:
      ---
      public class Test {
           private List<String> l = new ArrayList<String>();
      }
      ---

      Running javac with -XDfind=diamond will not produce a warning about the diamond candidate, while doing the some on:
      ---
      public class Test {
           List<String> l = new ArrayList<String>();
      }
      ---

      will produce:
      Test.java:4: warning: Redundant type arguments in new expression (use diamond operator instead).
           List<String> l = new ArrayList<String>();
                                         ^
      1 warning

            Assignee:
            Jan Lahoda
            Reporter:
            Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: