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

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.compiler.util.NodeSortRecordGenerator#addField() . 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: Sort.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new auxillary class extending NodeSortRecord.
 */
private static String compileSortRecord(Vector<Sort> sortObjects,
                                        ClassGenerator classGen,
                                        MethodGenerator methodGen) {
    final XSLTC  xsltc = sortObjects.firstElement().getXSLTC();
    final String className = xsltc.getHelperClassName();

    // This generates a new class for handling this specific sort
    final NodeSortRecordGenerator sortRecord =
        new NodeSortRecordGenerator(className,
                                    NODE_SORT_RECORD,
                                    "sort$0.java",
                                    ACC_PUBLIC | ACC_SUPER | ACC_FINAL,
                                    new String[] {},
                                    classGen.getStylesheet());

    final ConstantPoolGen cpg = sortRecord.getConstantPool();

    // Add a new instance variable for each var in closure
    final int nsorts = sortObjects.size();
    final ArrayList<VariableRefBase> dups = new ArrayList<>();

    for (int j = 0; j < nsorts; j++) {
        final Sort sort = sortObjects.get(j);

        // Set the name of the inner class in this sort object
        sort.setInnerClassName(className);

        final int length = (sort._closureVars == null) ? 0 :
            sort._closureVars.size();
        for (int i = 0; i < length; i++) {
            final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i);

            // Discard duplicate variable references
            if (dups.contains(varRef)) continue;

            final VariableBase var = varRef.getVariable();
            sortRecord.addField(new Field(ACC_PUBLIC,
                                cpg.addUtf8(var.getEscapedName()),
                                cpg.addUtf8(var.getType().toSignature()),
                                null, cpg.getConstantPool()));
            dups.add(varRef);
        }
    }

    MethodGenerator init = compileInit(sortRecord, cpg, className);
    MethodGenerator extract = compileExtract(sortObjects, sortRecord,
                                    cpg, className);
    sortRecord.addMethod(init);
    sortRecord.addMethod(extract);

    xsltc.dumpClass(sortRecord.getJavaClass());
    return className;
}
 
Example 2
Source File: Sort.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new auxillary class extending NodeSortRecord.
 */
private static String compileSortRecord(Vector<Sort> sortObjects,
                                        ClassGenerator classGen,
                                        MethodGenerator methodGen) {
    final XSLTC  xsltc = sortObjects.firstElement().getXSLTC();
    final String className = xsltc.getHelperClassName();

    // This generates a new class for handling this specific sort
    final NodeSortRecordGenerator sortRecord =
        new NodeSortRecordGenerator(className,
                                    NODE_SORT_RECORD,
                                    "sort$0.java",
                                    ACC_PUBLIC | ACC_SUPER | ACC_FINAL,
                                    new String[] {},
                                    classGen.getStylesheet());

    final ConstantPoolGen cpg = sortRecord.getConstantPool();

    // Add a new instance variable for each var in closure
    final int nsorts = sortObjects.size();
    final ArrayList<VariableRefBase> dups = new ArrayList<>();

    for (int j = 0; j < nsorts; j++) {
        final Sort sort = sortObjects.get(j);

        // Set the name of the inner class in this sort object
        sort.setInnerClassName(className);

        final int length = (sort._closureVars == null) ? 0 :
            sort._closureVars.size();
        for (int i = 0; i < length; i++) {
            final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i);

            // Discard duplicate variable references
            if (dups.contains(varRef)) continue;

            final VariableBase var = varRef.getVariable();
            sortRecord.addField(new Field(ACC_PUBLIC,
                                cpg.addUtf8(var.getEscapedName()),
                                cpg.addUtf8(var.getType().toSignature()),
                                null, cpg.getConstantPool()));
            dups.add(varRef);
        }
    }

    MethodGenerator init = compileInit(sortRecord, cpg, className);
    MethodGenerator extract = compileExtract(sortObjects, sortRecord,
                                    cpg, className);
    sortRecord.addMethod(init);
    sortRecord.addMethod(extract);

    xsltc.dumpClass(sortRecord.getJavaClass());
    return className;
}
 
Example 3
Source File: Sort.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new auxillary class extending NodeSortRecord.
 */
