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

java.lang.Class.getTypeName() swallows Throwables

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      See java.lang.Class.getTypeName():
          public String getTypeName() {
              if (isArray()) {
                  try {
                      Class<?> cl = this;
                      int dimensions = 0;
                      do {
                          dimensions++;
                          cl = cl.getComponentType();
                      } while (cl.isArray());
                      return cl.getName() + "[]".repeat(dimensions);
                  } catch (Throwable e) { /*FALLTHRU*/ }
              }
              return getName();
          }

      This should probably be removed because it might hide serious problems with the JVM. It appears this originates from java.lang.reflect.Field.getTypeName(Class<?>), from where it was moved by JDK-6298888.


            liach Chen Liang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: