Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2015-06-25 16:30:11 +0300
committerjfrijters <jfrijters>2015-06-25 16:30:11 +0300
commit196572bb111201caa28906249af9b544cc3e86e5 (patch)
tree150d9014ccd3c73f5a9816ee49137f41dc4d2f25
parent439a2d3f99fe1593ca846ceef9c8a06ba7248f9c (diff)
Moved ClassSerializationProxy into its own source file.
-rw-r--r--openjdk/allsources.lst1
-rw-r--r--openjdk/java/lang/Class.java59
-rw-r--r--openjdk/java/lang/ClassSerializationProxy.java85
3 files changed, 86 insertions, 59 deletions
diff --git a/openjdk/allsources.lst b/openjdk/allsources.lst
index 49e6fba3..37dd91c6 100644
--- a/openjdk/allsources.lst
+++ b/openjdk/allsources.lst
@@ -88,6 +88,7 @@ java/io/RandomAccessFile.java
java/lang/Class.java
java/lang/ClassLoader.java
java/lang/ClassLoaderHelper.java
+java/lang/ClassSerializationProxy.java
java/lang/Enum.java
java/lang/invoke/LightWeightMethodHandle.java
java/lang/LangHelper.java
diff --git a/openjdk/java/lang/Class.java b/openjdk/java/lang/Class.java
index 1d4d391f..b11e668d 100644
--- a/openjdk/java/lang/Class.java
+++ b/openjdk/java/lang/Class.java
@@ -70,68 +70,9 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.Proxy;
import sun.reflect.annotation.*;
import sun.reflect.misc.ReflectUtil;
-import cli.System.Runtime.Serialization.IObjectReference;
-import cli.System.Runtime.Serialization.SerializationException;
import cli.System.Runtime.Serialization.SerializationInfo;
import cli.System.Runtime.Serialization.StreamingContext;
-@cli.System.SerializableAttribute.Annotation
-final class ClassSerializationProxy implements IObjectReference
-{
- private cli.System.Type type;
- private String sig;
-
- @cli.System.Security.SecurityCriticalAttribute.Annotation
- public Object GetRealObject(StreamingContext context)
- {
- if (sig != null)
- {
- if (sig.length() == 1)
- {
- switch (sig.charAt(0))
- {
- case 'B':
- return Byte.TYPE;
- case 'C':
- return Character.TYPE;
- case 'D':
- return Double.TYPE;
- case 'F':
- return Float.TYPE;
- case 'I':
- return Integer.TYPE;
- case 'J':
- return Long.TYPE;
- case 'S':
- return Short.TYPE;
- case 'Z':
- return Boolean.TYPE;
- case 'V':
- return Void.TYPE;
- }
- }
- String className;
- if (sig.charAt(0) == 'L')
- {
- className = sig.substring(1, sig.length() - 1);
- }
- else
- {
- className = sig;
- }
- try
- {
- return Class.forName(className, false, Thread.currentThread().getContextClassLoader());
- }
- catch (ClassNotFoundException x)
- {
- ikvm.runtime.Util.throwException(new SerializationException(x.getMessage(), x));
- }
- }
- return ikvm.runtime.Util.getClassFromTypeHandle(type.get_TypeHandle());
- }
-}
-
/**
* Instances of the class {@code Class} represent classes and
* interfaces in a running Java application. An enum is a kind of
diff --git a/openjdk/java/lang/ClassSerializationProxy.java b/openjdk/java/lang/ClassSerializationProxy.java
new file mode 100644
index 00000000..aae76758
--- /dev/null
+++ b/openjdk/java/lang/ClassSerializationProxy.java
@@ -0,0 +1,85 @@
+/*
+ Copyright (C) 2009-2015 Jeroen Frijters
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jeroen Frijters
+ jeroen@frijters.net
+
+*/
+package java.lang;
+
+import cli.System.Runtime.Serialization.IObjectReference;
+import cli.System.Runtime.Serialization.SerializationException;
+import cli.System.Runtime.Serialization.StreamingContext;
+
+@cli.System.SerializableAttribute.Annotation
+final class ClassSerializationProxy implements IObjectReference
+{
+ private cli.System.Type type;
+ private String sig;
+
+ @cli.System.Security.SecurityCriticalAttribute.Annotation
+ public Object GetRealObject(StreamingContext context)
+ {
+ if (sig != null)
+ {
+ if (sig.length() == 1)
+ {
+ switch (sig.charAt(0))
+ {
+ case 'B':
+ return Byte.TYPE;
+ case 'C':
+ return Character.TYPE;
+ case 'D':
+ return Double.TYPE;
+ case 'F':
+ return Float.TYPE;
+ case 'I':
+ return Integer.TYPE;
+ case 'J':
+ return Long.TYPE;
+ case 'S':
+ return Short.TYPE;
+ case 'Z':
+ return Boolean.TYPE;
+ case 'V':
+ return Void.TYPE;
+ }
+ }
+ String className;
+ if (sig.charAt(0) == 'L')
+ {
+ className = sig.substring(1, sig.length() - 1);
+ }
+ else
+ {
+ className = sig;
+ }
+ try
+ {
+ return Class.forName(className, false, Thread.currentThread().getContextClassLoader());
+ }
+ catch (ClassNotFoundException x)
+ {
+ ikvm.runtime.Util.throwException(new SerializationException(x.getMessage(), x));
+ }
+ }
+ return ikvm.runtime.Util.getClassFromTypeHandle(type.get_TypeHandle());
+ }
+}