• R/O
  • SSH
  • HTTPS

jsonic: コミット


コミットメタ情報

リビジョン1846 (tree)
日時2014-12-14 02:12:01
作者hizuno

ログメッセージ

(メッセージはありません)

変更サマリ

差分

--- trunk/jsonic-1.3/deploy.xml (revision 1845)
+++ trunk/jsonic-1.3/deploy.xml (nonexistent)
@@ -1,104 +0,0 @@
1-<?xml version="1.0"?>
2-
3-<project name="jsonic-1.3-deploy" default="deploy" basedir="."
4- xmlns:artifact="antlib:org.apache.maven.artifact.ant">
5-
6- <xmlproperty file="pom.xml" />
7-
8- <property name="src" location="src" />
9- <property name="build" location="build" />
10- <property name="dist" location="dist" />
11-
12- <property name="groupId" value="${project.groupId}" />
13- <property name="artifactId" value="${project.artifactId}" />
14- <property name="version" value="${project.version}" />
15-
16- <property name="binaries-jar" value="${dist}/lib/${artifactId}-${version}.jar" />
17- <property name="javadoc-jar" value="${dist}/lib/${artifactId}-${version}-javadoc.jar" />
18- <property name="sources-jar" value="${dist}/lib/${artifactId}-${version}-sources.jar" />
19-
20- <!-- defined maven snapshots and staging repository id and url -->
21- <property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots" />
22- <property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots" />
23- <property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
24- <property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2" />
25-
26- <target name="init">
27- <mkdir dir="${build}" />
28- <mkdir dir="${dist}/lib" />
29-
30- <artifact:dependencies pathId="dependencies.path" scopes="compile,provided">
31- <pom file="pom.xml"/>
32- </artifact:dependencies>
33- </target>
34-
35- <target name="compile" depends="init" description="compile the source">
36- <javac source="1.5" target="1.5" srcdir="${src}" destdir="${build}" includeantruntime="false">
37- <classpath refid="dependencies.path"/>
38- </javac>
39- </target>
40-
41- <target name="dist" depends="compile" description="generate the distribution">
42- <jar jarfile="${binaries-jar}">
43- <fileset dir="${build}" includes="**/*.class" />
44- <fileset dir="${src}" excludes="**/*.java" />
45- </jar>
46-
47- <javadoc sourcepath="${src}" destdir="${dist}/javadoc"
48- encoding="UTF-8" charset="UTF-8" docencoding="UTF-8" locale="en_US"
49- additionalparam="-J-Duser.language=en_US"
50- author="true">
51- <link href="http://docs.oracle.com/javase/7/docs/api/" />
52- <excludepackage name="net.arnx.jsonic.util.*" />
53- <excludepackage name="net.arnx.jsonic.io.*" />
54- <classpath refid="dependencies.path"/>
55- </javadoc>
56-
57- <jar jarfile="${javadoc-jar}">
58- <fileset dir="${dist}/javadoc" />
59- </jar>
60-
61- <jar jarfile="${sources-jar}">
62- <fileset dir="${src}" />
63- </jar>
64- </target>
65-
66- <target name="deploy" depends="dist" description="deploy release version to Maven staging repository">
67- <!-- sign and deploy the main artifact -->
68- <artifact:mvn>
69- <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
70- <arg value="-Durl=${maven-staging-repository-url}" />
71- <arg value="-DrepositoryId=${maven-staging-repository-id}" />
72- <arg value="-DpomFile=pom.xml" />
73- <arg value="-Dfile=${binaries-jar}" />
74- <arg value="-Pgpg" />
75- </artifact:mvn>
76-
77- <!-- sign and deploy the sources artifact -->
78- <artifact:mvn>
79- <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
80- <arg value="-Durl=${maven-staging-repository-url}" />
81- <arg value="-DrepositoryId=${maven-staging-repository-id}" />
82- <arg value="-DpomFile=pom.xml" />
83- <arg value="-Dfile=${sources-jar}" />
84- <arg value="-Dclassifier=sources" />
85- <arg value="-Pgpg" />
86- </artifact:mvn>
87-
88- <!-- sign and deploy the javadoc artifact -->
89- <artifact:mvn>
90- <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
91- <arg value="-Durl=${maven-staging-repository-url}" />
92- <arg value="-DrepositoryId=${maven-staging-repository-id}" />
93- <arg value="-DpomFile=pom.xml" />
94- <arg value="-Dfile=${javadoc-jar}" />
95- <arg value="-Dclassifier=javadoc" />
96- <arg value="-Pgpg" />
97- </artifact:mvn>
98- </target>
99-
100- <target name="clean" description="clean up">
101- <delete dir="${build}" />
102- <delete dir="${dist}" />
103- </target>
104-</project>
\ No newline at end of file
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- trunk/jsonic-1.3/build.xml (revision 1845)
+++ trunk/jsonic-1.3/build.xml (revision 1846)
@@ -1,6 +1,7 @@
11 <?xml version="1.0"?>
22 <!DOCTYPE project>
3-<project name="jsonic-1.3" basedir="." default="dist-all">
3+<project name="jsonic-1.3" basedir="." default="dist-all"
4+ xmlns:artifact="antlib:org.apache.maven.artifact.ant">
45 <xmlproperty file="pom.xml" />
56
67 <property name="javac.bootclasspath" location="C:/Program Files (x86)/Java/jdk1.5.0_22/jre/lib/rt.jar" />
@@ -11,6 +12,13 @@
1112 <property name="tmp" location="${java.io.tmpdir}/${ant.project.name}" />
1213 <property name="dist" location="." />
1314
15+ <property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
16+ <property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2" />
17+
18+ <typedef uri="antlib:org.apache.maven.artifact.ant"
19+ resource="org/apache/maven/artifact/ant/antlib.xml"
20+ classpath="lib/maven-ant-tasks-2.1.3.jar" />
21+
1422 <target name="init" depends="clean">
1523 <tstamp />
1624 <mkdir dir="${tmp}" />
@@ -99,6 +107,55 @@
99107 <delete dir="${tmp}" />
100108 </target>
101109
110+ <target name="release">
111+ <delete dir="${tmp}" />
112+ <mkdir dir="${tmp}" />
113+
114+ <unzip src="${dist}/${project.name}-${project.version}.zip" dest="${tmp}">
115+ <patternset>
116+ <include name="${project.name}-${project.version}/*.jar" />
117+ </patternset>
118+ </unzip>
119+
120+ <property name="binaries-jar" value="${tmp}/${project.name}-${project.version}/${project.name}-${project.version}.jar" />
121+ <property name="javadoc-jar" value="${tmp}/${project.name}-${project.version}/${project.name}-${project.version}-javadoc.jar" />
122+ <property name="sources-jar" value="${tmp}/${project.name}-${project.version}/${project.name}-${project.version}-sources.jar" />
123+
124+ <!-- sign and deploy the main artifact -->
125+ <artifact:mvn>
126+ <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
127+ <arg value="-Durl=${maven-staging-repository-url}" />
128+ <arg value="-DrepositoryId=${maven-staging-repository-id}" />
129+ <arg value="-DpomFile=pom.xml" />
130+ <arg value="-Dfile=${binaries-jar}" />
131+ <arg value="-Pgpg" />
132+ </artifact:mvn>
133+
134+ <!-- sign and deploy the sources artifact -->
135+ <artifact:mvn>
136+ <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
137+ <arg value="-Durl=${maven-staging-repository-url}" />
138+ <arg value="-DrepositoryId=${maven-staging-repository-id}" />
139+ <arg value="-DpomFile=pom.xml" />
140+ <arg value="-Dfile=${sources-jar}" />
141+ <arg value="-Dclassifier=sources" />
142+ <arg value="-Pgpg" />
143+ </artifact:mvn>
144+
145+ <!-- sign and deploy the javadoc artifact -->
146+ <artifact:mvn>
147+ <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
148+ <arg value="-Durl=${maven-staging-repository-url}" />
149+ <arg value="-DrepositoryId=${maven-staging-repository-id}" />
150+ <arg value="-DpomFile=pom.xml" />
151+ <arg value="-Dfile=${javadoc-jar}" />
152+ <arg value="-Dclassifier=javadoc" />
153+ <arg value="-Pgpg" />
154+ </artifact:mvn>
155+
156+ <delete dir="${tmp}" failonerror="off" />
157+ </target>
158+
102159 <target name="clean">
103160 <delete dir="${tmp}" failonerror="off" />
104161 <delete file="${dist}/${project.name}-${project.version}.zip" failonerror="off" />
--- trunk/jsonic-1.3/pom.xml.asc (revision 1845)
+++ trunk/jsonic-1.3/pom.xml.asc (revision 1846)
@@ -1,11 +1,11 @@
11 -----BEGIN PGP SIGNATURE-----
22 Version: GnuPG v1.4.11 (MingW32)
33
4-iQEcBAABAgAGBQJTgetoAAoJEHqIsNfmElEVn4gH/1mmZKfOsfHqBN0sfi8qBk3y
5-vwGabNy/vTfXTSspghCExahzhfFp8F7VVijjRdsIofXoDNo+OxP83FcgAgEbxPXP
6-gJwxiP9EeYcuiTBiX+XGCawX4zMIo37g47UQgo4BDvM7PvToC9w+SSumJ6KNakcd
7-0SkUUQXz3MjZpSC1UbY8EuLNTQVicngigrzJvtX4sEqdi6hJI/NJ2V7Fgg3DzM/L
8-LdFmafeuWjhtWZWa10kFCFDCN/FnyTIzuiCsBoAbsp56FDu8whsiY+oP94K4Do28
9-vkravbRDy/J5NE9EOMiZTeADVGJQikjikQbplylNtUxeYwnGtRakd3TSS8V3f5g=
10-=NACX
4+iQEcBAABAgAGBQJUTNHcAAoJEHqIsNfmElEVszcH/iutn5o0enRW4spvvG/rQ/Uz
5++g0n+bKGd9xi64sI55HsxAdUEFjhGS1VCn1MEdQSe+14aQYG+55nx0dokX9cRAK7
6+FdRQg7k4ZVLzPkpzpIl8aIR+XlcI1suMpGKWP3S7CueKtyQAHKG6lzd5wjZ813/g
7+am7aFxufWuDLgXYKG0wXo2WBICyr0VE8gMekuvlZsq6eXh41XVzH0f3sw7aVihGf
8+l0Jej7FfjpyuySCFwD8wH45yMEHi8ApOwwchVVNFLTucLpNcGtb+gO7N3oi0e9SH
9+wXHalJCA6nWi2Go6evqqDHNeVAoGa2pEIamTLLVFMjuDfcKSstuzTWU4Fl5PHA4=
10+=Xitc
1111 -----END PGP SIGNATURE-----
--- trunk/jsonic-1.3/test/net/arnx/jsonic/JSONBugTest.java (revision 1845)
+++ trunk/jsonic-1.3/test/net/arnx/jsonic/JSONBugTest.java (revision 1846)
@@ -4,6 +4,8 @@
44
55 import org.junit.Test;
66
7+import com.google.inject.internal.Objects;
8+
79 public class JSONBugTest {
810 @Test
911 public void test() {
@@ -22,4 +24,96 @@
2224 public void testSimple() {
2325 assertEquals("\"test\"", JSON.encode("test"));
2426 }
27+
28+ @Test
29+ public void testSuperClass() {
30+ TestClass test = new TestClass();
31+ assertEquals("{\"test\":{\"hoge\":\"hoge\"}}", JSON.encode(test));
32+
33+ System.out.println(JSON.decode("{\"test\":{\"hoge\":\"hoge\"}}", TestClass.class).test.getClass());
34+ assertEquals(test, JSON.decode("{\"test\":{\"hoge\":\"hoge\"}}", TestClass.class));
35+ }
36+
37+ public static class TestClass {
38+ @JSONHint(type = SubClass.class)
39+ public SuperClass test = new SubClass();
40+
41+ @Override
42+ public int hashCode() {
43+ final int prime = 31;
44+ int result = 1;
45+ result = prime * result + ((test == null) ? 0 : test.hashCode());
46+ return result;
47+ }
48+
49+ @Override
50+ public boolean equals(Object obj) {
51+ if (this == obj)
52+ return true;
53+ if (obj == null)
54+ return false;
55+ if (getClass() != obj.getClass())
56+ return false;
57+ TestClass other = (TestClass) obj;
58+ if (test == null) {
59+ if (other.test != null)
60+ return false;
61+ } else if (!test.equals(other.test))
62+ return false;
63+ return true;
64+ }
65+ }
66+
67+ public static class SuperClass {
68+ public SuperClass() {
69+ }
70+
71+ @Override
72+ public int hashCode() {
73+ return 0;
74+ }
75+
76+ @Override
77+ public boolean equals(Object obj) {
78+ if (this == obj)
79+ return true;
80+ if (obj == null)
81+ return false;
82+ if (getClass() != obj.getClass())
83+ return false;
84+ return true;
85+ }
86+ }
87+
88+ public static class SubClass extends SuperClass {
89+ public SubClass() {
90+ }
91+
92+ public String hoge = "hoge";
93+
94+ @Override
95+ public int hashCode() {
96+ final int prime = 31;
97+ int result = super.hashCode();
98+ result = prime * result + ((hoge == null) ? 0 : hoge.hashCode());
99+ return result;
100+ }
101+
102+ @Override
103+ public boolean equals(Object obj) {
104+ if (this == obj)
105+ return true;
106+ if (!super.equals(obj))
107+ return false;
108+ if (getClass() != obj.getClass())
109+ return false;
110+ SubClass other = (SubClass) obj;
111+ if (hoge == null) {
112+ if (other.hoge != null)
113+ return false;
114+ } else if (!hoge.equals(other.hoge))
115+ return false;
116+ return true;
117+ }
118+ }
25119 }
--- trunk/jsonic-1.3/src/net/arnx/jsonic/JSON.java (revision 1845)
+++ trunk/jsonic-1.3/src/net/arnx/jsonic/JSON.java (revision 1846)
@@ -943,7 +943,7 @@
943943 try {
944944 int len;
945945 if (source == null) {
946- return "null";
946+ len = 4;
947947 } else if (source instanceof CharSequence) {
948948 len = ((CharSequence)source).length() + 16;
949949 } else if (source instanceof Boolean) {
@@ -1202,7 +1202,10 @@
12021202 c = SerializableConverter.INSTANCE;
12031203 } else if (String.class.equals(hint.type())) {
12041204 c = StringSerializableConverter.INSTANCE;
1205+ } else if (hint.type() != Object.class && cls.isAssignableFrom(hint.type())) {
1206+ cls = hint.type().asSubclass(cls);
12051207 }
1208+
12061209 }
12071210
12081211 if (c == null) {
旧リポジトリブラウザで表示