private static String compileSortRecord(Vector sortObjects,
                                        ClassGenerator classGen,
                                        MethodGenerator methodGen) {
    final XSLTC  xsltc = ((Sort)sortObjects.firstElement()).getXSLTC();
    final String className = xsltc.getHelperClassName();

    // This generates a new class for handling this specific sort
    final NodeSortRecordGenerator sortRecord =
        new NodeSortRecordGenerator(className,
                                    NODE_SORT_RECORD,
                                    "sort$0.java",
                                    ACC_PUBLIC | ACC_SUPER | ACC_FINAL,
                                    new String[] {},
                                    classGen.getStylesheet());

    final ConstantPoolGen cpg = sortRecord.getConstantPool();

    // Add a new instance variable for each var in closure
    final int nsorts = sortObjects.size();
    final ArrayList dups = new ArrayList();

    for (int j = 0; j < nsorts; j++) {
        final Sort sort = (Sort) sortObjects.get(j);

        // Set the name of the inner class in this sort object
        sort.setInnerClassName(className);

        final int length = (sort._closureVars == null) ? 0 :
            sort._closureVars.size();
        for (int i = 0; i < length; i++) {
            final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i);

            // Discard duplicate variable references
            if (dups.contains(varRef)) continue;

            final VariableBase var = varRef.getVariable();
            sortRecord.addField(new Field(ACC_PUBLIC,
                                cpg.addUtf8(var.getEscapedName()),
                                cpg.addUtf8(var.getType().toSignature()),
                                null, cpg.getConstantPool()));
            dups.add(varRef);
        }
    }

    MethodGenerator init = compileInit(sortObjects, sortRecord,
                                     cpg, className);
    MethodGenerator extract = compileExtract(sortObjects, sortRecord,
                                    cpg, className);
    sortRecord.addMethod(init);
    sortRecord.addMethod(extract);

    xsltc.dumpClass(sortRecord.getJavaClass());
    return className;
}
 
Example 4
Source File: Sort.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Create a new auxillary class extending NodeSortRecord.
 */
private static String compileSortRecord(Vector<Sort> sortObjects,
                                        ClassGenerator classGen,
                                        MethodGenerator methodGen) {
    final XSLTC  xsltc = sortObjects.firstElement().getXSLTC();
    final String className = xsltc.getHelperClassName();

    // This generates a new class for handling this specific sort
    final NodeSortRecordGenerator sortRecord =
        new NodeSortRecordGenerator(className,
                                    NODE_SORT_RECORD,
                                    "sort$0.java",
                                    ACC_PUBLIC | ACC_SUPER | ACC_FINAL,
                                    new String[] {},
                                    classGen.getStylesheet());

    final ConstantPoolGen cpg = sortRecord.getConstantPool();

    // Add a new instance variable for each var in closure
    final int nsorts = sortObjects.size();
    final ArrayList<VariableRefBase> dups = new ArrayList<>();

    for (int j = 0; j < nsorts; j++) {
        final Sort sort = sortObjects.get(j);

        // Set the name of the inner class in this sort object
        sort.setInnerClassName(className);

        final int length = (sort._closureVars == null) ? 0 :
            sort._closureVars.size();
        for (int i = 0; i < length; i++) {
            final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i);

            // Discard duplicate variable references
            if (dups.contains(varRef)) continue;

            final VariableBase var = varRef.getVariable();
            sortRecord.addField(new Field(ACC_PUBLIC,
                                cpg.addUtf8(var.getEscapedName()),
                                cpg.addUtf8(var.getType().toSignature()),
                                null, cpg.getConstantPool()));
            dups.add(varRef);
        }
    }

    MethodGenerator init = compileInit(sortRecord, cpg, className);
    MethodGenerator extract = compileExtract(sortObjects, sortRecord,
                                    cpg, className);
    sortRecord.addMethod(init);
    sortRecord.addMethod(extract);

    xsltc.dumpClass(sortRecord.getJavaClass());
    return className;
}
 
Example 5
Source File: Sort.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new auxillary class extending NodeSortRecord.
 */
private static String compileSortRecord(Vector<Sort> sortObjects,
                                        ClassGenerator classGen,
                                        MethodGenerator methodGen) {
    final XSLTC  xsltc = sortObjects.firstElement().getXSLTC();
    final String className = xsltc.getHelperClassName();

    // This generates a new class for handling this specific sort
    final NodeSortRecordGenerator sortRecord =
        new NodeSortRecordGenerator(className,
                                    NODE_SORT_RECORD,
                                    "sort$0.java",
                                    ACC_PUBLIC | ACC_SUPER | ACC_FINAL,
                                    new String[] {},
                                    classGen.getStylesheet());

    final ConstantPoolGen cpg = sortRecord.getConstantPool();

    // Add a new instance variable for each var in closure
    final int nsorts = sortObjects.size();
    final ArrayList<VariableRefBase> dups = new ArrayList<>();

    for (int j = 0; j < nsorts; j++) {
        final Sort sort = sortObjects.get(j);

        // Set the name of the inner class in this sort object
        sort.setInnerClassName(className);

        final int length = (sort._closureVars == null) ? 0 :
            sort._closureVars.size();
        for (int i = 0; i < length; i++) {
            final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i);

            // Discard duplicate variable references
            if (dups.contains(varRef)) continue;

            final VariableBase var = varRef.getVariable();
            sortRecord.addField(new Field(ACC_PUBLIC,
                                cpg.addUtf8(var.getEscapedName()),
                                cpg.addUtf8(var.getType().toSignature()),
                                null, cpg.getConstantPool()));
            dups.add(varRef);
        }
    }

    MethodGenerator init = compileInit(sortRecord, cpg, className);
    MethodGenerator extract = compileExtract(sortObjects, sortRecord,
                                    cpg, className);
    sortRecord.addMethod(init);
    sortRecord.addMethod(extract);

    xsltc.dumpClass(sortRecord.getJavaClass());
    return className;
}
 
Example 6
Source File: Sort.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new auxillary class extending NodeSortRecord.
 */
private static String compileSortRecord(Vector<Sort> sortObjects,
                                        ClassGenerator classGen,
                                        MethodGenerator methodGen) {
    final XSLTC  xsltc = sortObjects.firstElement().getXSLTC();
    final String className = xsltc.getHelperClassName();

    // This generates a new class for handling this specific sort
    final NodeSortRecordGenerator sortRecord =
        new NodeSortRecordGenerator(className,
                                    NODE_SORT_RECORD,
                                    "sort$0.java",
                                    ACC_PUBLIC | ACC_SUPER | ACC_FINAL,
                                    new String[] {},
                                    classGen.getStylesheet());

    final ConstantPoolGen cpg = sortRecord.getConstantPool();

    // Add a new instance variable for each var in closure
    final int nsorts = sortObjects.size();
    final ArrayList<VariableRefBase> dups = new ArrayList<>();

    for (int j = 0; j < nsorts; j++) {
        final Sort sort = sortObjects.get(j);

        // Set the name of the inner class in this sort object
        sort.setInnerClassName(className);

        final int length = (sort._closureVars == null) ? 0 :
            sort._closureVars.size();
        for (int i = 0; i < length; i++) {
            final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i);

            // Discard duplicate variable references
            if (dups.contains(varRef)) continue;

            final VariableBase var = varRef.getVariable();
            sortRecord.addField(new Field(ACC_PUBLIC,
                                cpg.addUtf8(var.getEscapedName()),
                                cpg.addUtf8(var.getType().toSignature()),
                                null, cpg.getConstantPool()));
            dups.add(varRef);
        }
    }

    MethodGenerator init = compileInit(sortRecord, cpg, className);
    MethodGenerator extract = compileExtract(sortObjects, sortRecord,
                                    cpg, className);
    sortRecord.addMethod(init);
    sortRecord.addMethod(extract);

    xsltc.dumpClass(sortRecord.getJavaClass());
    return className;
}
 
Example 7
Source File: Sort.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Create a new auxillary class extending NodeSortRecord.
 */
private static String compileSortRecord(List<Sort> sortObjects,
                                        ClassGenerator classGen,
                                        MethodGenerator methodGen) {
    final XSLTC  xsltc = sortObjects.get(0).getXSLTC();
    final String className = xsltc.getHelperClassName();

    // This generates a new class for handling this specific sort
    final NodeSortRecordGenerator sortRecord =
        new NodeSortRecordGenerator(className,
                                    NODE_SORT_RECORD,
                                    "sort$0.java",
                                    ACC_PUBLIC | ACC_SUPER | ACC_FINAL,
                                    new String[] {},
                                    classGen.getStylesheet());

    final ConstantPoolGen cpg = sortRecord.getConstantPool();

    // Add a new instance variable for each var in closure
    final int nsorts = sortObjects.size();
    final List<VariableRefBase> dups = new ArrayList<>();

    for (int j = 0; j < nsorts; j++) {
        final Sort sort = sortObjects.get(j);

        // Set the name of the inner class in this sort object
        sort.setInnerClassName(className);

        final int length = (sort._closureVars == null) ? 0 :
            sort._closureVars.size();
        for (int i = 0; i < length; i++) {
            final VariableRefBase varRef = sort._closureVars.get(i);

            // Discard duplicate variable references
            if (dups.contains(varRef)) continue;

            final VariableBase var = varRef.getVariable();
            sortRecord.addField(new Field(ACC_PUBLIC,
                                cpg.addUtf8(var.getEscapedName()),
                                cpg.addUtf8(var.getType().toSignature()),
                                null, cpg.getConstantPool()));
            dups.add(varRef);
        }
    }

    MethodGenerator init = compileInit(sortRecord, cpg, className);
    MethodGenerator extract = compileExtract(sortObjects, sortRecord,
                                    cpg, className);
    sortRecord.addMethod(init);
    sortRecord.addMethod(extract);

    xsltc.dumpClass(sortRecord.getJavaClass());
    return className;
}
 
