Title: [1973] trunk: Drop experimental Harmony support.
Revision
1973
Author
joehni
Date
2012-04-16 15:45:04 -0500 (Mon, 16 Apr 2012)

Log Message

Drop experimental Harmony support.

Modified Paths


Removed Paths

Diff

Modified: trunk/xstream/pom.xml (1972 => 1973)


--- trunk/xstream/pom.xml	2012-03-31 12:06:40 UTC (rev 1972)
+++ trunk/xstream/pom.xml	2012-04-16 20:45:04 UTC (rev 1973)
@@ -198,15 +198,6 @@
         <plugins>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-compiler-plugin</artifactId>
-            <configuration>
-              <excludes>
-                <exclude>**/HarmonyReflectionProvider*</exclude>
-              </excludes>
-            </configuration>
-          </plugin>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-javadoc-plugin</artifactId>
             <executions>
               <execution>
@@ -246,7 +237,6 @@
                 <exclude>**/enums/*</exclude>
                 <exclude>**/basic/StringBuilder*</exclude>
                 <exclude>**/basic/UUID*</exclude>
-                <exclude>**/HarmonyReflectionProvider*</exclude>
               </excludes>
               <testExcludes>
                 <exclude>**/annotations/*</exclude>

Deleted: trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/HarmonyReflectionProvider.java (1972 => 1973)


--- trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/HarmonyReflectionProvider.java	2012-03-31 12:06:40 UTC (rev 1972)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/HarmonyReflectionProvider.java	2012-04-16 20:45:04 UTC (rev 1973)
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2008 XStream Committers.
- * All rights reserved.
- *
- * The software in this package is published under the terms of the BSD
- * style license a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- * 
- * Created on 09. January 2008 by Joerg Schaible
- */
-package com.thoughtworks.xstream.converters.reflection;
-
-import org.apache.harmony.misc.accessors.ObjectAccessor;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-
-/**
- * Instantiates a new object on the Harmony JVM by bypassing the constructor (meaning code in
- * the constructor will never be executed and parameters do not have to be known). This is the
- * same method used by the internals of standard Java serialization, but relies on internal Harmony
- * code.
- * 
- * Note, this is work in progress. Harmony 5.0M4 crashes instantiating a class derived from
- * {@link com.thoughtworks.acceptance.objects.StandardObject}, of type 
- * {@link javax.swing.JTable} or {@link java.awt.Font}. Additionally it fails with a NPE processing the
- * annotations and has a wrong offset dealing with time zone. Same problems apply to 5.0M5.
- *
- * @author J&ouml;rg Schaible
- * @author Joe Walnes
- */
-public class HarmonyReflectionProvider extends PureJavaReflectionProvider {
-    private final static ObjectAccessor objectAccess;
-    private final static Exception exception;
-    static {
-        ObjectAccessor accessor = null;
-        Exception ex = null;
-        Method method;
-        try {
-            method = ObjectAccessor.class.getDeclaredMethod("getInstance");
-            method.setAccessible(true);
-            accessor = (ObjectAccessor)method.invoke(null, null);
-        } catch (NoSuchMethodException e) {
-            ex = e;
-        } catch (IllegalAccessException e) {
-            ex = e;
-        } catch (InvocationTargetException e) {
-            ex = e;
-        }
-        objectAccess = accessor;
-        exception = ex;
-    }
-
-    public HarmonyReflectionProvider() {
-        super();
-    }
-
-    public HarmonyReflectionProvider(FieldDictionary dic) {
-        super(dic);
-    }
-
-    public Object newInstance(Class type) {
-        if (exception != null) {
-            throw new ObjectAccessException("Cannot construct " + type.getName(), exception);
-        }
-        try {
-            return objectAccess.newInstance(type);
-        } catch (SecurityException e) {
-            throw new ObjectAccessException("Cannot construct " + type.getName(), e);
-        } catch (IllegalArgumentException e) {
-            throw new ObjectAccessException("Cannot construct " + type.getName(), e);
-        }
-    }
-
-    public void writeField(Object object, String fieldName, Object value, Class definedIn) {
-        write(fieldDictionary.field(object.getClass(), fieldName, definedIn), object, value);
-    }
-
-    private void write(Field field, Object object, Object value) {
-        if (exception != null) {
-            throw new ObjectAccessException("Could not set field "
-                + object.getClass()
-                + "."
-                + field.getName(), exception);
-        }
-        try {
-            long offset = objectAccess.getFieldID(field);
-            Class type = field.getType();
-            if (type.isPrimitive()) {
-                if (type.equals(Integer.TYPE)) {
-                    objectAccess.setInt(object, offset, ((Integer)value).intValue());
-                } else if (type.equals(Long.TYPE)) {
-                    objectAccess.setLong(object, offset, ((Long)value).longValue());
-                } else if (type.equals(Short.TYPE)) {
-                    objectAccess.setShort(object, offset, ((Short)value).shortValue());
-                } else if (type.equals(Character.TYPE)) {
-                    objectAccess.setChar(object, offset, ((Character)value).charValue());
-                } else if (type.equals(Byte.TYPE)) {
-                    objectAccess.setByte(object, offset, ((Byte)value).byteValue());
-                } else if (type.equals(Float.TYPE)) {
-                    objectAccess.setFloat(object, offset, ((Float)value).floatValue());
-                } else if (type.equals(Double.TYPE)) {
-                    objectAccess.setDouble(object, offset, ((Double)value).doubleValue());
-                } else if (type.equals(Boolean.TYPE)) {
-                    objectAccess.setBoolean(object, offset, ((Boolean)value).booleanValue());
-                } else {
-                    throw new ObjectAccessException("Could not set field "
-                        + object.getClass()
-                        + "."
-                        + field.getName()
-                        + ": Unknown type "
-                        + type);
-                }
-            } else {
-                objectAccess.setObject(object, offset, value);
-            }
-
-        } catch (IllegalArgumentException e) {
-            throw new ObjectAccessException("Could not set field "
-                + object.getClass()
-                + "."
-                + field.getName(), e);
-        }
-    }
-
-    protected void validateFieldAccess(Field field) {
-        // (overriden) don't mind final fields.
-    }
-}

