JDK-8194090 : Method.getGenericReturnType returning wrong value
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2017-12-22
  • Updated: 2017-12-22
  • Resolved: 2017-12-22
Related Reports
Duplicate :  
Description
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".
Comments
Duplicate of JDK-8054213. Will backport that to JDK 8u.
22-12-2017