3 Replies Latest reply on Aug 14, 2007 10:53 AM by Jan Vervecken

    generic Comparator compile issue

    Jan Vervecken

      In JDeveloper this code ...
      package genericcomparatorcompileissue;
      import java.util.Collections;
      import java.util.Comparator;
      import java.util.LinkedList;
      import java.util.List;
      public class GenericComparatorCompileIssue
           private static interface MyRow {};
           private static class MyRowImpl implements MyRow {};
           private static class MyRowComparator implements Comparator<MyRowImpl>
                public int compare(MyRowImpl pFirstMyRowImpl, MyRowImpl pSecondMyRowImpl)
                     return 0;
           public static void main(String[] pArguments)
                System.out.println("GenericComparatorCompileIssue.main() : begin");
                List<MyRow> vMyRowList = new LinkedList<MyRow>();
                Collections.sort(vMyRowList, new MyRowComparator());
                System.out.println("GenericComparatorCompileIssue.main() : end");
      ... compiles and runs and produces this output:
      GenericComparatorCompileIssue.main() : begin
      GenericComparatorCompileIssue.main() : end
      But if you check the "Use Javac" Compiler option in the Project Properties dialog, the compiler reports a "cannot find symbol" error at line 25.

      How can this be explained?

      many thanks
      Jan Vervecken