home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / sun / misc / ProxyGenerator$ProxyMethod.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  6.0 KB  |  203 lines

  1. package sun.misc;
  2.  
  3. import java.io.DataOutputStream;
  4. import java.io.IOException;
  5. import java.util.List;
  6. import sun.misc.ProxyGenerator.PrimitiveTypeInfo;
  7.  
  8. class ProxyGenerator$ProxyMethod {
  9.    public String methodName;
  10.    public Class[] parameterTypes;
  11.    public Class returnType;
  12.    public Class[] exceptionTypes;
  13.    public Class fromClass;
  14.    public String methodFieldName;
  15.    // $FF: synthetic field
  16.    private final ProxyGenerator this$0;
  17.  
  18.    private ProxyGenerator$ProxyMethod(ProxyGenerator var1, String var2, Class[] var3, Class var4, Class[] var5, Class var6, String var7) {
  19.       this.this$0 = var1;
  20.       this.methodName = var2;
  21.       this.parameterTypes = var3;
  22.       this.returnType = var4;
  23.       this.exceptionTypes = var5;
  24.       this.fromClass = var6;
  25.       this.methodFieldName = var7;
  26.    }
  27.  
  28.    private ProxyGenerator.MethodInfo generateMethod() throws IOException {
  29.       String var1 = ProxyGenerator.access$500(this.parameterTypes, this.returnType);
  30.       ProxyGenerator.MethodInfo var2 = new ProxyGenerator.MethodInfo(this.this$0, this.methodName, var1, 17);
  31.       int[] var3 = new int[this.parameterTypes.length];
  32.       int var4 = 1;
  33.  
  34.       for(int var5 = 0; var5 < var3.length; ++var5) {
  35.          var3[var5] = var4;
  36.          var4 += ProxyGenerator.access$600(this.parameterTypes[var5]);
  37.       }
  38.  
  39.       byte var8 = 0;
  40.       DataOutputStream var10 = new DataOutputStream(var2.code);
  41.       ProxyGenerator.access$700(this.this$0, 0, var10);
  42.       var10.writeByte(180);
  43.       var10.writeShort(ProxyGenerator.access$400(this.this$0).getFieldRef("java/lang/reflect/Proxy", "h", "Ljava/lang/reflect/InvocationHandler;"));
  44.       ProxyGenerator.access$700(this.this$0, 0, var10);
  45.       var10.writeByte(178);
  46.       var10.writeShort(ProxyGenerator.access$400(this.this$0).getFieldRef(ProxyGenerator.access$000(ProxyGenerator.access$800(this.this$0)), this.methodFieldName, "Ljava/lang/reflect/Method;"));
  47.       if (this.parameterTypes.length > 0) {
  48.          ProxyGenerator.access$900(this.this$0, this.parameterTypes.length, var10);
  49.          var10.writeByte(189);
  50.          var10.writeShort(ProxyGenerator.access$400(this.this$0).getClass("java/lang/Object"));
  51.  
  52.          for(int var11 = 0; var11 < this.parameterTypes.length; ++var11) {
  53.             var10.writeByte(89);
  54.             ProxyGenerator.access$900(this.this$0, var11, var10);
  55.             this.codeWrapArgument(this.parameterTypes[var11], var3[var11], var10);
  56.             var10.writeByte(83);
  57.          }
  58.       } else {
  59.          var10.writeByte(1);
  60.       }
  61.  
  62.       var10.writeByte(185);
  63.       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;"));
  64.       var10.writeByte(4);
  65.       var10.writeByte(0);
  66.       if (this.returnType == Void.TYPE) {
  67.          var10.writeByte(87);
  68.          var10.writeByte(177);
  69.       } else {
  70.          this.codeUnwrapReturnValue(this.returnType, var10);
  71.       }
  72.  
  73.       short var7;
  74.       short var9 = var7 = (short)var2.code.size();
  75.       List var15 = ProxyGenerator.access$1000(this.exceptionTypes);
  76.       if (var15.size() > 0) {
  77.          for(Class var13 : var15) {
  78.             var2.exceptionTable.add(new ProxyGenerator.ExceptionTableEntry(var8, var9, var7, ProxyGenerator.access$400(this.this$0).getClass(ProxyGenerator.access$000(var13.getName()))));
  79.          }
  80.  
  81.          var10.writeByte(191);
  82.          var7 = (short)var2.code.size();
  83.          var2.exceptionTable.add(new ProxyGenerator.ExceptionTableEntry(var8, var9, var7, ProxyGenerator.access$400(this.this$0).getClass("java/lang/Throwable")));
  84.          ProxyGenerator.access$1100(this.this$0, var4, var10);
  85.          var10.writeByte(187);
  86.          var10.writeShort(ProxyGenerator.access$400(this.this$0).getClass("java/lang/reflect/UndeclaredThrowableException"));
  87.          var10.writeByte(89);
  88.          ProxyGenerator.access$700(this.this$0, var4, var10);
  89.          var10.writeByte(183);
  90.          var10.writeShort(ProxyGenerator.access$400(this.this$0).getMethodRef("java/lang/reflect/UndeclaredThrowableException", "<init>", "(Ljava/lang/Throwable;)V"));
  91.          var10.writeByte(191);
  92.       }
  93.  
  94.       var2.maxStack = 10;
  95.       var2.maxLocals = (short)(var4 + 1);
  96.       var2.declaredExceptions = new short[this.exceptionTypes.length];
  97.  
  98.       for(int var16 = 0; var16 < this.exceptionTypes.length; ++var16) {
  99.          var2.declaredExceptions[var16] = ProxyGenerator.access$400(this.this$0).getClass(ProxyGenerator.access$000(this.exceptionTypes[var16].getName()));
  100.       }
  101.  
  102.       return var2;
  103.    }
  104.  
  105.    private void codeWrapArgument(Class var1, int var2, DataOutputStream var3) throws IOException {
  106.       if (var1.isPrimitive()) {
  107.          ProxyGenerator.PrimitiveTypeInfo var4 = PrimitiveTypeInfo.get(var1);
  108.          var3.writeByte(187);
  109.          var3.writeShort(ProxyGenerator.access$400(this.this$0).getClass(var4.wrapperClassName));
  110.          var3.writeByte(89);
  111.          if (var1 != Integer.TYPE && var1 != Boolean.TYPE && var1 != Byte.TYPE && var1 != Character.TYPE && var1 != Short.TYPE) {
  112.             if (var1 == Long.TYPE) {
  113.                ProxyGenerator.access$1300(this.this$0, var2, var3);
  114.             } else if (var1 == Float.TYPE) {
  115.                ProxyGenerator.access$1400(this.this$0, var2, var3);
  116.             } else if (var1 == Double.TYPE) {
  117.                ProxyGenerator.access$1500(this.this$0, var2, var3);
  118.             } else {
  119.                ProxyGenerator.access$1600(false);
  120.             }
  121.          } else {
  122.             ProxyGenerator.access$1200(this.this$0, var2, var3);
  123.          }
  124.  
  125.          var3.writeByte(183);
  126.          var3.writeShort(ProxyGenerator.access$400(this.this$0).getMethodRef(var4.wrapperClassName, "<init>", var4.wrapperConstructorDesc));
  127.       } else {
  128.          ProxyGenerator.access$700(this.this$0, var2, var3);
  129.       }
  130.  
  131.    }
  132.  
  133.    private void codeUnwrapReturnValue(Class var1, DataOutputStream var2) throws IOException {
  134.       if (var1.isPrimitive()) {
  135.          ProxyGenerator.PrimitiveTypeInfo var3 = PrimitiveTypeInfo.get(var1);
  136.          var2.writeByte(192);
  137.          var2.writeShort(ProxyGenerator.access$400(this.this$0).getClass(var3.wrapperClassName));
  138.          var2.writeByte(182);
  139.          var2.writeShort(ProxyGenerator.access$400(this.this$0).getMethodRef(var3.wrapperClassName, var3.unwrapMethodName, var3.unwrapMethodDesc));
  140.          if (var1 != Integer.TYPE && var1 != Boolean.TYPE && var1 != Byte.TYPE && var1 != Character.TYPE && var1 != Short.TYPE) {
  141.             if (var1 == Long.TYPE) {
  142.                var2.writeByte(173);
  143.             } else if (var1 == Float.TYPE) {
  144.                var2.writeByte(174);
  145.             } else if (var1 == Double.TYPE) {
  146.                var2.writeByte(175);
  147.             } else {
  148.                ProxyGenerator.access$1600(false);
  149.             }
  150.          } else {
  151.             var2.writeByte(172);
  152.          }
  153.       } else {
  154.          var2.writeByte(192);
  155.          var2.writeShort(ProxyGenerator.access$400(this.this$0).getClass(ProxyGenerator.access$000(var1.getName())));
  156.          var2.writeByte(176);
  157.       }
  158.  
  159.    }
  160.  
  161.    private void codeFieldInitialization(DataOutputStream var1) throws IOException {
  162.       ProxyGenerator.access$1700(this.this$0, this.fromClass, var1);
  163.       ProxyGenerator.access$1800(this.this$0, ProxyGenerator.access$400(this.this$0).getString(this.methodName), var1);
  164.       ProxyGenerator.access$900(this.this$0, this.parameterTypes.length, var1);
  165.       var1.writeByte(189);
  166.       var1.writeShort(ProxyGenerator.access$400(this.this$0).getClass("java/lang/Class"));
  167.  
  168.       for(int var2 = 0; var2 < this.parameterTypes.length; ++var2) {
  169.          var1.writeByte(89);
  170.          ProxyGenerator.access$900(this.this$0, var2, var1);
  171.          if (this.parameterTypes[var2].isPrimitive()) {
  172.             ProxyGenerator.PrimitiveTypeInfo var3 = PrimitiveTypeInfo.get(this.parameterTypes[var2]);
  173.             var1.writeByte(178);
  174.             var1.writeShort(ProxyGenerator.access$400(this.this$0).getFieldRef(var3.wrapperClassName, "TYPE", "Ljava/lang/Class;"));
  175.          } else {
  176.             ProxyGenerator.access$1700(this.this$0, this.parameterTypes[var2], var1);
  177.          }
  178.  
  179.          var1.writeByte(83);
  180.       }
  181.  
  182.       var1.writeByte(182);
  183.       var1.writeShort(ProxyGenerator.access$400(this.this$0).getMethodRef("java/lang/Class", "getMethod", "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;"));
  184.       var1.writeByte(179);
  185.       var1.writeShort(ProxyGenerator.access$400(this.this$0).getFieldRef(ProxyGenerator.access$000(ProxyGenerator.access$800(this.this$0)), this.methodFieldName, "Ljava/lang/reflect/Method;"));
  186.    }
  187.  
  188.    // $FF: synthetic method
  189.    static ProxyGenerator.MethodInfo access$200(ProxyGenerator$ProxyMethod var0) throws IOException {
  190.       return var0.generateMethod();
  191.    }
  192.  
  193.    // $FF: synthetic method
  194.    ProxyGenerator$ProxyMethod(ProxyGenerator var1, String var2, Class[] var3, Class var4, Class[] var5, Class var6, String var7, ProxyGenerator.1 var8) {
  195.       this(var1, var2, var3, var4, var5, var6, var7);
  196.    }
  197.  
  198.    // $FF: synthetic method
  199.    static void access$1900(ProxyGenerator$ProxyMethod var0, DataOutputStream var1) throws IOException {
  200.       var0.codeFieldInitialization(var1);
  201.    }
  202. }
  203.