Skip to content
This repository has been archived by the owner on Nov 7, 2020. It is now read-only.

Commit

Permalink
half-hearted attempt to define some fields to be XStream-seriazliable…
Browse files Browse the repository at this point in the history
… but not Java serializable
  • Loading branch information
kohsuke committed May 12, 2009
1 parent 7730b06 commit 800da05
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 216 deletions.
225 changes: 10 additions & 215 deletions xstream/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<name>XStream Core</name>

<groupId>org.jvnet.hudson</groupId>
<version>1.3.1-hudson-1</version>
<version>1.3.1-hudson-2</version>

<dependencies>
<dependency>
Expand Down Expand Up @@ -116,6 +116,15 @@
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.jvnet.wagon-svn</groupId>
Expand All @@ -132,220 +141,6 @@
</repository>
</distributionManagement>

<profiles>
<profile>
<id>jdk15</id>
<activation>
<jdk>1.5</jdk>
</activation>
<build>
<plugins>
<!-- two-stage compile process as a workaround until multiple JDK support is added
http://jira.codehaus.org/browse/MCOMPILER-37
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>**/annotations/*</exclude>
<exclude>**/AnnotationMapper*</exclude>
<exclude>**/EnumMapper*</exclude>
<exclude>**/enums/*</exclude>
<exclude>**/HarmonyReflectionProvider*</exclude>
</excludes>
<testExcludes>
<exclude>**/annotations/*</exclude>
<exclude>**/enums/*</exclude>
<exclude>**/acceptance/SecurityManagerTest*</exclude>
</testExcludes>
</configuration>
<executions>
<execution>
<id>compile-jdk15</id>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>foo</exclude>
<exclude>foo</exclude>
<exclude>foo</exclude>
<exclude>foo</exclude>
<exclude>**/HarmonyReflectionProvider*</exclude>
</excludes>
<testExcludes>
<exclude>foo</exclude>
<exclude>foo</exclude>
<exclude>**/acceptance/SecurityManagerTest*</exclude>
</testExcludes>
</configuration>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadoc</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<excludePackageNames>
com.thoughtworks.xstream.core:com.thoughtworks.xstream.io.xml.xppdom
</excludePackageNames>
<links>
<link>http://java.sun.com/j2se/1.5.0/docs/api</link>
</links>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- Drop this profile if MNG-1910 is applied! -->
<id>jdk16</id>
<activation>
<jdk>1.6</jdk>
</activation>
<build>
<plugins>
<!-- two-stage compile process as a workaround until multiple JDK support is added
http://jira.codehaus.org/browse/MCOMPILER-37
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>**/annotations/*</exclude>
<exclude>**/AnnotationMapper*</exclude>
<exclude>**/EnumMapper*</exclude>
<exclude>**/enums/*</exclude>
<exclude>**/HarmonyReflectionProvider*</exclude>
</excludes>
<testExcludes>
<exclude>**/annotations/*</exclude>
<exclude>**/enums/*</exclude>
<exclude>**/acceptance/SecurityManagerTest*</exclude>
</testExcludes>
</configuration>
<executions>
<execution>
<id>compile-jdk15</id>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>foo</exclude>
<exclude>foo</exclude>
<exclude>foo</exclude>
<exclude>foo</exclude>
<exclude>**/HarmonyReflectionProvider*</exclude>
</excludes>
<testExcludes>
<exclude>foo</exclude>
<exclude>foo</exclude>
<exclude>**/acceptance/SecurityManagerTest*</exclude>
</testExcludes>
</configuration>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadoc</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<excludePackageNames>
com.thoughtworks.xstream.core:com.thoughtworks.xstream.io.xml.xppdom
</excludePackageNames>
<links>
<link>http://java.sun.com/javase/6/docs/api</link>
</links>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jdk14</id>
<activation>
<jdk>1.4</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>**/annotations/*</exclude>
<exclude>**/AnnotationMapper*</exclude>
<exclude>**/EnumMapper*</exclude>
<exclude>**/enums/*</exclude>
<exclude>**/basic/StringBuilder*</exclude>
<exclude>**/basic/UUID*</exclude>
<exclude>**/HarmonyReflectionProvider*</exclude>
</excludes>
<testExcludes>
<exclude>**/annotations/*</exclude>
<exclude>**/enums/*</exclude>
<exclude>**/reflection/PureJavaReflectionProvider15Test*</exclude>
<exclude>**/acceptance/Basic15TypesTest*</exclude>
<exclude>**/acceptance/SecurityManagerTest*</exclude>
</testExcludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>

<reporting>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.thoughtworks.xstream.annotations;

import static java.lang.annotation.ElementType.FIELD;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;

/**
* @author Kohsuke Kawaguchi
*/
@Retention(RUNTIME)
@Target(FIELD)
public @interface XStreamSerializable {
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
package com.thoughtworks.xstream.converters.reflection;

import com.thoughtworks.xstream.core.JVM;
import com.thoughtworks.xstream.annotations.XStreamSerializable;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -159,7 +160,7 @@ public boolean fieldDefinedInClass(String fieldName, Class type) {

protected boolean fieldModifiersSupported(Field field) {
return !(Modifier.isStatic(field.getModifiers())
|| Modifier.isTransient(field.getModifiers()));
|| (Modifier.isTransient(field.getModifiers()) && field.getAnnotation(XStreamSerializable.class)==null));
}

protected void validateFieldAccess(Field field) {
Expand Down

0 comments on commit 800da05

Please sign in to comment.