Java Code Examples for com.sun.tools.javac.util.ListBuffer#appendList()

The following examples show how to use com.sun.tools.javac.util.ListBuffer#appendList() . 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: PackageGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void processTopLevel(Element tlTag) {
    String kind = tlTag.getTagName();

    if (kind.equals("annodecl")) {
        // decls stored separately, does not affect bases
        String declId = tlTag.getAttribute("id");
        if (!declId.startsWith("@"))
            declId = "@" + declId;
        idAnnos.put(declId, processAnnoDecl(tlTag));
        return;
    }

    ListBuffer<JCTree>[] bases = processBases(tlTag, null);

    for (JCTree base : bases[0]) { // [0] - bases namely
        JCPackageDecl pkg = make.PackageDecl(
                                List.<JCAnnotation>nil(),
                                make.QualIdent(
                                    new Symbol.PackageSymbol(
                                        names.fromString(packageName),
                                        null)));
        ListBuffer<JCTree> topLevelParts = new ListBuffer<>();
        topLevelParts.append(pkg);
        topLevelParts.appendList(bases[1]); // [1] imports
        topLevelParts.append(base);

        JCCompilationUnit topLevel = make.TopLevel(topLevelParts.toList());
        documentifier.documentify(topLevel, fx);
        topLevels.add(topLevel);
    }
}
 
Example 2
Source File: PackageGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
ListBuffer<JCTree> processMembers(Element memberTag, String name, String kind) {
    ListBuffer<JCTree> members = new ListBuffer<>();
    NodeList nodes = memberTag.getChildNodes();
    HashMap<String, Integer> scope = new HashMap<>();
    for (int i = 0; i < nodes.getLength(); i++) {
        Node node = nodes.item(i);

        if (!(node instanceof Element))
            continue;

        switch (((Element)node).getTagName()) {
            case "field":
                members.appendList(processFields((Element)node, scope));
                break;
            case "serialfield":
                members.append(processSerialFields((Element)node));
                break;
            case "constant":
                members.appendList(processConstants((Element)node, scope));
                break;
            case "constructor":
                members.appendList(processMethods((Element)node, scope, true, true));
                break;
            case "method":
                boolean needBody = kind.equals("class") || kind.equals("enum");
                members.appendList(processMethods((Element)node, scope, needBody, false));
                break;
            case "class":
            case "interface":
            case "enum":
            case "annotation":
                members.appendList(processBases((Element)node, scope)[0]);
                break;
        }
    }

    return members;
}
 
Example 3
Source File: JavacJavaUtilMapSingularizer.java    From EasyMPermission with MIT License 5 votes vote down vote up
@Override public void appendBuildCode(SingularData data, JavacNode builderType, JCTree source, ListBuffer<JCStatement> statements, Name targetVariableName) {
	if (useGuavaInstead(builderType)) {
		guavaMapSingularizer.appendBuildCode(data, builderType, source, statements, targetVariableName);
		return;
	}
	
	JavacTreeMaker maker = builderType.getTreeMaker();
	
	if (data.getTargetFqn().equals("java.util.Map")) {
		statements.appendList(createJavaUtilSetMapInitialCapacitySwitchStatements(maker, data, builderType, true, "emptyMap", "singletonMap", "LinkedHashMap", source));
	} else {
		statements.appendList(createJavaUtilSimpleCreationAndFillStatements(maker, data, builderType, true, true, false, true, "TreeMap", source));
	}
}
 
Example 4
Source File: JavacJavaUtilSetSingularizer.java    From EasyMPermission with MIT License 5 votes vote down vote up
@Override public void appendBuildCode(SingularData data, JavacNode builderType, JCTree source, ListBuffer<JCStatement> statements, Name targetVariableName) {
	if (useGuavaInstead(builderType)) {
		guavaListSetSingularizer.appendBuildCode(data, builderType, source, statements, targetVariableName);
		return;
	}
	
	JavacTreeMaker maker = builderType.getTreeMaker();
	
	if (data.getTargetFqn().equals("java.util.Set")) {
		statements.appendList(createJavaUtilSetMapInitialCapacitySwitchStatements(maker, data, builderType, false, "emptySet", "singleton", "LinkedHashSet", source));
	} else {
		statements.appendList(createJavaUtilSimpleCreationAndFillStatements(maker, data, builderType, false, true, false, true, "TreeSet", source));
	}
}
 
Example 5
Source File: PackageDocImpl.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add all included classes (including Exceptions and Errors)
 * and interfaces.
 */
public void addAllClassesTo(ListBuffer<ClassDocImpl> list) {
    list.appendList(getClasses(true));
}
 
Example 6
Source File: PackageDocImpl.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add all included classes (including Exceptions and Errors)
 * and interfaces.
 */
public void addAllClassesTo(ListBuffer<ClassDocImpl> list) {
    list.appendList(getClasses(true));
}
 
Example 7
Source File: PackageDocImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add all included classes (including Exceptions and Errors)
 * and interfaces.
 */
public void addAllClassesTo(ListBuffer<ClassDocImpl> list) {
    list.appendList(getClasses(true));
}
 
Example 8
Source File: PackageDocImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add all included classes (including Exceptions and Errors)
 * and interfaces.
 */
public void addAllClassesTo(ListBuffer<ClassDocImpl> list) {
    list.appendList(getClasses(true));
}
 
Example 9
Source File: PackageDocImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add all included classes (including Exceptions and Errors)
 * and interfaces.
 */
public void addAllClassesTo(ListBuffer<ClassDocImpl> list) {
    list.appendList(getClasses(true));
}
 
Example 10
Source File: PackageDocImpl.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add all included classes (including Exceptions and Errors)
 * and interfaces.
 */
public void addAllClassesTo(ListBuffer<ClassDocImpl> list) {
    list.appendList(getClasses(true));
}
 
Example 11
Source File: PackageDocImpl.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add all included classes (including Exceptions and Errors)
 * and interfaces.
 */
public void addAllClassesTo(ListBuffer<ClassDocImpl> list) {
    list.appendList(getClasses(true));
}
 
Example 12
Source File: PackageDocImpl.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add all included classes (including Exceptions and Errors)
 * and interfaces.
 */
public void addAllClassesTo(ListBuffer<ClassDocImpl> list) {
    list.appendList(getClasses(true));
}