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

-XDdiamondFinder misses some unnecessary type arguments

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 8
    • tools

      Consider this code:
      ---
      import java.util.*;
      public class Test {
          private void test() {
              List<String> ll = Collections.synchronizedList(new ArrayList<String>());
          }
      }
      ---

      Running javac (tip: 558fe98d1ac0) as follows:
      $ javac -XDfindDiamond -source 8 Test.java

      Does not produce any "type argument is unnecessary" warning, even though the type argument of the new ArrayList is unnecessary with -source 8, as the following is compilable with -source 8:
      ---
      import java.util.*;
      public class Test {
          private void test() {
              List<String> ll = Collections.synchronizedList(new ArrayList<>());
          }
      }
      ---

            jlahoda Jan Lahoda
            jlahoda Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: