Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.INVOKESPECIAL


    il.append(DUP);
    il.append(DUP);
    il.append(new ICONST(0));
    il.append(new NEWARRAY(BasicType.INT));
    il.append(SWAP);
    il.append(new INVOKESPECIAL(index));
      }
      else {
    // Push name arrays on the stack
    il.append(ALOAD_0);
    il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
             NAMES_INDEX,
             NAMES_INDEX_SIG)));
    il.append(ALOAD_0);
    il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
             URIS_INDEX,
             URIS_INDEX_SIG)));
    il.append(ALOAD_0);
    il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
             TYPES_INDEX,
             TYPES_INDEX_SIG)));
    il.append(ALOAD_0);
    il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
             NAMESPACE_INDEX,
             NAMESPACE_INDEX_SIG)));

    // Initialized DOM adapter
    il.append(new INVOKESPECIAL(index));

    // Add DOM adapter to MultiDOM class by calling addDOMAdapter()
    il.append(DUP);
    il.append(methodGen.loadDOM());
    il.append(new CHECKCAST(cpg.addClass(classGen.getDOMClass())));
View Full Code Here


  LocalVariableGen keyIterator = translateCall(classGen, methodGen);

  il.append(new NEW(cpg.addClass(DUP_FILTERED_ITERATOR)))
  il.append(DUP);
        il.append(new ALOAD(keyIterator.getIndex()));
  il.append(new INVOKESPECIAL(dupInit));
    }
View Full Code Here

  il.append(new NEW(cpg.addClass(MATCHING_ITERATOR)));
  il.append(DUP);
  il.append(new ILOAD(match.getIndex()));
        il.append(new ALOAD(stepIteratorTemp.getIndex()));
  il.append(new INVOKESPECIAL(index));

  // Get the parent of the matching node
  il.append(methodGen.loadDOM());
  il.append(new ILOAD(match.getIndex()));
  index = cpg.addInterfaceMethodref(DOM_INTF, GET_PARENT, GET_PARENT_SIG);
View Full Code Here

  compileFilter(classGen, methodGen);
 
  // Create new instance of filter
  il.append(new NEW(cpg.addClass(_className)));
  il.append(DUP);
  il.append(new INVOKESPECIAL(cpg.addMethodref(_className,
                 "<init>", "()V")));

  // Initialize closure variables
  final int length = (_closureVars == null) ? 0 : _closureVars.size();
View Full Code Here

  final InstructionList il = methodGen.getInstructionList();
  il.append(new NEW(cpg.addClass(DOUBLE_CLASS)));
  il.append(DUP_X2);
  il.append(DUP_X2);
  il.append(POP);
  il.append(new INVOKESPECIAL(cpg.addMethodref(DOUBLE_CLASS,
                 "<init>", "(D)V")));
    }
View Full Code Here

    il = new InstructionList();
    il.append(new GETSTATIC(out));
    il.append(new NEW(cp.addClass("java.lang.StringBuffer")));
    il.append(InstructionConstants.DUP);
    il.append(new PUSH(cp, "Result: "));
    il.append(new INVOKESPECIAL(cp.addMethodref("java.lang.StringBuffer",
            "<init>",
            "(Ljava/lang/String;)V")));

    il.append(new ILOAD(0));
    il.append(new INVOKEVIRTUAL(cp.addMethodref("java.lang.StringBuffer",
            "append",
            "(I)Ljava/lang/StringBuffer;")));

    il.append(new INVOKEVIRTUAL(cp.addMethodref("java.lang.StringBuffer",
            "toString",
            "()Ljava/lang/String;")));
   
    il.append(new INVOKEVIRTUAL(cp.addMethodref("java.io.PrintStream",
            "println",
            "(Ljava/lang/String;)V")));
    il.append(new PUSH(cp, 0));
    il.append(InstructionConstants.IRETURN); // Reuse objects, if possible

    method = new MethodGen(ACC_STATIC | ACC_PRIVATE | ACC_FINAL,
         Type.INT, args, argv,
         "_writeInt", class_name, il, cp);

    method.setMaxStack(4);
    class_gen.addMethod(method.getMethod());

    /* public <init> -- constructor
     */
    il.dispose(); // Dispose instruction handles for better memory utilization

    il = new InstructionList();
    il.append(new ALOAD(0)); // Push `this'
    il.append(new INVOKESPECIAL(cp.addMethodref("java.lang.Object",
            "<init>", "()V")));
    il.append(new RETURN());

    method = new MethodGen(ACC_PUBLIC, Type.VOID, Type.NO_ARGS, null,
         "<init>", class_name, il, cp);
   
    method.setMaxStack(1);
    class_gen.addMethod(method.getMethod());

    /* class initializer
     */
    il.dispose(); // Dispose instruction handles for better memory utilization
    il = new InstructionList();
    il.append(new NEW(cp.addClass("java.io.BufferedReader")));
    il.append(InstructionConstants.DUP);
    il.append(new NEW(cp.addClass("java.io.InputStreamReader")));
    il.append(InstructionConstants.DUP);
    il.append(new GETSTATIC(cp.addFieldref("java.lang.System", "in",
             "Ljava/io/InputStream;")));
    il.append(new INVOKESPECIAL(cp.addMethodref("java.io.InputStreamReader",
            "<init>", "(Ljava/io/InputStream;)V")));
    il.append(new INVOKESPECIAL(cp.addMethodref("java.io.BufferedReader",
            "<init>", "(Ljava/io/Reader;)V")));
    il.append(new PUTSTATIC(_in));
    il.append(InstructionConstants.RETURN); // Reuse instruction constants

    method = new MethodGen(ACC_STATIC, Type.VOID, Type.NO_ARGS, null,
View Full Code Here

        il.append(new ALOAD(pathTemp.getIndex()));
        il.append(new ALOAD(stepTemp.getIndex()));

  // Initialize StepIterator with iterators from the stack
  il.append(new INVOKESPECIAL(initSI));

  // This is a special case for the //* path with or without predicates
  Expression stp = _step;
  if (stp instanceof ParentLocationPath)
      stp = ((ParentLocationPath)stp).getStep();
View Full Code Here

              "toString",
              "()"+STRING_SIG);
     
      il.append(new NEW(cpg.addClass(STRING_BUFFER_CLASS)));
      il.append(DUP);
      il.append(new INVOKESPECIAL(initBuffer));
      for (int i = 0; i < nArgs; i++) {
    argument(i).translate(classGen, methodGen);
    il.append(append);
      }
      il.append(new INVOKEVIRTUAL(toString));
View Full Code Here

    il.append(methodGen.loadDOM());
    il.append(methodGen.loadIterator());
    il.append(methodGen.loadHandler());
    final int method = cpg.addMethodref(classGen.getClassName(),
                methodName, ATTR_SET_SIG);
    il.append(new INVOKESPECIAL(method));
      }
      // Generate an error if the attribute set does not exist
      else {
    final Parser parser = getParser();
    final String atrs = name.toString();
View Full Code Here

              +")V");
          il.append(new NEW(cpg.addClass(CACHED_NODE_LIST_ITERATOR_CLASS)));
          il.append(DUP_X1);
          il.append(SWAP);

          il.append(new INVOKESPECIAL(initCNI));
      }
      _select.startIterator(classGen, methodGen);
  }
  // If not, compile result tree from parameter body if present.
  else if (hasContents()) {
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.INVOKESPECIAL

Copyright © 2018 www.massapicom. 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.