Examples of PutField


Examples of com.google.test.metric.method.op.stack.PutField

    Block main = new Block("main");
    Block sub = new Block("sub");

    main.addOp(new Load(0, new Variable("this", JavaType.OBJECT, false, false)));
    main.addOp(new JSR(0, sub));
    main.addOp(new PutField(0, new FieldInfo(null, "a", JavaType.INT, false, false,
        false)));

    sub.addOp(new Load(0, new Constant(1, JavaType.INT)));
    sub.addOp(new Return(0, JavaType.VOID));
View Full Code Here

Examples of com.google.test.metric.method.op.stack.PutField

  }

  public void testVariableStaticAssignment() throws Exception {
    Block block = new Block("1");
    block.addOp(new Load(-1, var(1)));
    block.addOp(new PutField(-1, new FieldInfo(null, "abc", OBJECT,
        false, true, false)));

    List<Operation> operations = new Stack2Turing(block).translate();
    assertEquals("[null.abc{java.lang.Object} <- 1{java.lang.Object}]", operations.toString());
  }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.PutField

  public void testVariableAssignment() throws Exception {
    Block block = new Block("1");
    block.addOp(new Load(-1, var("this"))); // this
    block.addOp(new Load(-1, var(1)));
    block.addOp(new PutField(-1, new FieldInfo(null, "abc", OBJECT,
        false, false, false)));

    List<Operation> operations = new Stack2Turing(block).translate();
    assertEquals("[null.abc{java.lang.Object} <- 1{java.lang.Object}]", operations.toString());
  }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.PutField

  public void testGetField() throws Exception {
    Block block = new Block("1");
    block.addOp(new GetField(-1, new FieldInfo(null, "src", OBJECT,
        false, true, false)));
    block.addOp(new PutField(-1, new FieldInfo(null, "dst", OBJECT,
        false, true, false)));

    List<Operation> operations = new Stack2Turing(block).translate();
    assertEquals("[null.dst{java.lang.Object} <- null.src{java.lang.Object}]", operations
        .toString());
View Full Code Here

Examples of com.google.test.metric.method.op.stack.PutField

        false, true, false)));
    block.addOp(new GetField(-1, new FieldInfo(null, "p2", OBJECT,
        false, true, false)));
    block.addOp(new Invoke(-1, null, "int methodA(int, int)", asList(JavaType.INT,
        JavaType.INT), false, OBJECT));
    block.addOp(new PutField(-1, new FieldInfo(null, "dst", OBJECT,
        false, true, false)));

    List<Operation> operations = new Stack2Turing(block).translate();
    assertEquals("[null:int methodA(int, int), null.dst{java.lang.Object} <- ?{java.lang.Object}]",
        operations.toString());
View Full Code Here

Examples of com.sun.org.apache.bcel.internal.generic.PUTFIELD

                final VariableBase var = varRef.getVariable();

                // Store variable in new closure
                il.append(DUP);
                il.append(var.loadInstruction());
                il.append(new PUTFIELD(
                        cpg.addFieldref(sortRecordFactoryClass, var.getEscapedName(),
                            var.getType().toSignature())));
                dups.add(varRef);
            }
        }
View Full Code Here

Examples of java.io.ObjectOutputStream.PutField

   }

   private void writeObject(ObjectOutputStream out)
      throws IOException
   {
      PutField fields = out.putFields();
      fields.put("rootURI", this.getVFSContext().getRootURI());
      fields.put("parent", parent);
      fields.put("name", name);
      fields.put("vfsUrl", vfsUrl);
      out.writeFields();
   }
View Full Code Here

Examples of java.io.ObjectOutputStream.PutField

   }

   private void writeObject(ObjectOutputStream out)
      throws IOException
   {
      PutField fields = out.putFields();
      fields.put("rootURI", this.getVFSContext().getRootURI());
      fields.put("parent", parent);
      fields.put("name", name);
      fields.put("vfsUrl", vfsUrl);
      out.writeFields();
   }
View Full Code Here

Examples of java.io.ObjectOutputStream.PutField

    * @throws IOException
    */
   private void writeObject(ObjectOutputStream out)
      throws IOException
   {
      PutField fields = out.putFields();

      byte[] zisBytes = null;
      ZipInputStream jarStream = zis;
      if(jarStream == null)
      {
         // Need to obtain this nested jar input stream from parent
         InputStream parentIS = super.getParent().openStream();
         if(parentIS == null)
            throw new IOException("Failed to open parent stream, "+this);
         if(parentIS instanceof ZipInputStream)
         {
            jarStream = (ZipInputStream) parentIS;
         }
         else
         {
            jarStream = new ZipInputStream(parentIS);
         }
         // First find our entry
         ZipEntry entry = jarStream.getNextEntry();
         while(entry != null)
         {
            if(entry.getName().equals(getName()))
               break;
            entry = jarStream.getNextEntry();
         }
         if(entry == null)
            throw new IOException("Failed to find nested jar entry: "+this.getName()+" in parent: "+getParent());
      }
      // Now read zis for this entry
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      byte[] tmp = new byte[1024];
      int length = jarStream.read(tmp);
      while(length > 0)
      {
         baos.write(tmp, 0, length);
         length = jarStream.read(tmp);
      }
      jarStream.close();
      jarStream = null;
      zisBytes = baos.toByteArray();
      fields.put("zisBytes", zisBytes);
      fields.put("jarURL", jarURL);
      fields.put("entryURL", entryURL);
      fields.put("lastModified", lastModified);
      fields.put("size", size);
      out.writeFields();
   }
View Full Code Here

Examples of java.io.ObjectOutputStream.PutField

    * @throws IOException
    */
   private void writeObject(ObjectOutputStream out)
      throws IOException
   {
      PutField fields = out.putFields();

      byte[] zisBytes;
      ZipInputStream jarStream = zis;
      if(jarStream == null)
      {
         // Need to obtain this nested jar input stream from parent
         InputStream parentIS = super.getParent().openStream();
         if(parentIS == null)
            throw new IOException("Failed to open parent stream, "+this);
         jarStream = new ZipInputStream(parentIS);
         // First find our entry
         ZipEntry entry = jarStream.getNextEntry();
         while(entry != null)
         {
            if(entry.getName().equals(getName()))
               break;
            entry = jarStream.getNextEntry();
         }
         if(entry == null)
            throw new IOException("Failed to find nested jar entry: "+this.getName()+" in parent: "+getParent());
      }
      // Now read zis for this entry
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      byte[] tmp = new byte[1024];
      int length = jarStream.read(tmp);
      while(length > 0)
      {
         baos.write(tmp, 0, length);
         length = jarStream.read(tmp);
      }
      jarStream.close();
      jarStream = null;
      zisBytes = baos.toByteArray();
      fields.put("zisBytes", zisBytes);
      fields.put("jarURL", jarURL);
      fields.put("entryURL", entryURL);
      fields.put("lastModified", lastModified);
      fields.put("size", size);
      out.writeFields();
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.