src/share/classes/java/lang/Class.java

Print this page

        

*** 347,357 **** return null; } }); cachedConstructor = c; } catch (NoSuchMethodException e) { ! throw new InstantiationException(getName()); } } Constructor<T> tmpConstructor = cachedConstructor; // Security check (same as in java.lang.reflect.Constructor) int modifiers = tmpConstructor.getModifiers(); --- 347,358 ---- return null; } }); cachedConstructor = c; } catch (NoSuchMethodException e) { ! throw (InstantiationException) ! new InstantiationException(getName()).initCause(e); } } Constructor<T> tmpConstructor = cachedConstructor; // Security check (same as in java.lang.reflect.Constructor) int modifiers = tmpConstructor.getModifiers();
*** 971,981 **** // the immediately enclosing method or constructor's // descriptor (null iff name is). descriptor = (String) enclosingInfo[2]; assert((name != null && descriptor != null) || name == descriptor); } catch (ClassCastException cce) { ! throw new InternalError("Invalid type in enclosing method information"); } } boolean isPartial() { return enclosingClass == null || name == null || descriptor == null; --- 972,983 ---- // the immediately enclosing method or constructor's // descriptor (null iff name is). descriptor = (String) enclosingInfo[2]; assert((name != null && descriptor != null) || name == descriptor); } catch (ClassCastException cce) { ! throw (InternalError) ! new InternalError("Invalid type in enclosing method information").initCause(cce); } } boolean isPartial() { return enclosingClass == null || name == null || descriptor == null;
*** 1237,1247 **** return null; // Otherwise, strip the enclosing class' name try { return getName().substring(enclosingClass.getName().length()); } catch (IndexOutOfBoundsException ex) { ! throw new InternalError("Malformed class name"); } } /** * Returns {@code true} if this is a local class or an anonymous --- 1239,1250 ---- return null; // Otherwise, strip the enclosing class' name try { return getName().substring(enclosingClass.getName().length()); } catch (IndexOutOfBoundsException ex) { ! throw (InternalError) ! new InternalError("Malformed class name").initCause(ex); } } /** * Returns {@code true} if this is a local class or an anonymous
*** 2952,2964 **** }); enumConstants = (T[])values.invoke(null); } // These can happen when users concoct enum-like classes // that don't comply with the enum spec. ! catch (InvocationTargetException ex) { return null; } ! catch (NoSuchMethodException ex) { return null; } ! catch (IllegalAccessException ex) { return null; } } return enumConstants; } private volatile transient T[] enumConstants = null; --- 2955,2966 ---- }); enumConstants = (T[])values.invoke(null); } // These can happen when users concoct enum-like classes // that don't comply with the enum spec. ! catch (InvocationTargetException | NoSuchMethodException | ! IllegalAccessException ex) { return null; } } return enumConstants; } private volatile transient T[] enumConstants = null;