home *** CD-ROM | disk | FTP | other *** search
- package sun.misc;
-
- import java.io.DataOutputStream;
- import java.io.IOException;
- import java.util.List;
- import sun.misc.ProxyGenerator.PrimitiveTypeInfo;
-
- class ProxyGenerator$ProxyMethod {
- public String methodName;
- public Class[] parameterTypes;
- public Class returnType;
- public Class[] exceptionTypes;
- public Class fromClass;
- public String methodFieldName;
- // $FF: synthetic field
- private final ProxyGenerator this$0;
-
- private ProxyGenerator$ProxyMethod(ProxyGenerator var1, String var2, Class[] var3, Class var4, Class[] var5, Class var6, String var7) {
- this.this$0 = var1;
- this.methodName = var2;
- this.parameterTypes = var3;
- this.returnType = var4;
- this.exceptionTypes = var5;
- this.fromClass = var6;
- this.methodFieldName = var7;
- }
-
- private ProxyGenerator.MethodInfo generateMethod() throws IOException {
- String var1 = ProxyGenerator.access$500(this.parameterTypes, this.returnType);
- ProxyGenerator.MethodInfo var2 = new ProxyGenerator.MethodInfo(this.this$0, this.methodName, var1, 17);
- int[] var3 = new int[this.parameterTypes.length];
- int var4 = 1;
-
- for(int var5 = 0; var5 < var3.length; ++var5) {
- var3[var5] = var4;
- var4 += ProxyGenerator.access$600(this.parameterTypes[var5]);
- }
-
- byte var8 = 0;
- DataOutputStream var10 = new DataOutputStream(var2.code);
- ProxyGenerator.access$700(this.this$0, 0, var10);
- var10.writeByte(180);
- var10.writeShort(ProxyGenerator.access$400(this.this$0).getFieldRef("java/lang/reflect/Proxy", "h", "Ljava/lang/reflect/InvocationHandler;"));
- ProxyGenerator.access$700(this.this$0, 0, var10);
- var10.writeByte(178);
- var10.writeShort(ProxyGenerator.access$400(this.this$0).getFieldRef(ProxyGenerator.access$000(ProxyGenerator.access$800(this.this$0)), this.methodFieldName, "Ljava/lang/reflect/Method;"));
- if (this.parameterTypes.length > 0) {
- ProxyGenerator.access$900(this.this$0, this.parameterTypes.length, var10);
- var10.writeByte(189);
- var10.writeShort(ProxyGenerator.access$400(this.this$0).getClass("java/lang/Object"));
-
- for(int var11 = 0; var11 < this.parameterTypes.length; ++var11) {
- var10.writeByte(89);
- ProxyGenerator.access$900(this.this$0, var11, var10);
- this.codeWrapArgument(this.parameterTypes[var11], var3[var11], var10);
- var10.writeByte(83);
- }
- } else {
- var10.writeByte(1);
- }
-
- var10.writeByte(185);
- var10.writeShort(ProxyGenerator.access$400(this.this$0).getInterfaceMethodRef("java/lang/reflect/InvocationHandler", "invoke", "(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;"));
- var10.writeByte(4);
- var10.writeByte(0);
- if (this.returnType == Void.TYPE) {
- var10.writeByte(87);
- var10.writeByte(177);
- } else {
- this.codeUnwrapReturnValue(this.returnType, var10);
- }
-
- short var7;
- short var9 = var7 = (short)var2.code.size();
- List var15 = ProxyGenerator.access$1000(this.exceptionTypes);
- if (var15.size() > 0) {
- for(Class var13 : var15) {
- var2.exceptionTable.add(new ProxyGenerator.ExceptionTableEntry(var8, var9, var7, ProxyGenerator.access$400(this.this$0).getClass(ProxyGenerator.access$000(var13.getName()))));
- }
-
- var10.writeByte(191);
- var7 = (short)var2.code.size();
- var2.exceptionTable.add(new ProxyGenerator.ExceptionTableEntry(var8, var9, var7, ProxyGenerator.access$400(this.this$0).getClass("java/lang/Throwable")));
- ProxyGenerator.access$1100(this.this$0, var4, var10);
- var10.writeByte(187);
- var10.writeShort(ProxyGenerator.access$400(this.this$0).getClass("java/lang/reflect/UndeclaredThrowableException"));
- var10.writeByte(89);
- ProxyGenerator.access$700(this.this$0, var4, var10);
- var10.writeByte(183);
- var10.writeShort(ProxyGenerator.access$400(this.this$0).getMethodRef("java/lang/reflect/UndeclaredThrowableException", "<init>", "(Ljava/lang/Throwable;)V"));
- var10.writeByte(191);
- }
-
- var2.maxStack = 10;
- var2.maxLocals = (short)(var4 + 1);
- var2.declaredExceptions = new short[this.exceptionTypes.length];
-
- for(int var16 = 0; var16 < this.exceptionTypes.length; ++var16) {
- var2.declaredExceptions[var16] = ProxyGenerator.access$400(this.this$0).getClass(ProxyGenerator.access$000(this.exceptionTypes[var16].getName()));
- }
-
- return var2;
- }
-
- private void codeWrapArgument(Class var1, int var2, DataOutputStream var3) throws IOException {
- if (var1.isPrimitive()) {
- ProxyGenerator.PrimitiveTypeInfo var4 = PrimitiveTypeInfo.get(var1);
- var3.writeByte(187);
- var3.writeShort(ProxyGenerator.access$400(this.this$0).getClass(var4.wrapperClassName));
- var3.writeByte(89);
- if (var1 != Integer.TYPE && var1 != Boolean.TYPE && var1 != Byte.TYPE && var1 != Character.TYPE && var1 != Short.TYPE) {
- if (var1 == Long.TYPE) {
- ProxyGenerator.access$1300(this.this$0, var2, var3);
- } else if (var1 == Float.TYPE) {
- ProxyGenerator.access$1400(this.this$0, var2, var3);
- } else if (var1 == Double.TYPE) {
- ProxyGenerator.access$1500(this.this$0, var2, var3);
- } else {
- ProxyGenerator.access$1600(false);
- }
- } else {
- ProxyGenerator.access$1200(this.this$0, var2, var3);
- }
-
- var3.writeByte(183);
- var3.writeShort(ProxyGenerator.access$400(this.this$0).getMethodRef(var4.wrapperClassName, "<init>", var4.wrapperConstructorDesc));
- } else {
- ProxyGenerator.access$700(this.this$0, var2, var3);
- }
-
- }
-
- private void codeUnwrapReturnValue(Class var1, DataOutputStream var2) throws IOException {
- if (var1.isPrimitive()) {
- ProxyGenerator.PrimitiveTypeInfo var3 = PrimitiveTypeInfo.get(var1);
- var2.writeByte(192);
- var2.writeShort(ProxyGenerator.access$400(this.this$0).getClass(var3.wrapperClassName));
- var2.writeByte(182);
- var2.writeShort(ProxyGenerator.access$400(this.this$0).getMethodRef(var3.wrapperClassName, var3.unwrapMethodName, var3.unwrapMethodDesc));
- if (var1 != Integer.TYPE && var1 != Boolean.TYPE && var1 != Byte.TYPE && var1 != Character.TYPE && var1 != Short.TYPE) {
- if (var1 == Long.TYPE) {
- var2.writeByte(173);
- } else if (var1 == Float.TYPE) {
- var2.writeByte(174);
- } else if (var1 == Double.TYPE) {
- var2.writeByte(175);
- } else {
- ProxyGenerator.access$1600(false);
- }
- } else {
- var2.writeByte(172);
- }
- } else {
- var2.writeByte(192);
- var2.writeShort(ProxyGenerator.access$400(this.this$0).getClass(ProxyGenerator.access$000(var1.getName())));
- var2.writeByte(176);
- }
-
- }
-
- private void codeFieldInitialization(DataOutputStream var1) throws IOException {
- ProxyGenerator.access$1700(this.this$0, this.fromClass, var1);
- ProxyGenerator.access$1800(this.this$0, ProxyGenerator.access$400(this.this$0).getString(this.methodName), var1);
- ProxyGenerator.access$900(this.this$0, this.parameterTypes.length, var1);
- var1.writeByte(189);
- var1.writeShort(ProxyGenerator.access$400(this.this$0).getClass("java/lang/Class"));
-
- for(int var2 = 0; var2 < this.parameterTypes.length; ++var2) {
- var1.writeByte(89);
- ProxyGenerator.access$900(this.this$0, var2, var1);
- if (this.parameterTypes[var2].isPrimitive()) {
- ProxyGenerator.PrimitiveTypeInfo var3 = PrimitiveTypeInfo.get(this.parameterTypes[var2]);
- var1.writeByte(178);
- var1.writeShort(ProxyGenerator.access$400(this.this$0).getFieldRef(var3.wrapperClassName, "TYPE", "Ljava/lang/Class;"));
- } else {
- ProxyGenerator.access$1700(this.this$0, this.parameterTypes[var2], var1);
- }
-
- var1.writeByte(83);
- }
-
- var1.writeByte(182);
- var1.writeShort(ProxyGenerator.access$400(this.this$0).getMethodRef("java/lang/Class", "getMethod", "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;"));
- var1.writeByte(179);
- var1.writeShort(ProxyGenerator.access$400(this.this$0).getFieldRef(ProxyGenerator.access$000(ProxyGenerator.access$800(this.this$0)), this.methodFieldName, "Ljava/lang/reflect/Method;"));
- }
-
- // $FF: synthetic method
- static ProxyGenerator.MethodInfo access$200(ProxyGenerator$ProxyMethod var0) throws IOException {
- return var0.generateMethod();
- }
-
- // $FF: synthetic method
- ProxyGenerator$ProxyMethod(ProxyGenerator var1, String var2, Class[] var3, Class var4, Class[] var5, Class var6, String var7, ProxyGenerator.1 var8) {
- this(var1, var2, var3, var4, var5, var6, var7);
- }
-
- // $FF: synthetic method
- static void access$1900(ProxyGenerator$ProxyMethod var0, DataOutputStream var1) throws IOException {
- var0.codeFieldInitialization(var1);
- }
- }
-