harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r558953 [2/2] - in /harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/ main/java/org/apache/harmony/beans/ test/java-internal/java/beans/ test/java-internal/org/
Date Tue, 24 Jul 2007 07:58:40 GMT
Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java Tue Jul 24 00:58:36 2007
@@ -63,7 +63,7 @@
 
     BeanInfo[] additionalBeanInfo = null;
 
-    private Class beanClass;
+    private Class<?> beanClass;
 
     private int defaultEventIndex = -1;
 
@@ -77,7 +77,7 @@
 
     private boolean canRemovePropertyChangeListener;
 
-    StandardBeanInfo(Class beanClass, BeanInfo explicitBeanInfo, Class stopClass)
+    StandardBeanInfo(Class<?> beanClass, BeanInfo explicitBeanInfo, Class<?> stopClass)
             throws IntrospectionException {
         assert (beanClass != null);
         this.beanClass = beanClass;
@@ -138,22 +138,27 @@
         }
     }
 
+    @Override
     public BeanInfo[] getAdditionalBeanInfo() {
         return null;
     }
 
+    @Override
     public EventSetDescriptor[] getEventSetDescriptors() {
         return events;
     }
 
+    @Override
     public MethodDescriptor[] getMethodDescriptors() {
         return methods;
     }
 
+    @Override
     public PropertyDescriptor[] getPropertyDescriptors() {
         return properties;
     }
 
+    @Override
     public BeanDescriptor getBeanDescriptor() {
         if (explicitBeanInfo != null) {
             BeanDescriptor beanDesc = explicitBeanInfo.getBeanDescriptor();
@@ -164,14 +169,17 @@
         return new BeanDescriptor(beanClass);
     }
 
+    @Override
     public int getDefaultEventIndex() {
         return this.defaultEventIndex;
     }
 
+    @Override
     public int getDefaultPropertyIndex() {
         return this.defaultPropertyIndex;
     }
 
+    @Override
     public Image getIcon(int iconKind) {
         return icon[iconKind - 1];
     }
@@ -248,10 +256,10 @@
             Method superGet = superDesc.getReadMethod();
             Method superSet = superDesc.getWriteMethod();
 
-            Class superType = superDesc.getPropertyType();
-            Class superIndexedType = null;
-            Class subType = ((PropertyDescriptor) value).getPropertyType();
-            Class subIndexedType = null;
+            Class<?> superType = superDesc.getPropertyType();
+            Class<?> superIndexedType = null;
+            Class<?> subType = ((PropertyDescriptor) value).getPropertyType();
+            Class<?> subIndexedType = null;
 
             if (value instanceof IndexedPropertyDescriptor) {
                 subIndexedType = ((IndexedPropertyDescriptor) value)
@@ -487,7 +495,7 @@
     }
 
     private MethodDescriptor[] introspectMethods(boolean includeSuper,
-            Class introspectorClass) {
+            Class<?> introspectorClass) {
 
         // Get the list of methods belonging to this class
         Method[] basicMethods = includeSuper ? introspectorClass.getMethods()
@@ -515,7 +523,7 @@
         MethodDescriptor[] theMethods = null;
         if (methodCount > 0) {
             theMethods = new MethodDescriptor[methodCount];
-            theMethods = (MethodDescriptor[]) methodList.toArray(theMethods);
+            theMethods = methodList.toArray(theMethods);
         }
 
         return theMethods;
@@ -530,7 +538,8 @@
      * @return The list of Properties as an array of PropertyDescriptors
      * @throws IntrospectionException
      */
-    private PropertyDescriptor[] introspectProperties(Class stopClass)
+    @SuppressWarnings("unchecked")
+    private PropertyDescriptor[] introspectProperties(Class<?> stopClass)
             throws IntrospectionException {
 
         // Get descriptors for the public methods
@@ -560,7 +569,7 @@
                         tempMethods.add(method);
                     }
                 }
-                allMethods = (MethodDescriptor[]) tempMethods
+                allMethods = tempMethods
                         .toArray(new MethodDescriptor[0]);
             }
         }
@@ -570,9 +579,9 @@
         // Put the properties found into the PropertyDescriptor array
         ArrayList<PropertyDescriptor> propertyList = new ArrayList<PropertyDescriptor>();
 