Example 8
Source File: Sort.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new auxillary class extending NodeSortRecord.
 */
private static String compileSortRecord(Vector<Sort> sortObjects,
                                        ClassGenerator classGen,
                                        MethodGenerator methodGen) {
    final XSLTC  xsltc = sortObjects.firstElement().getXSLTC();
    final String className = xsltc.getHelperClassName();

    // This generates a new class for handling this specific sort
    final NodeSortRecordGenerator sortRecord =
        new NodeSortRecordGenerator(className,
                                    NODE_SORT_RECORD,
                                    "sort$0.java",
                                    ACC_PUBLIC | ACC_SUPER | ACC_FINAL,
                                    new String[] {},
                                    classGen.getStylesheet());

    final ConstantPoolGen cpg = sortRecord.getConstantPool();

    // Add a new instance variable for each var in closure
    final int nsorts = sortObjects.size();
    final ArrayList<VariableRefBase> dups = new ArrayList<>();

    for (int j = 0; j < nsorts; j++) {
        final Sort sort = sortObjects.get(j);

        // Set the name of the inner class in this sort object
        sort.setInnerClassName(className);

        final int length = (sort._closureVars == null) ? 0 :
            sort._closureVars.size();
        for (int i = 0; i < length; i++) {
            final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i);

            // Discard duplicate variable references
            if (dups.contains(varRef)) continue;

            final VariableBase var = varRef.getVariable();
            sortRecord.addField(new Field(ACC_PUBLIC,
                                cpg.addUtf8(var.getEscapedName()),
                                cpg.addUtf8(var.getType().toSignature()),
                                null, cpg.getConstantPool()));
            dups.add(varRef);
        }
    }

    MethodGenerator init = compileInit(sortRecord, cpg, className);
    MethodGenerator extract = compileExtract(sortObjects, sortRecord,
                                    cpg, className);
    sortRecord.addMethod(init);
    sortRecord.addMethod(extract);

    xsltc.dumpClass(sortRecord.getJavaClass());
    return className;
}
 
Example 9
Source File: Sort.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new auxillary class extending NodeSortRecord.
 */
private static String compileSortRecord(Vector<Sort> sortObjects,
                                        ClassGenerator classGen,
                                        MethodGenerator methodGen) {
    final XSLTC  xsltc = sortObjects.firstElement().getXSLTC();
    final String className = xsltc.getHelperClassName();

    // This generates a new class for handling this specific sort
    final NodeSortRecordGenerator sortRecord =
        new NodeSortRecordGenerator(className,
                                    NODE_SORT_RECORD,
                                    "sort$0.java",
                                    ACC_PUBLIC | ACC_SUPER | ACC_FINAL,
                                    new String[] {},
                                    classGen.getStylesheet());

    final ConstantPoolGen cpg = sortRecord.getConstantPool();

    // Add a new instance variable for each var in closure
    final int nsorts = sortObjects.size();
    final ArrayList<VariableRefBase> dups = new ArrayList<>();

    for (int j = 0; j < nsorts; j++) {
        final Sort sort = sortObjects.get(j);

        // Set the name of the inner class in this sort object
        sort.setInnerClassName(className);

        final int length = (sort._closureVars == null) ? 0 :
            sort._closureVars.size();
        for (int i = 0; i < length; i++) {
            final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i);

            // Discard duplicate variable references
            if (dups.contains(varRef)) continue;

            final VariableBase var = varRef.getVariable();
            sortRecord.addField(new Field(ACC_PUBLIC,
                                cpg.addUtf8(var.getEscapedName()),
                                cpg.addUtf8(var.getType().toSignature()),
                                null, cpg.getConstantPool()));
            dups.add(varRef);
        }
    }

    MethodGenerator init = compileInit(sortRecord, cpg, className);
    MethodGenerator extract = compileExtract(sortObjects, sortRecord,
                                    cpg, className);
    sortRecord.addMethod(init);
    sortRecord.addMethod(extract);

    xsltc.dumpClass(sortRecord.getJavaClass());
    return className;
}
 
Example 10
Source File: Sort.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new auxillary class extending NodeSortRecord.
 */
private static String compileSortRecord(Vector sortObjects,
                                        ClassGenerator classGen,
                                        MethodGenerator methodGen) {
    final XSLTC  xsltc = ((Sort)sortObjects.firstElement()).getXSLTC();
    final String className = xsltc.getHelperClassName();

    // This generates a new class for handling this specific sort
    final NodeSortRecordGenerator sortRecord =
        new NodeSortRecordGenerator(className,
                                    NODE_SORT_RECORD,
                                    "sort$0.java",
                                    ACC_PUBLIC | ACC_SUPER | ACC_FINAL,
                                    new String[] {},
                                    classGen.getStylesheet());

    final ConstantPoolGen cpg = sortRecord.getConstantPool();

    // Add a new instance variable for each var in closure
    final int nsorts = sortObjects.size();
    final ArrayList dups = new ArrayList();

    for (int j = 0; j < nsorts; j++) {
        final Sort sort = (Sort) sortObjects.get(j);

        // Set the name of the inner class in this sort object
        sort.setInnerClassName(className);

        final int length = (sort._closureVars == null) ? 0 :
            sort._closureVars.size();
        for (int i = 0; i < length; i++) {
            final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i);

            // Discard duplicate variable references
            if (dups.contains(varRef)) continue;

            final VariableBase var = varRef.getVariable();
            sortRecord.addField(new Field(ACC_PUBLIC,
                                cpg.addUtf8(var.getEscapedName()),
                                cpg.addUtf8(var.getType().toSignature()),
                                null, cpg.getConstantPool()));
            dups.add(varRef);
        }
    }

    MethodGenerator init = compileInit(sortObjects, sortRecord,
                                     cpg, className);
    MethodGenerator extract = compileExtract(sortObjects, sortRecord,
                                    cpg, className);
    sortRecord.addMethod(init);
    sortRecord.addMethod(extract);

    xsltc.dumpClass(sortRecord.getJavaClass());
    return className;
}
 
Example 11
Source File: Sort.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new auxillary class extending NodeSortRecord.
 */
private static String compileSortRecord(Vector sortObjects,
                                        ClassGenerator classGen,
                                        MethodGenerator methodGen) {
    final XSLTC  xsltc = ((Sort)sortObjects.firstElement()).getXSLTC();
    final String className = xsltc.getHelperClassName();

    // This generates a new class for handling this specific sort
    final NodeSortRecordGenerator sortRecord =
        new NodeSortRecordGenerator(className,
                                    NODE_SORT_RECORD,
                                    "sort$0.java",
                                    ACC_PUBLIC | ACC_SUPER | ACC_FINAL,
                                    new String[] {},
                                    classGen.getStylesheet());

    final ConstantPoolGen cpg = sortRecord.getConstantPool();

    // Add a new instance variable for each var in closure
    final int nsorts = sortObjects.size();
    final ArrayList dups = new ArrayList();

    for (int j = 0; j < nsorts; j++) {
        final Sort sort = (Sort) sortObjects.get(j);

        // Set the name of the inner class in this sort object
        sort.setInnerClassName(className);

        final int length = (sort._closureVars == null) ? 0 :
            sort._closureVars.size();
        for (int i = 0; i < length; i++) {
            final VariableRefBase varRef = (VariableRefBase) sort._closureVars.get(i);

            // Discard duplicate variable references
            if (dups.contains(varRef)) continue;

            final VariableBase var = varRef.getVariable();
            sortRecord.addField(new Field(ACC_PUBLIC,
                                cpg.addUtf8(var.getEscapedName()),
                                cpg.addUtf8(var.getType().toSignature()),
                                null, cpg.getConstantPool()));
            dups.add(varRef);
        }
    }

    MethodGenerator init = compileInit(sortObjects, sortRecord,
                                     cpg, className);
    MethodGenerator extract = compileExtract(sortObjects, sortRecord,
                                    cpg, className);
    sortRecord.addMethod(init);
    sortRecord.addMethod(extract);

    xsltc.dumpClass(sortRecord.getJavaClass());
    return className;
}