src/share/classes/javax/swing/UIDefaults.java

Print this page

        

*** 309,322 **** if (c != null) { b = ResourceBundle.getBundle(bundleName, l, c); } else { b = ResourceBundle.getBundle(bundleName, l); } ! Enumeration keys = b.getKeys(); while (keys.hasMoreElements()) { ! String key = (String)keys.nextElement(); if (values.get(key) == null) { Object value = b.getObject(key); values.put(key, value); --- 309,322 ---- if (c != null) { b = ResourceBundle.getBundle(bundleName, l, c); } else { b = ResourceBundle.getBundle(bundleName, l); } ! Enumeration<String> keys = b.getKeys(); while (keys.hasMoreElements()) { ! String key = keys.nextElement(); if (values.get(key) == null) { Object value = b.getObject(key); values.put(key, value);
*** 680,690 **** try { String className = (String)get(uiClassID); if (className != null) { ReflectUtil.checkPackageAccess(className); ! Class cls = (Class)get(className); if (cls == null) { if (uiClassLoader == null) { cls = SwingUtilities.loadSystemClass(className); } else { --- 680,690 ---- try { String className = (String)get(uiClassID); if (className != null) { ReflectUtil.checkPackageAccess(className); ! Class<?> cls = (Class)get(className); if (cls == null) { if (uiClassLoader == null) { cls = SwingUtilities.loadSystemClass(className); } else {
*** 693,709 **** if (cls != null) { // Save lookup for future use, as forName is slow. put(className, cls); } } ! return cls; } } ! catch (ClassNotFoundException e) { ! return null; ! } ! catch (ClassCastException e) { return null; } return null; } --- 693,708 ---- if (cls != null) { // Save lookup for future use, as forName is slow. put(className, cls); } } ! @SuppressWarnings("unchecked") ! Class<? extends ComponentUI> tmp = (Class<? extends ComponentUI>)cls; ! return tmp; } } ! catch (ClassNotFoundException | ClassCastException e) { return null; } return null; }
*** 765,775 **** } else { try { Method m = (Method)get(uiClass); if (m == null) { ! m = uiClass.getMethod("createUI", new Class[]{JComponent.class}); put(uiClass, m); } uiObject = MethodUtil.invoke(m, null, new Object[]{target}); } catch (NoSuchMethodException e) { --- 764,774 ---- } else { try { Method m = (Method)get(uiClass); if (m == null) { ! m = uiClass.getMethod("createUI", new Class<?>[]{JComponent.class}); put(uiClass, m); } uiObject = MethodUtil.invoke(m, null, new Object[]{target}); } catch (NoSuchMethodException e) {
*** 1104,1119 **** } ReflectUtil.checkPackageAccess(className); c = Class.forName(className, true, (ClassLoader)cl); SwingUtilities2.checkAccess(c.getModifiers()); if (methodName != null) { ! Class[] types = getClassArray(args); Method m = c.getMethod(methodName, types); return MethodUtil.invoke(m, c, args); } else { ! Class[] types = getClassArray(args); ! Constructor constructor = c.getConstructor(types); SwingUtilities2.checkAccess(constructor.getModifiers()); return constructor.newInstance(args); } } catch(Exception e) { // Ideally we would throw an exception, unfortunately --- 1103,1118 ---- } ReflectUtil.checkPackageAccess(className); c = Class.forName(className, true, (ClassLoader)cl); SwingUtilities2.checkAccess(c.getModifiers()); if (methodName != null) { ! Class<?>[] types = getClassArray(args); Method m = c.getMethod(methodName, types); return MethodUtil.invoke(m, c, args); } else { ! Class<?>[] types = getClassArray(args); ! Constructor<?> constructor = c.getConstructor(types); SwingUtilities2.checkAccess(constructor.getModifiers()); return constructor.newInstance(args); } } catch(Exception e) { // Ideally we would throw an exception, unfortunately
*** 1132,1145 **** * looks the way the Reflection APIs expect. This is done * by substituting primitive types for their Object counterparts, * and superclasses for subclasses used to add the * <code>UIResource</code> tag. */ ! private Class[] getClassArray(Object[] args) { ! Class[] types = null; if (args!=null) { ! types = new Class[args.length]; for (int i = 0; i< args.length; i++) { /* PENDING(ges): At present only the primitive types used are handled correctly; this should eventually handle all primitive types */ if (args[i] instanceof java.lang.Integer) { --- 1131,1144 ---- * looks the way the Reflection APIs expect. This is done * by substituting primitive types for their Object counterparts, * and superclasses for subclasses used to add the * <code>UIResource</code> tag. */ ! private Class<?>[] getClassArray(Object[] args) { ! Class<?>[] types = null; if (args!=null) { ! types = new Class<?>[args.length]; for (int i = 0; i< args.length; i++) { /* PENDING(ges): At present only the primitive types used are handled correctly; this should eventually handle all primitive types */ if (args[i] instanceof java.lang.Integer) {