-        Iterator keys = propertyTable.keySet().iterator();
+        Iterator<String> keys = propertyTable.keySet().iterator();
         while (keys.hasNext()) {
-            String propertyName = (String) keys.next();
+            String propertyName = keys.next();
             HashMap table = propertyTable.get(propertyName);
             if (table == null) {
                 continue;
@@ -610,7 +619,7 @@
             } else {
                 propertyDesc.setBound(false);
             }
-            if (table.get("isConstrained") == Boolean.TRUE) {
+            if (table.get("isConstrained") == Boolean.TRUE) { //$NON-NLS-1$
                 propertyDesc.setConstrained(true);
             }
             propertyList.add(propertyDesc);
@@ -632,6 +641,7 @@
         return false;
     }
 
+    @SuppressWarnings("nls")
     private void introspectPropertyListener(Method theMethod) {
         String methodName = theMethod.getName();
         Class[] param = theMethod.getParameterTypes();
@@ -798,7 +808,7 @@
         Class[] exceptions = theMethod.getExceptionTypes();
         for (Class e : exceptions) {
             if (e.equals(PropertyVetoException.class)) {
-                table.put("isConstrained", Boolean.TRUE);
+                table.put("isConstrained", Boolean.TRUE); //$NON-NLS-1$
             }
         }
         propertyTable.put(propertyName, table);
@@ -812,8 +822,8 @@
      * @return the events
      * @throws IntrospectionException
      */
-    private EventSetDescriptor[] introspectEvents()
-            throws IntrospectionException {
+    @SuppressWarnings("unchecked")
+    private EventSetDescriptor[] introspectEvents() {
         // Get descriptors for the public methods
         // FIXME: performance
         MethodDescriptor[] theMethods = introspectMethods();
@@ -835,9 +845,9 @@
         }
 
         ArrayList<EventSetDescriptor> eventList = new ArrayList<EventSetDescriptor>();
-        Iterator keys = eventTable.keySet().iterator();
+        Iterator<String> keys = eventTable.keySet().iterator();
         while (keys.hasNext()) {
-            String key = (String) keys.next();
+            String key = keys.next();
             HashMap table = eventTable.get(key);
             Method add = (Method) table.get(PREFIX_ADD);
             Method remove = (Method) table.get(PREFIX_REMOVE);
@@ -847,7 +857,7 @@
             }
 
             Method get = (Method) table.get(PREFIX_GET);
-            Class listenerType = (Class) table.get("listenerType"); //$NON-NLS-1$
+            Class<?> listenerType = (Class) table.get("listenerType"); //$NON-NLS-1$
             Method[] listenerMethods = (Method[]) table.get("listenerMethods"); //$NON-NLS-1$
             EventSetDescriptor eventSetDescriptor = new EventSetDescriptor(
                     decapitalize(key), listenerType, listenerMethods, add,
@@ -867,9 +877,9 @@
     /*
      * find the add, remove listener method
      */
-    @SuppressWarnings( { "unchecked", "unchecked" })
+    @SuppressWarnings("unchecked")
     private static void introspectListenerMethods(String type,
-            Method theMethod, HashMap methodsTable) {
+            Method theMethod, HashMap<String, HashMap> methodsTable) {
         String methodName = theMethod.getName();
         if (methodName == null) {
             return;
@@ -892,7 +902,7 @@
             return;
         }
 
-        Class listenerType = paramTypes[0];
+        Class<?> listenerType = paramTypes[0];
 
         if (!EventListener.class.isAssignableFrom(listenerType)) {
             return;
@@ -902,7 +912,7 @@
             return;
         }
 
-        HashMap table = (HashMap) methodsTable.get(eventName);
+        HashMap table = methodsTable.get(eventName);
         if (table == null) {
             table = new HashMap();
         }
@@ -932,7 +942,7 @@
         methodsTable.put(eventName, table);
     }
 
-    private static Method[] introspectListenerMethods(Class listenerType) {
+    private static Method[] introspectListenerMethods(Class<?> listenerType) {
         Method[] methods = listenerType.getDeclaredMethods();
         ArrayList<Method> list = new ArrayList<Method>();
         for (int i = 0; i < methods.length; i++) {
@@ -952,7 +962,7 @@
 
     @SuppressWarnings("unchecked")
     private static void introspectGetListenerMethods(Method theMethod,
-            HashMap methodsTable) {
+            HashMap<String, HashMap> methodsTable) {
         String type = PREFIX_GET;
 
         String methodName = theMethod.getName();
@@ -985,7 +995,7 @@
             return;
         }
 
-        HashMap table = (HashMap) methodsTable.get(eventName);
+        HashMap table = methodsTable.get(eventName);
         if (table == null) {
             table = new HashMap();
         }

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java Tue Jul 24 00:58:36 2007
@@ -63,27 +63,27 @@
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
-        Object target = getTarget();
-        String methodName = getMethodName();
-        Object[] arguments = getArguments();
-        String targetVar = target != null ? convertClassName(target.getClass()) : "null"; //$NON-NLS-1$
+        Object theTarget = getTarget();
+        String theMethodName = getMethodName();
+        Object[] theArguments = getArguments();
+        String targetVar = theTarget != null ? convertClassName(theTarget.getClass()) : "null"; //$NON-NLS-1$
         sb.append(targetVar);
         sb.append('.');
-        sb.append(methodName);
+        sb.append(theMethodName);
         sb.append('(');
-        if (arguments != null) {
-            for (int i = 0; i < arguments.length; ++i) {
+        if (theArguments != null) {
+            for (int i = 0; i < theArguments.length; ++i) {
                 if (i > 0) {
                     sb.append(", "); //$NON-NLS-1$
                 }
-                if (arguments[i] == null) {
+                if (theArguments[i] == null) {
                     sb.append("null"); //$NON-NLS-1$
-                } else if (arguments[i] instanceof String) {
+                } else if (theArguments[i] instanceof String) {
                     sb.append('"');
-                    sb.append(arguments[i].toString());
+                    sb.append(theArguments[i].toString());
                     sb.append('"');
                 } else {
-                    sb.append(convertClassName(arguments[i].getClass()));
+                    sb.append(convertClassName(theArguments[i].getClass()));
                 }
             }
         }
@@ -111,29 +111,29 @@
     Object invokeMethod() throws Exception {
         Object result = null;
         try {
-            Object target = getTarget();
-            String methodName = getMethodName();
-            Object[] arguments = getArguments();
-            if (target.getClass().isArray()) {
-                Method method = findArrayMethod(methodName, arguments);
-                Object[] args = new Object[arguments.length + 1];
-                args[0] = target;
-                System.arraycopy(arguments, 0, args, 1, arguments.length);
+            Object theTarget = getTarget();
+            String theMethodName = getMethodName();
+            Object[] theArguments = getArguments();
+            if (theTarget.getClass().isArray()) {
+                Method method = findArrayMethod(theMethodName, theArguments);
+                Object[] args = new Object[theArguments.length + 1];
+                args[0] = theTarget;
+                System.arraycopy(theArguments, 0, args, 1, theArguments.length);
                 result = method.invoke(null, args);
-            } else if (methodName.equals("newInstance") //$NON-NLS-1$
-                    && target == Array.class) {
-                Class<?> componentType = (Class) arguments[0];
-                int length = ((Integer) arguments[1]).intValue();
+            } else if (theMethodName.equals("newInstance") //$NON-NLS-1$
+                    && theTarget == Array.class) {
+                Class<?> componentType = (Class) theArguments[0];
+                int length = ((Integer) theArguments[1]).intValue();
                 result = Array.newInstance(componentType, length);
-            } else if (methodName.equals("new") //$NON-NLS-1$
-                    || methodName.equals("newInstance")) { //$NON-NLS-1$
-                if (target instanceof Class) {
-                    Constructor<?> constructor = findConstructor((Class)target, arguments);
-                    result = constructor.newInstance(arguments);
+            } else if (theMethodName.equals("new") //$NON-NLS-1$
+                    || theMethodName.equals("newInstance")) { //$NON-NLS-1$
+                if (theTarget instanceof Class) {
+                    Constructor<?> constructor = findConstructor((Class)theTarget, theArguments);
+                    result = constructor.newInstance(theArguments);
                 } else {
                     throw new NoSuchMethodException(this.toString());
                 }
-            } else if (target instanceof Class) {
+            } else if (theTarget instanceof Class) {
                 Method method = null;
                 boolean found = false;
                 try {
@@ -142,36 +142,37 @@
                      * given Class object at first process only if the class
                      * differs from Class itself
                      */
-                    if (target != Class.class) {
-                        method = findMethod((Class) target, methodName, arguments, true);
-                        result = method.invoke(null, arguments);
+                    if (theTarget != Class.class) {
+                        method = findMethod((Class) theTarget, theMethodName, theArguments, true);
+                        result = method.invoke(null, theArguments);
                         found = true;
                     }
                 } catch (NoSuchMethodException e) {
+                    // expected
                 }
                 if (!found) {
                     // static method was not found
                     // try to invoke method of Class object
-                    if (methodName.equals("forName") //$NON-NLS-1$
-                            && arguments.length == 1 && arguments[0] instanceof String) {
+                    if (theMethodName.equals("forName") //$NON-NLS-1$
+                            && theArguments.length == 1 && theArguments[0] instanceof String) {
                         // special handling of Class.forName(String)
                         try {
-                            result = Class.forName((String) arguments[0]);
+                            result = Class.forName((String) theArguments[0]);
                         } catch (ClassNotFoundException e2) {
-                            result = Class.forName((String) arguments[0], true, Thread
+                            result = Class.forName((String) theArguments[0], true, Thread
                                     .currentThread().getContextClassLoader());
                         }
                     } else {
-                        method = findMethod(target.getClass(), methodName, arguments, false);
-                        result = method.invoke(target, arguments);
+                        method = findMethod(theTarget.getClass(), theMethodName, theArguments, false);
+                        result = method.invoke(theTarget, theArguments);
                     }
                 }
-            } else if (target instanceof Iterator){
-            	final Iterator iterator = (Iterator) target;
-				final Method method = findMethod(target.getClass(), methodName,
-						arguments, false);
+            } else if (theTarget instanceof Iterator){
+            	final Iterator<?> iterator = (Iterator) theTarget;
+				final Method method = findMethod(theTarget.getClass(), theMethodName,
+						theArguments, false);
 				if (iterator.hasNext()) {
-					PrivilegedAction action = new PrivilegedAction() {
+					PrivilegedAction<Object> action = new PrivilegedAction<Object>() {
 
 						public Object run() {
 							try {
@@ -187,8 +188,8 @@
 					result = action.run();
 				}
             } else {
-                Method method = findMethod(target.getClass(), methodName, arguments, false);
-                result = method.invoke(target, arguments);
+                Method method = findMethod(theTarget.getClass(), theMethodName, theArguments, false);
+                result = method.invoke(theTarget, theArguments);
             }
         } catch (InvocationTargetException ite) {
             Throwable t = ite.getCause();
@@ -197,18 +198,18 @@
         return result;
     }
 
-    private Method findArrayMethod(String methodName, Object[] arguments) throws NoSuchMethodException {
+    private Method findArrayMethod(String theMethodName, Object[] theArguments) throws NoSuchMethodException {
         // the code below reproduces exact RI exception throwing behavior
-        if (!methodName.equals("set") && !methodName.equals("get")) { //$NON-NLS-1$ //$NON-NLS-2$
+        if (!theMethodName.equals("set") && !theMethodName.equals("get")) { //$NON-NLS-1$ //$NON-NLS-2$
             throw new NoSuchMethodException(Messages.getString("beans.3C")); //$NON-NLS-1$
-        } else if (arguments.length > 0 && arguments[0].getClass() != Integer.class) {
+        } else if (theArguments.length > 0 && theArguments[0].getClass() != Integer.class) {
             throw new ClassCastException(Messages.getString("beans.3D")); //$NON-NLS-1$
-        } else if (methodName.equals("get") && (arguments.length != 1)) { //$NON-NLS-1$
+        } else if (theMethodName.equals("get") && (theArguments.length != 1)) { //$NON-NLS-1$
             throw new ArrayIndexOutOfBoundsException(Messages.getString("beans.3E")); //$NON-NLS-1$
-        } else if (methodName.equals("set") && (arguments.length != 2)) { //$NON-NLS-1$
+        } else if (theMethodName.equals("set") && (theArguments.length != 2)) { //$NON-NLS-1$
             throw new ArrayIndexOutOfBoundsException(Messages.getString("beans.3F")); //$NON-NLS-1$
         }
-        if (methodName.equals("get")) { //$NON-NLS-1$
+        if (theMethodName.equals("get")) { //$NON-NLS-1$
             return Array.class.getMethod("get", new Class[] { Object.class, //$NON-NLS-1$
                     int.class });
         }
@@ -216,8 +217,8 @@
                 int.class, Object.class });
     }
 
-    private Constructor<?> findConstructor(Class targetClass, Object[] arguments) throws NoSuchMethodException {
-        Class<?>[] argClasses = getClasses(arguments);
+    private Constructor<?> findConstructor(Class<?> targetClass, Object[] theArguments) throws NoSuchMethodException {
+        Class<?>[] argClasses = getClasses(theArguments);
         Constructor<?> result = null;
         Constructor<?>[] constructors = targetClass.getConstructors();
         for (Constructor<?> constructor : constructors) {
@@ -297,7 +298,7 @@
             int difference = comparator.compare(chosenOne, foundMethodsArr[i]);
             //if 2 methods have same relevance, throw exception
             if(difference == 0){
-                throw new NoSuchMethodException("Cannot decide which method to call: "+methodName);
+                throw new NoSuchMethodException("Cannot decide which method to call: "+methodName); //$NON-NLS-1$
             }
             if(difference > 0){
                 chosenOne = foundMethodsArr[i];

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StaticFieldPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StaticFieldPersistenceDelegate.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StaticFieldPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StaticFieldPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -35,7 +35,7 @@
 			try {
 				value = field[i].get(clz);
 			} catch (Exception e) {
-				// expected
+				return;
 			}
 			if (value.getClass() == clz) {
 				pairs.put(value, field[i].getName());
@@ -51,7 +51,7 @@
 		} catch (Exception e) {
 			enc.getExceptionListener().exceptionThrown(e);
 		}
-		return new Expression(oldInstance, field, "get",
+		return new Expression(oldInstance, field, "get", //$NON-NLS-1$
 				new Object[] { oldInstance.getClass() });
 	}
 

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingAbstractButtonPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingAbstractButtonPersistenceDelegate.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingAbstractButtonPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingAbstractButtonPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -25,7 +25,9 @@
  * 
  */
 class SwingAbstractButtonPersistenceDelegate extends DefaultPersistenceDelegate{
-	protected void initialize(Class<?> type, Object oldInstance,
+    @Override
+	@SuppressWarnings({ "boxing", "nls" })
+    protected void initialize(Class<?> type, Object oldInstance,
             Object newInstance, Encoder enc) {
         // Call the initialization of the super type
         super.initialize(type, oldInstance, newInstance, enc);

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingBoxPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingBoxPersistenceDelegate.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingBoxPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingBoxPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -20,12 +20,15 @@
 import javax.swing.Box;
 
 class SwingBoxPersistenceDelegate extends PersistenceDelegate {
-	protected Expression instantiate(Object oldInstance, Encoder enc) {
+	@Override
+    protected Expression instantiate(Object oldInstance, Encoder enc) {
 		return new Expression(oldInstance, oldInstance.getClass(),
-				"createVerticalBox", null);
+				"createVerticalBox", null); //$NON-NLS-1$
 	}
 
-	protected void initialize(Class<?> type, Object oldInstance,
+    @Override
+    @SuppressWarnings({ "nls", "boxing" })
+    protected void initialize(Class<?> type, Object oldInstance,
 			Object newInstance, Encoder enc) {
 		Box box = (Box) oldInstance;
 		Expression getterExp = new Expression(box.getAlignmentX(), box,

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingDefaultComboBoxModelPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingDefaultComboBoxModelPersistenceDelegate.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingDefaultComboBoxModelPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingDefaultComboBoxModelPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -22,7 +22,9 @@
 
 class SwingDefaultComboBoxModelPersistenceDelegate extends
 		DefaultPersistenceDelegate {
-	protected void initialize(Class<?> type, Object oldInstance,
+    @Override
+    @SuppressWarnings({ "nls", "boxing" })
+    protected void initialize(Class<?> type, Object oldInstance,
 			Object newInstance, Encoder enc) {
 		super.initialize(type, oldInstance, newInstance, enc);
 
@@ -42,7 +44,7 @@
 				// Get the current property value in the new environment
 				Object newVal = null;
 				try {
-					newVal = new Expression(((DefaultComboBoxModel) newInstance), "getElementAt",
+					newVal = new Expression(newInstance, "getElementAt",
 							new Object[] { i }).getValue();
 				} catch (IndexOutOfBoundsException ex) {
 					// The newInstance has no elements, so current property

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingJFramePersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingJFramePersistenceDelegate.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingJFramePersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingJFramePersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -22,7 +22,9 @@
 import javax.swing.JFrame;
 
 class SwingJFramePersistenceDelegate extends DefaultPersistenceDelegate {
-	protected void initialize(Class<?> type, Object oldInstance,
+    @Override
+    @SuppressWarnings("nls")
+    protected void initialize(Class<?> type, Object oldInstance,
             Object newInstance, Encoder enc) {
         // Call the initialization of the super type
         super.initialize(type, oldInstance, newInstance, enc);

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingJTabbedPanePersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingJTabbedPanePersistenceDelegate.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingJTabbedPanePersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingJTabbedPanePersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -21,7 +21,9 @@
 
 class SwingJTabbedPanePersistenceDelegate extends
 		DefaultPersistenceDelegate {
-	protected void initialize(Class<?> type, Object oldInstance,
+    @Override
+    @SuppressWarnings({ "nls", "boxing" })
+    protected void initialize(Class<?> type, Object oldInstance,
             Object newInstance, Encoder enc) {
         // Call the initialization of the super type
         super.initialize(type, oldInstance, newInstance, enc);
@@ -66,11 +68,9 @@
                         enc.writeStatement(setterStm);
                     }
                 } else {
-                    PersistenceDelegate pd = enc
-                            .getPersistenceDelegate(targetVal.getClass());
-                    	Statement setterStm = new Statement(oldInstance, "addTab",
-                                new Object[] { pane.getTitleAt(i), oldVal });
-                        enc.writeStatement(setterStm);
+                    Statement setterStm = new Statement(oldInstance, "addTab",
+                            new Object[] { pane.getTitleAt(i), oldVal });
+                    enc.writeStatement(setterStm);
                 }
             } catch (Exception ex) {
                 enc.getExceptionListener().exceptionThrown(ex);

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingToolTipManagerPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingToolTipManagerPersistenceDelegate.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingToolTipManagerPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SwingToolTipManagerPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -22,7 +22,7 @@
 	@Override
 	protected Expression instantiate(Object oldInstance, Encoder enc) {
 		return new Expression(oldInstance, oldInstance.getClass(),
-				"sharedInstance", null);
+				"sharedInstance", null); //$NON-NLS-1$
 	}
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilCollectionPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -23,11 +23,12 @@
 class UtilCollectionPersistenceDelegate extends
         DefaultPersistenceDelegate {
     @Override
+    @SuppressWarnings("nls")
     protected void initialize(Class<?> type, Object oldInstance,
             Object newInstance, Encoder enc) {
 
-        Collection oldList = (Collection) oldInstance, newList = (Collection)newInstance;
-        Iterator oldIterator = oldList.iterator(), newIterator = newList.iterator();
+        Collection<?> oldList = (Collection) oldInstance, newList = (Collection)newInstance;
+        Iterator<?> oldIterator = oldList.iterator(), newIterator = newList.iterator();
         for (; oldIterator.hasNext();) {
             Expression getterExp = new Expression(oldIterator, "next", null);
             try {

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilDatePersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilDatePersistenceDelegate.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilDatePersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilDatePersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -20,6 +20,8 @@
 import java.util.Date;
 
 class UtilDatePersistenceDelegate extends DefaultPersistenceDelegate {
+    @Override
+    @SuppressWarnings("boxing")
     protected Expression instantiate(Object oldInstance, Encoder enc) {
         Date date = (Date) oldInstance;
         return new Expression(oldInstance, oldInstance.getClass(),

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/UtilListPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -20,10 +20,12 @@
 import java.util.List;
 
 class UtilListPersistenceDelegate extends DefaultPersistenceDelegate {
+    @Override
+    @SuppressWarnings({ "nls", "boxing" })
     protected void initialize(Class<?> type, Object oldInstance,
             Object newInstance, Encoder enc) {
 
-        List list = (List) oldInstance;
+        List<?> list = (List) oldInstance;
         int size = list.size();
         for (int i = 0; i < size; i++) {
             Expression getterExp = new Expression(oldInstance, "get",

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java Tue Jul 24 00:58:36 2007
@@ -121,10 +121,10 @@
             result.addAll(globalListeners);
         }
 
-        for (Iterator iterator = children.keySet().iterator(); iterator
+        for (Iterator<String> iterator = children.keySet().iterator(); iterator
                 .hasNext();) {
-            String propertyName = (String) iterator.next();
-            VetoableChangeSupport namedListener = (VetoableChangeSupport) children
+            String propertyName = iterator.next();
+            VetoableChangeSupport namedListener = children
                     .get(propertyName);
             VetoableChangeListener[] childListeners = namedListener
                     .getVetoableChangeListeners();
@@ -133,7 +133,7 @@
                         childListeners[i]));
             }
         }
-        return (VetoableChangeListener[]) (result
+        return (result
                 .toArray(new VetoableChangeListener[result.size()]));
     }
 
@@ -167,6 +167,7 @@
         } while (listener != null);
     }
 
+    @SuppressWarnings("boxing")
     public void fireVetoableChange(String propertyName, boolean oldValue,
             boolean newValue) throws PropertyVetoException {
         PropertyChangeEvent event = createPropertyChangeEvent(propertyName,
@@ -174,6 +175,7 @@
         doFirePropertyChange(event);
     }
 
+    @SuppressWarnings("boxing")
     public void fireVetoableChange(String propertyName, int oldValue,
             int newValue) throws PropertyVetoException {
         PropertyChangeEvent event = createPropertyChangeEvent(propertyName,
@@ -234,6 +236,7 @@
                 try {
                     listener.vetoableChange(revertEvent);
                 } catch (PropertyVetoException ignored) {
+                    // expected
                 }
             }
             throw pve;

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLDecoder.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLDecoder.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLDecoder.java Tue Jul 24 00:58:36 2007
@@ -47,7 +47,7 @@
 
         public void exceptionThrown(Exception e) {
             e.printStackTrace();
-            System.err.println("Continue...");
+            System.err.println("Continue..."); //$NON-NLS-1$
         }
     }
 
@@ -57,13 +57,14 @@
 
         HashMap<String, Object> idObjMap = new HashMap<String, Object>();
 
+        @Override
         public void characters(char[] ch, int start, int length)
                 throws SAXException {
             if (!inJavaElem) {
                 return;
             }
             if (readObjs.size() > 0) {
-                Elem elem = (Elem) readObjs.peek();
+                Elem elem = readObjs.peek();
                 if (elem.isBasicType) {
                     String str = new String(ch, start, length);
                     elem.methodName = elem.methodName == null ? str
@@ -72,6 +73,8 @@
             }
         }
 
+        @SuppressWarnings("nls")
+        @Override
         public void startElement(String uri, String localName, String qName,
                 Attributes attributes) throws SAXException {
             if (!inJavaElem) {
@@ -100,7 +103,8 @@
             }
         }
 
-        private void startObjectElem(Attributes attributes) throws SAXException {
+        @SuppressWarnings("nls")
+        private void startObjectElem(Attributes attributes) {
             Elem elem = new Elem();
             elem.isExpression = true;
             elem.id = attributes.getValue("id");
@@ -114,7 +118,7 @@
         }
 
         private void obtainTarget(Elem elem, Attributes attributes) {
-            String className = attributes.getValue("class");
+            String className = attributes.getValue("class"); //$NON-NLS-1$
             if (className != null) {
                 try {
                     elem.target = classForName(className);
@@ -131,6 +135,7 @@
             }
         }
 
+        @SuppressWarnings("nls")
         private void obtainMethod(Elem elem, Attributes attributes) {
             elem.methodName = attributes.getValue("method");
             if (elem.methodName != null) {
@@ -164,7 +169,8 @@
             elem.methodName = "new"; // default method name
         }
 
-        private Class classForName(String className)
+        @SuppressWarnings("nls")
+        private Class<?> classForName(String className)
                 throws ClassNotFoundException {
             if ("boolean".equals(className)) {
                 return Boolean.TYPE;
@@ -189,13 +195,14 @@
             }
         }
 
+        @SuppressWarnings("nls")
         private void startArrayElem(Attributes attributes) {
             Elem elem = new Elem();
             elem.isExpression = true;
             elem.id = attributes.getValue("id");
             try {
                 // find componet class
-                Class compClass = classForName(attributes.getValue("class"));
+                Class<?> compClass = classForName(attributes.getValue("class"));
                 // find length
                 int length = Integer.parseInt(attributes.getValue("length"));
                 // execute, new array instance
@@ -207,6 +214,7 @@
             readObjs.push(elem);
         }
 
+        @SuppressWarnings("nls")
         private void startVoidElem(Attributes attributes) {
             Elem elem = new Elem();
             elem.id = attributes.getValue("id");
@@ -215,6 +223,7 @@
             readObjs.push(elem);
         }
 
+        @SuppressWarnings("nls")
         private void startBasicElem(String tagName, Attributes attributes) {
             Elem elem = new Elem();
             elem.isBasicType = true;
@@ -225,12 +234,13 @@
             readObjs.push(elem);
         }
 
+        @Override
         public void endElement(String uri, String localName, String qName)
                 throws SAXException {
             if (!inJavaElem) {
                 return;
             }
-            if ("java".equals(qName)) {
+            if ("java".equals(qName)) { //$NON-NLS-1$
                 inJavaElem = false;
                 return;
             }
@@ -252,7 +262,7 @@
 
         private Elem latestUnclosedElem() {
             for (int i = readObjs.size() - 1; i >= 0; i--) {
-                Elem elem = (Elem) readObjs.get(i);
+                Elem elem = readObjs.get(i);
                 if (!elem.isClosed) {
                     return elem;
                 }
@@ -287,11 +297,12 @@
             return elem.result;
         }
 
+        @SuppressWarnings("nls")
         private Object executeCommon(Elem elem) throws Exception {
             // pop args
             ArrayList<Object> args = new ArrayList<Object>(5);
             while (readObjs.peek() != elem) {
-                Elem argElem = (Elem) readObjs.pop();
+                Elem argElem = readObjs.pop();
                 args.add(0, argElem.result);
             }
             // decide method name
@@ -316,14 +327,13 @@
 			if(elem.target == owner) {
 				if("getOwner".equals(method)) {
 					return owner;
-				} else {
-					Class[] c = new Class[args.size()];
-					for(int i = 0; i < args.size(); i++) {
-						c[i] = args.get(i).getClass();
-					}
-					Method m = owner.getClass().getMethod(method, c);
-					return m.invoke(owner, args.toArray());
 				}
+                Class[] c = new Class[args.size()];
+                for(int i = 0; i < args.size(); i++) {
+                	c[i] = args.get(i).getClass();
+                }
+                Method m = owner.getClass().getMethod(method, c);
+                return m.invoke(owner, args.toArray());
 			}
 			
             // execute
@@ -337,6 +347,7 @@
             return buf.toString();
         }
 
+        @SuppressWarnings("nls")
         private Object executeBasic(Elem elem) throws Exception {
             String tag = (String) elem.target;
             String value = elem.methodName;
@@ -368,14 +379,17 @@
             }
         }
 
+        @Override
         public void error(SAXParseException e) throws SAXException {
             listener.exceptionThrown(e);
         }
 
+        @Override
         public void fatalError(SAXParseException e) throws SAXException {
             listener.exceptionThrown(e);
         }
 
+        @Override
         public void warning(SAXParseException e) throws SAXException {
             listener.exceptionThrown(e);
         }
@@ -448,20 +462,17 @@
     public XMLDecoder(InputStream inputStream, Object owner,
             ExceptionListener listener) {
         if (inputStream == null) {
-            throw new IllegalArgumentException("Input stream cannot be null");
-        }
-        if (listener == null) {
-            listener = new DefaultExceptionListener();
+            throw new IllegalArgumentException("Input stream cannot be null"); //$NON-NLS-1$
         }
         this.inputStream = inputStream;
         this.owner = owner;
-        this.listener = listener;
+        this.listener = (listener == null)? new DefaultExceptionListener(): listener;
 
         try {
             SAXParserFactory.newInstance().newSAXParser().parse(inputStream,
                     new SAXHandler());
         } catch (Exception e) {
-            listener.exceptionThrown(e);
+            this.listener.exceptionThrown(e);
         }
     }
     
@@ -504,11 +515,12 @@
      * @return the next object
      * @exception ArrayIndexOutOfBoundsException if no more objects to read
      */
+    @SuppressWarnings("nls")
     public Object readObject() {
         if (readObjIndex >= readObjs.size()) {
             throw new ArrayIndexOutOfBoundsException("no more objects to read");
         }
-        Elem elem = (Elem) readObjs.get(readObjIndex);
+        Elem elem = readObjs.get(readObjIndex);
         if (!elem.isClosed) {
             // bad element, error occured while parsing
             throw new ArrayIndexOutOfBoundsException("no more objects to read");

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLEncoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLEncoder.java?view=diff&rev=558953&r1=558952&r2=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLEncoder.java (original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLEncoder.java Tue Jul 24 00:58:36 2007
@@ -106,7 +106,7 @@
 		if (null != out) {
             try {
                 this.out = new PrintWriter(
-                        new OutputStreamWriter(out, "UTF-8"), true);
+                        new OutputStreamWriter(out, "UTF-8"), true); //$NON-NLS-1$
             } catch (UnsupportedEncodingException e) {
                 // never occur
                 e.printStackTrace();
@@ -120,7 +120,7 @@
 	 */
 	public void close() {
 		flush();
-		out.println("</java>");
+		out.println("</java>"); //$NON-NLS-1$
 		out.close();
 	}
 
@@ -137,7 +137,8 @@
 	 * writtern. Then all pending objects since last flush are writtern.
 	 * </p>
 	 */
-	public void flush() {
+	@SuppressWarnings("nls")
+    public void flush() {
 		synchronized (this) {
 			// write xml header
 			if (!hasXmlHeader) {
@@ -149,7 +150,7 @@
 			}
 
 			// preprocess pending objects
-			for (Iterator iter = flushPending.iterator(); iter.hasNext();) {
+			for (Iterator<Object> iter = flushPending.iterator(); iter.hasNext();) {
 				Object o = iter.next();
 				Record rec = (Record) records.get(o);
 				if (rec != null) {
@@ -158,7 +159,7 @@
 			}
 
 			// flush pending objects
-			for (Iterator iter = flushPending.iterator(); iter.hasNext();) {
+			for (Iterator<Object> iter = flushPending.iterator(); iter.hasNext();) {
 				Object o = iter.next();
 				flushObject(o, INDENT_UNIT);
 				// remove flushed obj
@@ -174,7 +175,8 @@
 		}
 	}
 
-	private void flushBasicObject(Object obj, int indent) {
+	@SuppressWarnings("nls")
+    private void flushBasicObject(Object obj, int indent) {
 		if( obj instanceof Proxy) {
 			return;
 		}
@@ -236,7 +238,8 @@
 		}
 	}
 
-	private void flushExpression(Object obj, Record rec, int indent,
+	@SuppressWarnings("nls")
+    private void flushExpression(Object obj, Record rec, int indent,
 			boolean asStatement) {
 		// not first time, use idref
 		if (rec.id != null) {
@@ -261,7 +264,7 @@
 
 	private void flushIndent(int indent) {
 		for (int i = 0; i < indent; i++) {
-			out.print(" ");
+			out.print(" "); //$NON-NLS-1$
 		}
 	}
 
@@ -287,7 +290,8 @@
 		}
 	}
 
-	private void flushOwner(Object obj, Record rec, int indent) {
+	@SuppressWarnings("nls")
+    private void flushOwner(Object obj, Record rec, int indent) {
 		if (rec.refCount > 1) {
 			rec.id = nameForClass(obj.getClass()) + idSerialNo;
 			idSerialNo++;
@@ -329,7 +333,8 @@
 		out.println(">");
 	}
 
-	private void flushStatArray(Statement stat, String id, List subStats,
+	@SuppressWarnings("nls")
+    private void flushStatArray(Statement stat, String id, List<?> subStats,
 			int indent) {
 		// open tag, begin
 		flushIndent(indent);
@@ -364,7 +369,8 @@
 		out.println("</array>");
 	}
 
-	private void flushStatCommon(Statement stat, String id, List subStats,
+	@SuppressWarnings("nls")
+    private void flushStatCommon(Statement stat, String id, List<?> subStats,
 			int indent) {
 		// open tag, begin
 		flushIndent(indent);
@@ -415,7 +421,8 @@
 		out.println(">");
 	}
 
-	private void flushStatement(Statement stat, String id, List subStats,
+	@SuppressWarnings("nls")
+    private void flushStatement(Statement stat, String id, List<?> subStats,
 			int indent) {
 		Object target = stat.getTarget();
 		String method = stat.getMethodName();
@@ -440,7 +447,7 @@
 
 		if (isStaticConstantsSupported
 				&& "getField".equals(stat.getMethodName())) {
-			flushStatField(stat, id, subStats, indent);
+			flushStatField(stat, id, indent);
 			return;
 		}
 
@@ -448,7 +455,8 @@
 		flushStatCommon(stat, id, subStats, indent);
 	}
 
-	private void flushStatField(Statement stat, String id, List subStats,
+	@SuppressWarnings("nls")
+    private void flushStatField(Statement stat, String id, 
 			int indent) {
 		// open tag, begin
 		flushIndent(indent);
@@ -483,15 +491,16 @@
 			out.print(stat.getMethodName());
 			out.print("\"");
 			out.println(">");
-			Object fieldName = (String) stat.getArguments()[0];
+			Object fieldName = stat.getArguments()[0];
 			flushObject(fieldName, indent + INDENT_UNIT);
 			flushIndent(indent);
 			out.println("</object>");
 		}
 	}
 
-	private void flushStatGetterSetter(Statement stat, String id,
-			List subStats, int indent) {
+	@SuppressWarnings("nls")
+    private void flushStatGetterSetter(Statement stat, String id,
+			List<?> subStats, int indent) {
 		// open tag, begin
 		flushIndent(indent);
 		String tagName = stat instanceof Expression ? "object" : "void";
@@ -539,7 +548,8 @@
 		out.println(">");
 	}
 
-	private void flushStatIndexed(Statement stat, String id, List subStats,
+	@SuppressWarnings("nls")
+    private void flushStatIndexed(Statement stat, String id, List<?> subStats,
 			int indent) {
 		// open tag, begin
 		flushIndent(indent);
@@ -588,7 +598,8 @@
 		out.println(">");
 	}
 
-	private void flushString(String s) {
+	@SuppressWarnings("nls")
+    private void flushString(String s) {
 		char c;
 		for (int i = 0; i < s.length(); i++) {
 			c = s.charAt(i);
@@ -608,7 +619,7 @@
 		}
 	}
 
-	private void flushSubStatements(List subStats, int indent) {
+	private void flushSubStatements(List<?> subStats, int indent) {
 		for (int i = 0; i < subStats.size(); i++) {
 			Statement subStat = (Statement) subStats.get(i);
 			try {
@@ -647,35 +658,33 @@
 	}
 
 	private boolean isGetArrayStat(Object target, String method, Object[] args) {
-		return ("get".equals(method) && args.length == 1
+		return ("get".equals(method) && args.length == 1 //$NON-NLS-1$
 				&& args[0] instanceof Integer && target.getClass().isArray());
 	}
 
 	private boolean isGetPropertyStat(String method, Object[] args) {
-		return (method.startsWith("get") && method.length() > 3 && args.length == 0);
+		return (method.startsWith("get") && method.length() > 3 && args.length == 0); //$NON-NLS-1$
 	}
 
 	private boolean isSetArrayStat(Object target, String method, Object[] args) {
-		return ("set".equals(method) && args.length == 2
+		return ("set".equals(method) && args.length == 2 //$NON-NLS-1$
 				&& args[0] instanceof Integer && target.getClass().isArray());
 	}
 
 	private boolean isSetPropertyStat(String method, Object[] args) {
-		return (method.startsWith("set") && method.length() > 3 && args.length == 1);
+		return (method.startsWith("set") && method.length() > 3 && args.length == 1); //$NON-NLS-1$
 	}
 
-	private String nameForClass(Class c) {
+	private String nameForClass(Class<?> c) {
 		if (c.isArray()) {
-			return nameForClass(c.getComponentType()) + "Array";
-		} else {
-			String name = c.getName();
-			int i = name.lastIndexOf('.');
-			if (-1 == i) {
-				return name;
-			} else {
-				return name.substring(i + 1);
-			}
+			return nameForClass(c.getComponentType()) + "Array"; //$NON-NLS-1$
 		}
+        String name = c.getName();
+        int i = name.lastIndexOf('.');
+        if (-1 == i) {
+        	return name;
+        }
+        return name.substring(i + 1);
 	}
 
 	/*
@@ -698,7 +707,7 @@
 		// deal with 'field' property
 		try {
 			if (isStaticConstantsSupported
-					&& "getField".equals(((Record) records.get(rec.exp
+					&& "getField".equals(((Record) records.get(rec.exp //$NON-NLS-1$
 							.getTarget())).exp.getMethodName())) {
 				records.remove(obj);
 			}
@@ -717,7 +726,7 @@
 			}
 		}
 
-		for (Iterator iter = rec.stats.iterator(); iter.hasNext();) {
+		for (Iterator<?> iter = rec.stats.iterator(); iter.hasNext();) {
 			Statement subStat = (Statement) iter.next();
 			if (subStat instanceof Expression) {
 				try {
@@ -765,14 +774,10 @@
 
 		if (rec.exp == null) {
 			// it is generated by its sub stats
-			for (Iterator iter = rec.stats.iterator(); iter.hasNext();) {
+			for (Iterator<?> iter = rec.stats.iterator(); iter.hasNext();) {
 				Statement stat = (Statement) iter.next();
 				try {
 					if (stat instanceof Expression) {
-                        // Expression expr = (Expression) stat;
-                        // Object subObj = expr.getValue();
-                        // if(expr.getTarget().getClass() ==
-                        // Class.class.getClass())
 						flushPrePending.add(value);
 					}
 				} catch (Exception e) {
@@ -822,7 +827,8 @@
 	 * Records the expression so that it can be writtern out later, then calls
 	 * super implementation.
 	 */
-	public void writeExpression(Expression oldExp) {
+	@Override
+    public void writeExpression(Expression oldExp) {
 	    boolean oldWritingObject = writingObject;
 	    writingObject = true;
 		// get expression value
@@ -832,7 +838,7 @@
 		} catch (Exception e) {
 			getExceptionListener()
 					.exceptionThrown(
-							new Exception("failed to execute expression: "
+							new Exception("failed to execute expression: " //$NON-NLS-1$
 									+ oldExp, e));
 			return;
 		}
@@ -855,7 +861,8 @@
 	 * Records the object so that it can be writtern out later, then calls super
 	 * implementation.
 	 */
-	public void writeObject(Object o) {
+	@Override
+    public void writeObject(Object o) {
 		synchronized (this) {
 			boolean oldWritingObject = writingObject;
 			writingObject = true;
@@ -889,7 +896,8 @@
 	 * Records the statement so that it can be writtern out later, then calls
 	 * super implementation.
 	 */
-	public void writeStatement(Statement oldStat) {
+	@Override
+    public void writeStatement(Statement oldStat) {
 		// record how the object is changed
 		recordStatement(oldStat);
 

Added: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_ClassPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_ClassPersistenceDelegate.java?view=auto&rev=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_ClassPersistenceDelegate.java (added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_ClassPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package java.beans;
+
+import java.lang.reflect.Field;
+
+class java_lang_ClassPersistenceDelegate extends PersistenceDelegate {
+    @Override
+    protected Expression instantiate(Object oldInstance, Encoder out) {
+        Class<?> value = (Class) oldInstance;
+        Field fld = null;
+        final String TYPE = "TYPE"; //$NON-NLS-1$
+        Expression result;
+        /*
+         * Special treatment to String.class to prevent endless loop of
+         * instantiation.
+         */
+        if (value == String.class) {
+            return new Expression(value, "", "getClass", null); //$NON-NLS-1$//$NON-NLS-2$
+        }
+        try {
+            if (value.equals(Integer.TYPE)) {
+                fld = Integer.class.getField(TYPE);
+            } else if (value.equals(Short.TYPE)) {
+                fld = Short.class.getField(TYPE);
+            } else if (value.equals(Long.TYPE)) {
+                fld = Long.class.getField(TYPE);
+            } else if (value.equals(Float.TYPE)) {
+                fld = Float.class.getField(TYPE);
+            } else if (value.equals(Double.TYPE)) {
+                fld = Double.class.getField(TYPE);
+            } else if (value.equals(Byte.TYPE)) {
+                fld = Byte.class.getField(TYPE);
+            } else if (value.equals(Character.TYPE)) {
+                fld = Character.class.getField(TYPE);
+            } else if (value.equals(Boolean.TYPE)) {
+                fld = Boolean.class.getField(TYPE);
+            }
+        } catch (NoSuchFieldException e) {
+            // impossible situation for valid java.lang classes
+            // implementation with version >= 1.1
+            throw new AssertionError(e);
+        }
+        if (fld != null) {
+            // we have primitive type
+            result = new Expression(oldInstance, fld,
+                    "get", new Object[] { null }); //$NON-NLS-1$
+        } else {
+            result = new Expression(oldInstance, String.class, "forName", //$NON-NLS-1$ 
+                    new Object[] { value.getName() });
+        }
+        return result;
+    }
+
+    @Override
+    /*
+     * It's unnecessary to do anything for initialization, because two mutatable
+     * class objects are actually the same.
+     */
+    protected void initialize(Class<?> type, Object oldInstance,
+            Object newInstance, Encoder out) {
+        // do nothing
+    }
+
+    @Override
+    protected boolean mutatesTo(Object oldInstance, Object newInstance) {
+        if (oldInstance instanceof Class && newInstance instanceof Class) {
+            Class<?> c1 = (Class) oldInstance;
+            Class<?> c2 = (Class) newInstance;
+            if (c1.getName().equals(c2.getName())) {
+                return true;
+            }
+            return false;
+        }
+        return super.mutatesTo(oldInstance, newInstance);
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_ClassPersistenceDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_StringPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_StringPersistenceDelegate.java?view=auto&rev=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_StringPersistenceDelegate.java (added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_StringPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package java.beans;
+
+class java_lang_StringPersistenceDelegate extends PersistenceDelegate {
+    @Override
+    protected Expression instantiate(Object oldInstance, Encoder out) {
+        String value = (String) oldInstance;
+        return new Expression(oldInstance, String.class,
+                "new", new Object[] { value }); //$NON-NLS-1$
+    }
+
+    @Override
+    /*
+     * It's unnecessary to do anything for initialization, because two mutatable
+     * strings are actually equivalent already.
+     */
+    protected void initialize(Class<?> type, Object oldInstance,
+            Object newInstance, Encoder out) {
+        // do nothing
+    }
+
+    @Override
+    protected boolean mutatesTo(Object oldInstance, Object newInstance) {
+        if (oldInstance instanceof String && newInstance instanceof String) {
+            return newInstance.equals(oldInstance);
+        }
+        return super.mutatesTo(oldInstance, newInstance);
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_StringPersistenceDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_FieldPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_FieldPersistenceDelegate.java?view=auto&rev=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_FieldPersistenceDelegate.java (added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_FieldPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -0,0 +1,53 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.beans;
+
+import java.lang.reflect.Field;
+
+/**
+ * This is a persistence delegate for the {@link java.lang.reflect.Field} class.
+ */
+class java_lang_reflect_FieldPersistenceDelegate extends PersistenceDelegate {
+    @Override
+    protected Expression instantiate(Object oldInstance, Encoder out) {
+        // should not be null or have a type other than Field
+        assert oldInstance instanceof Field : oldInstance;
+        Field oldField = (Field) oldInstance;
+        Class<?> declClass = oldField.getDeclaringClass();
+        return new Expression(oldField, declClass, "getField", //$NON-NLS-1$
+                new Object[] { oldField.getName() });
+    }
+
+    @Override
+    protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
+        // check for consistency
+        assert oldInstance instanceof Field : oldInstance;
+        assert newInstance instanceof Field : newInstance;
+        assert newInstance.equals(oldInstance);
+    }
+
+    @Override
+    protected boolean mutatesTo(Object oldInstance, Object newInstance) {
+        assert oldInstance instanceof Field : oldInstance;
+        if (!(newInstance instanceof Field)) {
+            // if null or not a Field
+            return false;
+        }
+        return oldInstance.equals(newInstance);
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_FieldPersistenceDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_MethodPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_MethodPersistenceDelegate.java?view=auto&rev=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_MethodPersistenceDelegate.java (added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_MethodPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -0,0 +1,53 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.beans;
+
+import java.lang.reflect.Method;
+
+/**
+ * Persistence delegate for {@link java.lang.reflect.Method} class.
+ */
+class java_lang_reflect_MethodPersistenceDelegate extends PersistenceDelegate {
+    @Override
+    protected Expression instantiate(Object oldInstance, Encoder out) {
+        // should not be null or have a type other than Method
+        assert oldInstance instanceof Method : oldInstance;
+        Method oldMethod = (Method) oldInstance;
+        Class<?> declClass = oldMethod.getDeclaringClass();
+        return new Expression(oldMethod, declClass, "getMethod", //$NON-NLS-1$
+                new Object[] { oldMethod.getName(), oldMethod.getParameterTypes() });
+    }
+
+    @Override
+    protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
+        // check for consistency
+        assert oldInstance instanceof Method : oldInstance;
+        assert newInstance instanceof Method : newInstance;
+        assert newInstance.equals(oldInstance);
+    }
+
+    @Override
+    protected boolean mutatesTo(Object oldInstance, Object newInstance) {
+        assert oldInstance instanceof Method : oldInstance;
+        if (!(newInstance instanceof Method)) {
+            // if null or not a Method
+            return false;
+        }
+        return oldInstance.equals(newInstance);
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_MethodPersistenceDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_ProxyPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_ProxyPersistenceDelegate.java?view=auto&rev=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_ProxyPersistenceDelegate.java (added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_ProxyPersistenceDelegate.java Tue Jul 24 00:58:36 2007
@@ -0,0 +1,48 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.beans;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+
+class java_lang_reflect_ProxyPersistenceDelegate extends DefaultPersistenceDelegate {
+    @Override
+    protected Expression instantiate(Object oldInstance, Encoder out) {
+        assert oldInstance instanceof Proxy : oldInstance;
+        Class[] interfaces = oldInstance.getClass().getInterfaces();
+        InvocationHandler handler = Proxy.getInvocationHandler(oldInstance);
+        return new Expression(oldInstance, Proxy.class, "newProxyInstance", //$NON-NLS-1$
+                new Object[] { oldInstance.getClass().getClassLoader(), interfaces, handler });
+    }
+
+    @Override
+    protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
+        // check for consistency
+        assert oldInstance instanceof Proxy : oldInstance;
+        assert newInstance instanceof Proxy : newInstance;
+        assert newInstance == oldInstance;
+        super.initialize(type, oldInstance, newInstance, out);
+    }
+
+    @Override
+    protected boolean mutatesTo(Object oldInstance, Object newInstance) {
+        assert oldInstance instanceof Proxy : oldInstance;
+        assert oldInstance == newInstance;
+        return super.mutatesTo(oldInstance, newInstance);
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/java_lang_reflect_ProxyPersistenceDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/AllTests.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/AllTests.java?view=auto&rev=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/AllTests.java (added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/AllTests.java Tue Jul 24 00:58:36 2007
@@ -0,0 +1,38 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.beans;
+
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Test suite that includes all tests for the java.beans package
+ */
+public class AllTests {
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite("Tests for org.apache.harmony.beans");
+        // $JUnit-BEGIN$
+        suite.addTestSuite(ArrayPersistenceDelegateTest.class);
+        suite.addTestSuite(ClassPersistenceDelegateTest.class);
+        suite.addTestSuite(StringPersistenceDelegateTest.class);
+        // $JUnit-END$
+        return suite;
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/AllTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/ArrayPersistenceDelegateTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/ArrayPersistenceDelegateTest.java?view=auto&rev=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/ArrayPersistenceDelegateTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/ArrayPersistenceDelegateTest.java Tue Jul 24 00:58:36 2007
@@ -0,0 +1,62 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.beans;
+
+import java.beans.ArrayPersistenceDelegate;
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.lang.reflect.Array;
+
+import junit.framework.TestCase;
+
+/**
+ * Test the internal class java.beans.ArrayPersistenceDelegate.
+ */
+public class ArrayPersistenceDelegateTest extends TestCase {
+
+    private ArrayPersistenceDelegate pd = null;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        pd = new ArrayPersistenceDelegate();
+    }
+
+    public void testMutates() {
+        assertFalse(pd.mutatesTo(new int[] { 1 }, null));
+        assertFalse(pd.mutatesTo(null, null));
+        assertFalse(pd.mutatesTo(new int[1], new int[2]));
+        assertTrue(pd.mutatesTo(new int[] { 1, 3 }, new int[] { 1, 2 }));
+    }
+
+    public void testInitialize() {
+        // TBD
+    }
+
+    public void testInstantiate_Normal() throws Exception {
+        Object obj = new int[] { 1, 2, 3 };
+        Expression exp = pd.instantiate(obj, new Encoder());
+        assertSame(obj, exp.getValue());
+        assertSame(Array.class, exp.getTarget());
+        assertEquals("newInstance", exp.getMethodName());
+        assertEquals(2, exp.getArguments().length);
+        assertSame(Integer.TYPE, exp.getArguments()[0]);
+        assertEquals(new Integer(3), exp.getArguments()[1]);
+    }
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/ArrayPersistenceDelegateTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/ClassPersistenceDelegateTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/ClassPersistenceDelegateTest.java?view=auto&rev=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/ClassPersistenceDelegateTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/ClassPersistenceDelegateTest.java Tue Jul 24 00:58:36 2007
@@ -0,0 +1,79 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.beans;
+
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.java_lang_ClassPersistenceDelegate;
+
+import junit.framework.TestCase;
+
+/**
+ * Test the internal class java.beans.ClassPersistenceDelegate.
+ */
+public class ClassPersistenceDelegateTest extends TestCase {
+
+    private java_lang_ClassPersistenceDelegate pd = null;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        pd = new java_lang_ClassPersistenceDelegate();
+    }
+
+    public void testMutates() {
+        assertFalse(pd.mutatesTo(Class.class, null));
+        assertFalse(pd.mutatesTo(null, null));
+        assertFalse(pd.mutatesTo(Class.class, String.class));
+        assertTrue(pd.mutatesTo(String.class, String.class));
+    }
+
+    public void testInitialize() {
+        pd.initialize(null, null, null, null);
+    }
+
+    public void testInstantiate_Normal() throws Exception {
+        Expression exp = pd.instantiate(Integer.class, new Encoder());
+
+        assertSame(Integer.class, exp.getValue());
+        assertTrue(exp.getTarget() instanceof Class);
+        assertEquals("forName", exp.getMethodName());
+        assertEquals(1, exp.getArguments().length);
+        assertEquals("java.lang.Integer", exp.getArguments()[0]);
+    }
+
+    public void testInstantiate_Primitive() throws Exception {
+        Expression exp = pd.instantiate(Integer.TYPE, new Encoder());
+
+        assertSame(Integer.TYPE, exp.getValue());
+        assertTrue(exp.getTarget() instanceof java.lang.reflect.Field);
+        assertEquals("get", exp.getMethodName());
+        assertEquals(1, exp.getArguments().length);
+        assertNull(exp.getArguments()[0]);
+    }
+
+    public void testInstantiate_Class() throws Exception {
+        Expression exp = pd.instantiate(Class.class, new Encoder());
+
+        assertSame(Class.class, exp.getValue());
+        assertTrue(exp.getTarget() instanceof Class);
+        assertEquals("forName", exp.getMethodName());
+        assertEquals(1, exp.getArguments().length);
+        assertEquals("java.lang.Class", exp.getArguments()[0]);
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/ClassPersistenceDelegateTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/StringPersistenceDelegateTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/StringPersistenceDelegateTest.java?view=auto&rev=558953
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/StringPersistenceDelegateTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/StringPersistenceDelegateTest.java Tue Jul 24 00:58:36 2007
@@ -0,0 +1,59 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.beans;
+
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.java_lang_StringPersistenceDelegate;
+
+import junit.framework.TestCase;
+
+/**
+ * Test the internal class java.beans.StringPersistenceDelegate.
+ */
+public class StringPersistenceDelegateTest extends TestCase {
+
+    private java_lang_StringPersistenceDelegate pd = null;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        pd = new java_lang_StringPersistenceDelegate();
+    }
+
+    public void testMutates() {
+        assertFalse(pd.mutatesTo("", null));
+        assertFalse(pd.mutatesTo(null, null));
+        assertFalse(pd.mutatesTo("str1", "str2"));
+        assertTrue(pd.mutatesTo("str1", "str1"));
+    }
+
+    public void testInitialize() {
+        pd.initialize(null, null, null, null);
+    }
+
+    public void testInstantiate_Normal() throws Exception {
+        Expression exp = pd.instantiate("str", new Encoder());
+
+        assertSame("str", exp.getValue());
+        assertSame(String.class, exp.getTarget());
+        assertEquals("new", exp.getMethodName());
+        assertEquals(1, exp.getArguments().length);
+        assertEquals("str", exp.getArguments()[0]);
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/StringPersistenceDelegateTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message