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

javac 7 regression handling generic return type in Ini4J library

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux

      Description

      Consider this program using http://hg.netbeans.org/binaries/50986B7D247AF02C3DC25CB26B5FC7D5CF1340E6-ini4j-0.4.1.jar as a library:

      ---%<---
      import org.ini4j.Ini;
      public class Demo {
          public Demo() {
              Ini.Section s = new Ini().get("section");
          }
      }
      ---%<---

      JDK 6's javac accepts this but JDK 7 rejects it with:

      Demo.java:4: incompatible types
              Ini.Section s = new Ini().get("section");
        required: Ini.Section
        found: Object

      javap for the library reports:

      public class org.ini4j.Ini extends org.ini4j.MultiMapImpl<java.lang.String, org.ini4j.Ini$Section> {
        // nothing more of interest...
      }
      public class org.ini4j.MultiMapImpl<K extends java.lang.Object, V extends java.lang.Object> extends java.lang.Object implements org.ini4j.MultiMap<K, V> {
        // ...
        public V get(java/lang/Object);
        public V get(java/lang/Object, int);
        // ...
      }
      public interface org.ini4j.MultiMap<K extends java.lang.Object, V extends java.lang.Object> extends java.lang.Object implements java.util.Map<K, V> {
        // ...
        public abstract V get(java/lang/Object, int);
        // ...
      }

      Since Ini is a MultiMapImpl<String,Ini.Section>, get(Object) on it should return Ini.Section.

      Ini.Section.get(String) is similarly affected; should return String but JDK 7 javac considers it to return Object.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jjg Jonathan Gibbons
                Reporter:
                jglick Jesse Glick (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: