Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator#addException()

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator#addException() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Stylesheet.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Compile a buildKeys() method into the output class. Note that keys
 * for the input document are created in topLevel(), not in this method.
 * However, we still need this method to create keys for documents loaded
 * via the XPath document() function.
 */
private String compileBuildKeys(ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();

    final com.sun.org.apache.bcel.internal.generic.Type[] argTypes = {
        Util.getJCRefType(DOM_INTF_SIG),
        Util.getJCRefType(NODE_ITERATOR_SIG),
        Util.getJCRefType(TRANSLET_OUTPUT_SIG),
        com.sun.org.apache.bcel.internal.generic.Type.INT
    };

    final String[] argNames = {
        DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current"
    };

    final InstructionList il = new InstructionList();

    final MethodGenerator buildKeys =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            argTypes, argNames,
                            "buildKeys", _className, il,
                            classGen.getConstantPool());

    buildKeys.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");

    final Iterator<SyntaxTreeNode> elements = elements();
    while (elements.hasNext()) {
        // xsl:key
        final SyntaxTreeNode element = elements.next();
        if (element instanceof Key) {
            final Key key = (Key)element;
            key.translate(classGen, buildKeys);
            _keys.put(key.getName(),key);
        }
    }

    il.append(RETURN);

    // Compute max locals + stack and add method to class
    buildKeys.stripAttributes(true);
    buildKeys.setMaxLocals();
    buildKeys.setMaxStack();
    buildKeys.removeNOPs();

    classGen.addMethod(buildKeys.getMethod());

    return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
}
 
Example 2
Source File: Stylesheet.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compile a buildKeys() method into the output class. Note that keys
 * for the input document are created in topLevel(), not in this method.
 * However, we still need this method to create keys for documents loaded
 * via the XPath document() function.
 */
private String compileBuildKeys(ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();

    final com.sun.org.apache.bcel.internal.generic.Type[] argTypes = {
        Util.getJCRefType(DOM_INTF_SIG),
        Util.getJCRefType(NODE_ITERATOR_SIG),
        Util.getJCRefType(TRANSLET_OUTPUT_SIG),
        com.sun.org.apache.bcel.internal.generic.Type.INT
    };

    final String[] argNames = {
        DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current"
    };

    final InstructionList il = new InstructionList();

    final MethodGenerator buildKeys =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            argTypes, argNames,
                            "buildKeys", _className, il,
                            classGen.getConstantPool());

    buildKeys.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");

    final Iterator<SyntaxTreeNode> elements = elements();
    while (elements.hasNext()) {
        // xsl:key
        final SyntaxTreeNode element = elements.next();
        if (element instanceof Key) {
            final Key key = (Key)element;
            key.translate(classGen, buildKeys);
            _keys.put(key.getName(),key);
        }
    }

    il.append(RETURN);

    // Compute max locals + stack and add method to class
    buildKeys.stripAttributes(true);
    buildKeys.setMaxLocals();
    buildKeys.setMaxStack();
    buildKeys.removeNOPs();

    classGen.addMethod(buildKeys.getMethod());

    return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
}
 
Example 3
Source File: Stylesheet.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compile a buildKeys() method into the output class. Note that keys
 * for the input document are created in topLevel(), not in this method.
 * However, we still need this method to create keys for documents loaded
 * via the XPath document() function.
 */
private String compileBuildKeys(ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();

    final com.sun.org.apache.bcel.internal.generic.Type[] argTypes = {
        Util.getJCRefType(DOM_INTF_SIG),
        Util.getJCRefType(NODE_ITERATOR_SIG),
        Util.getJCRefType(TRANSLET_OUTPUT_SIG),
        com.sun.org.apache.bcel.internal.generic.Type.INT
    };

    final String[] argNames = {
        DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current"
    };

    final InstructionList il = new InstructionList();

    final MethodGenerator buildKeys =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            argTypes, argNames,
                            "buildKeys", _className, il,
                            classGen.getConstantPool());

    buildKeys.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");

    final Enumeration elements = elements();
    while (elements.hasMoreElements()) {
        // xsl:key
        final Object element = elements.nextElement();
        if (element instanceof Key) {
            final Key key = (Key)element;
            key.translate(classGen, buildKeys);
            _keys.put(key.getName(),key);
        }
    }

    il.append(RETURN);

    // Compute max locals + stack and add method to class
    buildKeys.stripAttributes(true);
    buildKeys.setMaxLocals();
    buildKeys.setMaxStack();
    buildKeys.removeNOPs();

    classGen.addMethod(buildKeys.getMethod());

    return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
}
 
Example 4
Source File: Stylesheet.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Compile a buildKeys() method into the output class. Note that keys
 * for the input document are created in topLevel(), not in this method.
 * However, we still need this method to create keys for documents loaded
 * via the XPath document() function.
 */
private String compileBuildKeys(ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();

    final com.sun.org.apache.bcel.internal.generic.Type[] argTypes = {
        Util.getJCRefType(DOM_INTF_SIG),
        Util.getJCRefType(NODE_ITERATOR_SIG),
        Util.getJCRefType(TRANSLET_OUTPUT_SIG),
        com.sun.org.apache.bcel.internal.generic.Type.INT
    };

    final String[] argNames = {
        DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current"
    };

    final InstructionList il = new InstructionList();

    final MethodGenerator buildKeys =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            argTypes, argNames,
                            "buildKeys", _className, il,
                            classGen.getConstantPool());

    buildKeys.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");

    final Iterator<SyntaxTreeNode> elements = elements();
    while (elements.hasNext()) {
        // xsl:key
        final SyntaxTreeNode element = elements.next();
        if (element instanceof Key) {
            final Key key = (Key)element;
            key.translate(classGen, buildKeys);
            _keys.put(key.getName(),key);
        }
    }

    il.append(RETURN);

    // Compute max locals + stack and add method to class
    buildKeys.stripAttributes(true);
    buildKeys.setMaxLocals();
    buildKeys.setMaxStack();
    buildKeys.removeNOPs();

    classGen.addMethod(buildKeys.getMethod());

    return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
}
 
Example 5
Source File: Stylesheet.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compile a buildKeys() method into the output class. Note that keys
 * for the input document are created in topLevel(), not in this method.
 * However, we still need this method to create keys for documents loaded
 * via the XPath document() function.
 */
private String compileBuildKeys(ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();

    final com.sun.org.apache.bcel.internal.generic.Type[] argTypes = {
        Util.getJCRefType(DOM_INTF_SIG),
        Util.getJCRefType(NODE_ITERATOR_SIG),
        Util.getJCRefType(TRANSLET_OUTPUT_SIG),
        com.sun.org.apache.bcel.internal.generic.Type.INT
    };

    final String[] argNames = {
        DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current"
    };

    final InstructionList il = new InstructionList();

    final MethodGenerator buildKeys =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            argTypes, argNames,
                            "buildKeys", _className, il,
                            classGen.getConstantPool());

    buildKeys.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");

    final Iterator<SyntaxTreeNode> elements = elements();
    while (elements.hasNext()) {
        // xsl:key
        final SyntaxTreeNode element = elements.next();
        if (element instanceof Key) {
            final Key key = (Key)element;
            key.translate(classGen, buildKeys);
            _keys.put(key.getName(),key);
        }
    }

    il.append(RETURN);

    // Compute max locals + stack and add method to class
    buildKeys.stripAttributes(true);
    buildKeys.setMaxLocals();
    buildKeys.setMaxStack();
    buildKeys.removeNOPs();

    classGen.addMethod(buildKeys.getMethod());

    return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
}
 
Example 6
Source File: Stylesheet.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compile a buildKeys() method into the output class. Note that keys
 * for the input document are created in topLevel(), not in this method.
 * However, we still need this method to create keys for documents loaded
 * via the XPath document() function.
 */
