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

(reflect) hashCode of TypeVariable causes StackOverflowError

    XMLWordPrintable

    Details

      Backports

        Description

        Name: rmT116609 Date: 09/07/2004


        FULL PRODUCT VERSION :
        java version "1.5.0-rc"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
        Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows XP [Version 5.1.2600]
        (Japanese)

        A DESCRIPTION OF THE PROBLEM :
        The following code causes StackOverflowError.

        import java.lang.reflect.*;

        public class Main<T extends Comparable<? super T>> {
            public static void main(String[] args) {
                Class<?> clazz = Main.class;
                for (TypeVariable<?> var : clazz.getTypeParameters()) {
                    var.hashCode();
                }
            }
        }


        Exception in thread "main" java.lang.StackOverflowError
                at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getBounds(TypeVariableImpl.java:99)
                at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.hashCode(TypeVariableImpl.java:168)
                at java.util.Arrays.hashCode(Arrays.java:2642)
                at sun.reflect.generics.reflectiveObjects.WildcardTypeImpl.hashCode(WildcardTypeImpl.java:214)
                at java.util.Arrays.hashCode(Arrays.java:2642)
                at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.hashCode(ParameterizedTypeImpl.java:190)
                at java.util.Arrays.hashCode(Arrays.java:2642)
                at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.hashCode(TypeVariableImpl.java:168)
                at java.util.Arrays.hashCode(Arrays.java:2642)
                at sun.reflect.generics.reflectiveObjects.WildcardTypeImpl.hashCode(WildcardTypeImpl.java:214)
                at java.util.Arrays.hashCode(Arrays.java:2642)
                at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.hashCode(ParameterizedTypeImpl.java:190)
                at java.util.Arrays.hashCode(Arrays.java:2642)
                at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.hashCode(TypeVariableImpl.java:168)
                at java.util.Arrays.hashCode(Arrays.java:2642)
                at sun.reflect.generics.reflectiveObjects.WildcardTypeImpl.hashCode(WildcardTypeImpl.java:214)
                at java.util.Arrays.hashCode(Arrays.java:2642)
                at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.hashCode(ParameterizedTypeImpl.java:190)
        :
        :
        :



        REPRODUCIBILITY :
        This bug can be reproduced always.
        (Incident Review ID: 301856)
        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                darcy Joe Darcy
                Reporter:
                rmandalasunw Ranjith Mandala (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: