309 if (c != null) { |
309 if (c != null) { |
310 b = ResourceBundle.getBundle(bundleName, l, c); |
310 b = ResourceBundle.getBundle(bundleName, l, c); |
311 } else { |
311 } else { |
312 b = ResourceBundle.getBundle(bundleName, l); |
312 b = ResourceBundle.getBundle(bundleName, l); |
313 } |
313 } |
314 Enumeration keys = b.getKeys(); |
314 Enumeration<String> keys = b.getKeys(); |
315 |
315 |
316 while (keys.hasMoreElements()) { |
316 while (keys.hasMoreElements()) { |
317 String key = (String)keys.nextElement(); |
317 String key = keys.nextElement(); |
318 |
318 |
319 if (values.get(key) == null) { |
319 if (values.get(key) == null) { |
320 Object value = b.getObject(key); |
320 Object value = b.getObject(key); |
321 |
321 |
322 values.put(key, value); |
322 values.put(key, value); |
680 try { |
680 try { |
681 String className = (String)get(uiClassID); |
681 String className = (String)get(uiClassID); |
682 if (className != null) { |
682 if (className != null) { |
683 ReflectUtil.checkPackageAccess(className); |
683 ReflectUtil.checkPackageAccess(className); |
684 |
684 |
685 Class cls = (Class)get(className); |
685 Class<?> cls = (Class)get(className); |
686 if (cls == null) { |
686 if (cls == null) { |
687 if (uiClassLoader == null) { |
687 if (uiClassLoader == null) { |
688 cls = SwingUtilities.loadSystemClass(className); |
688 cls = SwingUtilities.loadSystemClass(className); |
689 } |
689 } |
690 else { |
690 else { |
765 } |
764 } |
766 else { |
765 else { |
767 try { |
766 try { |
768 Method m = (Method)get(uiClass); |
767 Method m = (Method)get(uiClass); |
769 if (m == null) { |
768 if (m == null) { |
770 m = uiClass.getMethod("createUI", new Class[]{JComponent.class}); |
769 m = uiClass.getMethod("createUI", new Class<?>[]{JComponent.class}); |
771 put(uiClass, m); |
770 put(uiClass, m); |
772 } |
771 } |
773 uiObject = MethodUtil.invoke(m, null, new Object[]{target}); |
772 uiObject = MethodUtil.invoke(m, null, new Object[]{target}); |
774 } |
773 } |
775 catch (NoSuchMethodException e) { |
774 catch (NoSuchMethodException e) { |
1104 } |
1103 } |
1105 ReflectUtil.checkPackageAccess(className); |
1104 ReflectUtil.checkPackageAccess(className); |
1106 c = Class.forName(className, true, (ClassLoader)cl); |
1105 c = Class.forName(className, true, (ClassLoader)cl); |
1107 SwingUtilities2.checkAccess(c.getModifiers()); |
1106 SwingUtilities2.checkAccess(c.getModifiers()); |
1108 if (methodName != null) { |
1107 if (methodName != null) { |
1109 Class[] types = getClassArray(args); |
1108 Class<?>[] types = getClassArray(args); |
1110 Method m = c.getMethod(methodName, types); |
1109 Method m = c.getMethod(methodName, types); |
1111 return MethodUtil.invoke(m, c, args); |
1110 return MethodUtil.invoke(m, c, args); |
1112 } else { |
1111 } else { |
1113 Class[] types = getClassArray(args); |
1112 Class<?>[] types = getClassArray(args); |
1114 Constructor constructor = c.getConstructor(types); |
1113 Constructor<?> constructor = c.getConstructor(types); |
1115 SwingUtilities2.checkAccess(constructor.getModifiers()); |
1114 SwingUtilities2.checkAccess(constructor.getModifiers()); |
1116 return constructor.newInstance(args); |
1115 return constructor.newInstance(args); |
1117 } |
1116 } |
1118 } catch(Exception e) { |
1117 } catch(Exception e) { |
1119 // Ideally we would throw an exception, unfortunately |
1118 // Ideally we would throw an exception, unfortunately |
1132 * looks the way the Reflection APIs expect. This is done |
1131 * looks the way the Reflection APIs expect. This is done |
1133 * by substituting primitive types for their Object counterparts, |
1132 * by substituting primitive types for their Object counterparts, |
1134 * and superclasses for subclasses used to add the |
1133 * and superclasses for subclasses used to add the |
1135 * <code>UIResource</code> tag. |
1134 * <code>UIResource</code> tag. |
1136 */ |
1135 */ |
1137 private Class[] getClassArray(Object[] args) { |
1136 private Class<?>[] getClassArray(Object[] args) { |
1138 Class[] types = null; |
1137 Class<?>[] types = null; |
1139 if (args!=null) { |
1138 if (args!=null) { |
1140 types = new Class[args.length]; |
1139 types = new Class<?>[args.length]; |
1141 for (int i = 0; i< args.length; i++) { |
1140 for (int i = 0; i< args.length; i++) { |
1142 /* PENDING(ges): At present only the primitive types |
1141 /* PENDING(ges): At present only the primitive types |
1143 used are handled correctly; this should eventually |
1142 used are handled correctly; this should eventually |
1144 handle all primitive types */ |
1143 handle all primitive types */ |
1145 if (args[i] instanceof java.lang.Integer) { |
1144 if (args[i] instanceof java.lang.Integer) { |