private String compileBuildKeys(ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();

    final com.sun.org.apache.bcel.internal.generic.Type[] argTypes = {
        Util.getJCRefType(DOM_INTF_SIG),
        Util.getJCRefType(NODE_ITERATOR_SIG),
        Util.getJCRefType(TRANSLET_OUTPUT_SIG),
        com.sun.org.apache.bcel.internal.generic.Type.INT
    };

    final String[] argNames = {
        DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current"
    };

    final InstructionList il = new InstructionList();

    final MethodGenerator buildKeys =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            argTypes, argNames,
                            "buildKeys", _className, il,
                            classGen.getConstantPool());

    buildKeys.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");

    final Iterator<SyntaxTreeNode> elements = elements();
    while (elements.hasNext()) {
        // xsl:key
        final SyntaxTreeNode element = elements.next();
        if (element instanceof Key) {
            final Key key = (Key)element;
            key.translate(classGen, buildKeys);
            _keys.put(key.getName(),key);
        }
    }

    il.append(RETURN);

    // Compute max locals + stack and add method to class
    buildKeys.stripAttributes(true);
    buildKeys.setMaxLocals();
    buildKeys.setMaxStack();
    buildKeys.removeNOPs();

    classGen.addMethod(buildKeys.getMethod());

    return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
}
 
Example 7
Source File: Stylesheet.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Compile a buildKeys() method into the output class. Note that keys
 * for the input document are created in topLevel(), not in this method.
 * However, we still need this method to create keys for documents loaded
 * via the XPath document() function.
 */
private String compileBuildKeys(ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();

    final com.sun.org.apache.bcel.internal.generic.Type[] argTypes = {
        Util.getJCRefType(DOM_INTF_SIG),
        Util.getJCRefType(NODE_ITERATOR_SIG),
        Util.getJCRefType(TRANSLET_OUTPUT_SIG),
        com.sun.org.apache.bcel.internal.generic.Type.INT
    };

    final String[] argNames = {
        DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current"
    };

    final InstructionList il = new InstructionList();

    final MethodGenerator buildKeys =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            argTypes, argNames,
                            "buildKeys", _className, il,
                            classGen.getConstantPool());

    buildKeys.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");

    final Iterator<SyntaxTreeNode> elements = elements();
    while (elements.hasNext()) {
        // xsl:key
        final SyntaxTreeNode element = elements.next();
        if (element instanceof Key) {
            final Key key = (Key)element;
            key.translate(classGen, buildKeys);
            _keys.put(key.getName(),key);
        }
    }

    il.append(RETURN);

    // Compute max locals + stack and add method to class
    buildKeys.stripAttributes(true);
    buildKeys.setMaxLocals();
    buildKeys.setMaxStack();
    buildKeys.removeNOPs();

    classGen.addMethod(buildKeys.getMethod());

    return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
}
 
Example 8
Source File: Stylesheet.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compile a buildKeys() method into the output class. Note that keys
 * for the input document are created in topLevel(), not in this method.
 * However, we still need this method to create keys for documents loaded
 * via the XPath document() function.
 */
private String compileBuildKeys(ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();

    final com.sun.org.apache.bcel.internal.generic.Type[] argTypes = {
        Util.getJCRefType(DOM_INTF_SIG),
        Util.getJCRefType(NODE_ITERATOR_SIG),
        Util.getJCRefType(TRANSLET_OUTPUT_SIG),
        com.sun.org.apache.bcel.internal.generic.Type.INT
    };

    final String[] argNames = {
        DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current"
    };

    final InstructionList il = new InstructionList();

    final MethodGenerator buildKeys =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            argTypes, argNames,
                            "buildKeys", _className, il,
                            classGen.getConstantPool());

    buildKeys.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");

    final Iterator<SyntaxTreeNode> elements = elements();
    while (elements.hasNext()) {
        // xsl:key
        final SyntaxTreeNode element = elements.next();
        if (element instanceof Key) {
            final Key key = (Key)element;
            key.translate(classGen, buildKeys);
            _keys.put(key.getName(),key);
        }
    }

    il.append(RETURN);

    // Compute max locals + stack and add method to class
    buildKeys.stripAttributes(true);
    buildKeys.setMaxLocals();
    buildKeys.setMaxStack();
    buildKeys.removeNOPs();

    classGen.addMethod(buildKeys.getMethod());

    return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
}
 
Example 9
Source File: Stylesheet.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compile a buildKeys() method into the output class. Note that keys
 * for the input document are created in topLevel(), not in this method.
 * However, we still need this method to create keys for documents loaded
 * via the XPath document() function.
 */
