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

Method.getGenericReturnType returning wrong value

XMLWordPrintable

      submitter report :
      =======================

      I have an simple interface within an another interface and trying to get the
      getGenericReturnType for the method but it is returning the wrong value.

      1) LongArray.java

      package com.test;

      public interface LongArray<V> {

          public Iterator<V> iterator();
          interface Iterator<V> {
          }
      }

      2) Class2.java

      package com.test;

      public interface LongArray<V> {

          public Iterator<V> iterator();
          interface Iterator<V> {
          }
      }

      Output
      =========
      Method Generic Return Type: com.test.LongArray.com.test.LongArray$Iterator

      Javap output
      ==========
      javap LongArray Warning: Binary file LongArray contains com.test.LongArray
      Compiled from "LongArray.java"

      public interface com.test.LongArray<V> {
        public abstract com.test.LongArray$Iterator<V> iterator();
      }

      According to javap output, it should return "com.test.LongArray$Iterator" but
      it is returning "com.test.LongArray.com.test.LongArray$Iterator".

            coffeys Sean Coffey
            shadowbug Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: