Examples of New


Examples of org.apache.bcel.generic.NEW

            default:
                // Push current output handler onto the stack
                il.append(methodGen.loadHandler());

                // Replace the current output handler by a StreamXMLOutput
                il.append(new NEW(cpg.addClass(STREAM_XML_OUTPUT)));
                il.append(methodGen.storeHandler());

                // Push a reference to a StringWriter
                il.append(new NEW(cpg.addClass(STRING_WRITER)));
                il.append(DUP);
                il.append(DUP);
                il.append(new INVOKESPECIAL(
                    cpg.addMethodref(STRING_WRITER, "<init>", "()V")));

                // Load StreamXMLOutput
                il.append(methodGen.loadHandler());
                il.append(SWAP);
                il.append(new PUSH(cpg, "UTF-8"));   // other encodings?
                il.append(new INVOKESPECIAL(
                    cpg.addMethodref(STREAM_XML_OUTPUT, "<init>",
                    "(" + WRITER_SIG + STRING_SIG + ")V")));

                // Invoke output.omitHeader(true)
                il.append(methodGen.loadHandler());
                il.append(ICONST_1);
                il.append(new INVOKEVIRTUAL(
                    cpg.addMethodref(OUTPUT_BASE, "omitHeader",
                                     "(Z)V")));

                il.append(methodGen.loadHandler());
                il.append(new INVOKEVIRTUAL(
                    cpg.addMethodref(OUTPUT_BASE, "startDocument",
                                     "()V")));

                // Inline translation of contents
                translateContents(classGen, methodGen);

                il.append(methodGen.loadHandler());
                il.append(new INVOKEVIRTUAL(
                    cpg.addMethodref(OUTPUT_BASE, "endDocument",
                                     "()V")));

                // Call toString() on StringWriter
                il.append(new INVOKEVIRTUAL(
                    cpg.addMethodref(STRING_WRITER, "toString",
                    "()" + STRING_SIG)));

                // Restore old output handler
                il.append(SWAP);
                il.append(methodGen.storeHandler());
            break;
        }

  // Send the resulting string to the message handling method
  il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS,
                 "displayMessage",
                 "("+STRING_SIG+")V")));

  // If 'terminate' attribute is set to 'yes': Instanciate a
  // RunTimeException, but it on the stack and throw an exception
  if (_terminate == true) {
      // Create a new instance of RunTimeException
      final int einit = cpg.addMethodref("java.lang.RuntimeException",
                 "<init>",
                 "(Ljava/lang/String;)V");
      il.append(new NEW(cpg.addClass("java.lang.RuntimeException")));
      il.append(DUP);
      il.append(new PUSH(cpg,"Termination forced by an " +
                 "xsl:message instruction"));
      il.append(new INVOKESPECIAL(einit));
      il.append(ATHROW);
View Full Code Here

Examples of org.apache.bcel.generic.NEW

  else if (_isExtConstructor) {
      final String clazz =
    _chosenConstructor.getDeclaringClass().getName();
      Class[] paramTypes = _chosenConstructor.getParameterTypes();
     
      il.append(new NEW(cpg.addClass(_className)));
      il.append(InstructionConstants.DUP);

      for (int i = 0; i < n; i++) {
    final Expression exp = argument(i);
    exp.translate(classGen, methodGen);
View Full Code Here

Examples of org.apache.bcel.generic.NEW

  // Wrap the KeyIndex (iterator) inside a duplicate filter iterator
  // to pre-read the indexed nodes and cache them.
  final int dupInit = cpg.addMethodref(DUP_FILTERED_ITERATOR,
               "<init>",
               "("+NODE_ITERATOR_SIG+")V");
  il.append(new NEW(cpg.addClass(DUP_FILTERED_ITERATOR)));
  il.append(DUP);
  translateCall(classGen, methodGen);
  il.append(new INVOKESPECIAL(dupInit));
    }
View Full Code Here

Examples of org.apache.bcel.generic.NEW

              "<init>",
              "("
              +NODE_ITERATOR_SIG
              +NODE_ITERATOR_SIG
              +")V");
  il.append(new NEW(cpg.addClass(STEP_ITERATOR_CLASS)));
  il.append(DUP);

  // Compile path iterator
  _path.translate(classGen, methodGen); // iterator on stack....
  _step.translate(classGen, methodGen);
View Full Code Here

Examples of test.container.X.New

  }

  @Test
  public void new_()
  {
    New o = con.get(New.class);
    assertSame(New.class, o.getClass());
    assertSame(con, o.con);
    assertSame(Deprecated.class.getName(), o.name);
    assertEquals( -1, o.new_);
    assertEquals(9, o.obj);
    assertSame(null, o.ints);

    New o1 = con.get(New.class);
    assertNotSame(o, o1);
    assertSame(o.con, o1.con);
    assertSame(o.name, o1.name);
    assertEquals(o.new_, o1.new_);

    New o2 = con.getNew(New.class);
    assertNotSame(o, o2);
    assertNotSame(o1, o2);
    assertSame(o.con, o2.con);
    assertSame(o.name, o2.name);
    assertEquals(o.new_, o2.new_);
View Full Code Here

Examples of wyvern.tools.typedAST.core.expressions.New

import java.util.HashMap;

public class TrivDSLParser implements ExtParser {
  @Override
  public TypedAST parse(ParseBuffer input) {
    New newv = new New(new HashMap<>(), null);
    TypedAST dbody = new IntegerConstant(Integer.parseInt(input.getSrcString().trim()));
    newv.setBody(new DeclSequence(Arrays.asList(new DefDeclaration("getValue", new Arrow(Unit.getInstance(), Int.getInstance()), new ArrayList<>(), dbody, false))));
    return newv;
  }
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.