private String compileBuildKeys(ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();

    final com.sun.org.apache.bcel.internal.generic.Type[] argTypes = {
        Util.getJCRefType(DOM_INTF_SIG),
        Util.getJCRefType(NODE_ITERATOR_SIG),
        Util.getJCRefType(TRANSLET_OUTPUT_SIG),
        com.sun.org.apache.bcel.internal.generic.Type.INT
    };

    final String[] argNames = {
        DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current"
    };

    final InstructionList il = new InstructionList();

    final MethodGenerator buildKeys =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            argTypes, argNames,
                            "buildKeys", _className, il,
                            classGen.getConstantPool());

    buildKeys.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");

    final Iterator<SyntaxTreeNode> elements = elements();
    while (elements.hasNext()) {
        // xsl:key
        final SyntaxTreeNode element = elements.next();
        if (element instanceof Key) {
            final Key key = (Key)element;
            key.translate(classGen, buildKeys);
            _keys.put(key.getName(),key);
        }
    }

    il.append(RETURN);

    // Compute max locals + stack and add method to class
    buildKeys.stripAttributes(true);
    buildKeys.setMaxLocals();
    buildKeys.setMaxStack();
    buildKeys.removeNOPs();

    classGen.addMethod(buildKeys.getMethod());

    return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
}
 
Example 10
Source File: Stylesheet.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compile a buildKeys() method into the output class. Note that keys
 * for the input document are created in topLevel(), not in this method.
 * However, we still need this method to create keys for documents loaded
 * via the XPath document() function.
 */
private String compileBuildKeys(ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();

    final com.sun.org.apache.bcel.internal.generic.Type[] argTypes = {
        Util.getJCRefType(DOM_INTF_SIG),
        Util.getJCRefType(NODE_ITERATOR_SIG),
        Util.getJCRefType(TRANSLET_OUTPUT_SIG),
        com.sun.org.apache.bcel.internal.generic.Type.INT
    };

    final String[] argNames = {
        DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current"
    };

    final InstructionList il = new InstructionList();

    final MethodGenerator buildKeys =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            argTypes, argNames,
                            "buildKeys", _className, il,
                            classGen.getConstantPool());

    buildKeys.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");

    final Enumeration elements = elements();
    while (elements.hasMoreElements()) {
        // xsl:key
        final Object element = elements.nextElement();
        if (element instanceof Key) {
            final Key key = (Key)element;
            key.translate(classGen, buildKeys);
            _keys.put(key.getName(),key);
        }
    }

    il.append(RETURN);

    // Compute max locals + stack and add method to class
    buildKeys.stripAttributes(true);
    buildKeys.setMaxLocals();
    buildKeys.setMaxStack();
    buildKeys.removeNOPs();

    classGen.addMethod(buildKeys.getMethod());

    return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
}
 
Example 11
Source File: Stylesheet.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compile a buildKeys() method into the output class. Note that keys
 * for the input document are created in topLevel(), not in this method.
 * However, we still need this method to create keys for documents loaded
 * via the XPath document() function.
 */
private String compileBuildKeys(ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();

    final com.sun.org.apache.bcel.internal.generic.Type[] argTypes = {
        Util.getJCRefType(DOM_INTF_SIG),
        Util.getJCRefType(NODE_ITERATOR_SIG),
        Util.getJCRefType(TRANSLET_OUTPUT_SIG),
        com.sun.org.apache.bcel.internal.generic.Type.INT
    };

    final String[] argNames = {
        DOCUMENT_PNAME, ITERATOR_PNAME, TRANSLET_OUTPUT_PNAME, "current"
    };

    final InstructionList il = new InstructionList();

    final MethodGenerator buildKeys =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            argTypes, argNames,
                            "buildKeys", _className, il,
                            classGen.getConstantPool());

    buildKeys.addException("com.sun.org.apache.xalan.internal.xsltc.TransletException");

    final Enumeration elements = elements();
    while (elements.hasMoreElements()) {
        // xsl:key
        final Object element = elements.nextElement();
        if (element instanceof Key) {
            final Key key = (Key)element;
            key.translate(classGen, buildKeys);
            _keys.put(key.getName(),key);
        }
    }

    il.append(RETURN);

    // Compute max locals + stack and add method to class
    buildKeys.stripAttributes(true);
    buildKeys.setMaxLocals();
    buildKeys.setMaxStack();
    buildKeys.removeNOPs();

    classGen.addMethod(buildKeys.getMethod());

    return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+"I)V");
}