Modified: trunk/xstream-distribution/src/content/faq.html (1972 => 1973)


--- trunk/xstream-distribution/src/content/faq.html	2012-03-31 12:06:40 UTC (rev 1972)
+++ trunk/xstream-distribution/src/content/faq.html	2012-04-16 20:45:04 UTC (rev 1973)
@@ -1,7 +1,7 @@
 <html>
 <!--
  Copyright (C) 2005, 2006 Joe Walnes.
- Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 XStream committers.
+ Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 XStream committers.
  All rights reserved.
  
  The software in this package is published under the terms of the BSD
@@ -93,11 +93,12 @@
 	additional dependencies.</p>
 
     <!-- ...................................................... -->
-    <h2 id="Compatibility_Harmony">Why does XStream fail on Harmony?</h2>
+    <h2 id="Compatibility_Harmony">Why does XStream fail on Apache Harmony?</h2>
 
 	<p>Since JDK 5 it is possible according the Java specification to write into final fields using reflection. This is not yet 
 	supported by Harmony and therefore the PureJavaReflectionProvider fails. We have also already investigated into
-	enhanced mode in Harmony, but the Harmony JVM currently crashes running the unit tests. It is simply not yet ready.</p>
+	enhanced mode in Harmony, but the Harmony JVM crashed running the unit tests. However, Harmony has been retired,
+	we will no longer make any efforts in this direction.</p>
 
     <!-- ...................................................... -->
     <h2 id="Compatibility_unsupported_JVM">Are there plans to provide enhanced mode support to other JVMs?</h2>

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to