JDK-8054213 : Class name repeated in output of Type.toString()
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 6,7u45,9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86_64
  • Submitted: 2014-08-02
  • Updated: 2020-01-24
  • Resolved: 2016-07-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9 Other
8u162Fixed 9 b129Fixed openjdk7uFixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Darwin retina.dellroad.org 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64


A DESCRIPTION OF THE PROBLEM :
Class name is repeated in output of Type.toString() for inner class.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile and run this program:

public class xx {
    public static void main(String[] args) throws Exception {
        System.out.println(xx.class.getMethod("foo").getGenericReturnType());
    }
    public java.util.Map.Entry<String, String> foo() {
        return null;
    }
}

2. Note bogus output


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
java.util.Map$Entry<java.lang.String, java.lang.String>

ACTUAL -
java.util.Map.java.util.Map$Entry<java.lang.String, java.lang.String>


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class xx {
    public static void main(String[] args) throws Exception {
        System.out.println(xx.class.getMethod("foo").getGenericReturnType());
    }
    public java.util.Map.Entry<String, String> foo() {
        return null;
    }
}

---------- END SOURCE ----------


Comments
Problem is reproducible only with parametrezied types. Output with "public java.util.Map.Entry foo()" is as expected.
02-06-2016

Looks like a valid bug. Seen on JDK 9 (b21) also.
06-08-2014