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

generic interface in generic class

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 1.4.0
    • 1.4.0
    • tools
    • beta2
    • generic
    • solaris_7
    • Verified

    Description

      This is a problem in the prototype for jsr14 generics:

      frog$ cat -n T.java
           1 interface Iterator<E> {
           2 }
           3
           4 class Set<E> {
           5 Iterator<E> iterator() { return null; }
           6 }
           7
           8 interface Map<K,V> {
           9 public interface Entry<K,V> {
          10 }
          11 public Set<Entry<K,V>> entrySet();
          12 }
          13
          14 class Hashtable<K,V> implements Map<K,V> {
          15 public Set<Entry<K,V>> entrySet() { return null; }
          16
          17 public synchronized String toString() {
          18 Iterator<Map.Entry<K,V>> it = entrySet().iterator();
          19 }
          20 }
      frog$ make
      /java/jdk/ws/tools/jsr14/build/solaris-sparc/bin/javac -gj *.java
      T.java:18: incompatible types
      found : Iterator<Map<K,V>.Entry<K,V>>
      required: Iterator<Map.Entry<K,V>>
              Iterator<Map.Entry<K,V>> it = entrySet().iterator();
                                                               ^
      1 error
      *** Error code 1
      make: Fatal error: Command failed for target `all'
      frog$

      Attachments

        Activity

          People

            gafter Neal Gafter
            gafter Neal Gafter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: