Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/make/src/classes/build/tools/jdwpgen/AbstractGroupNode.java
32287 views
/*1* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package build.tools.jdwpgen;2627import java.io.*;2829abstract class AbstractGroupNode extends AbstractTypeListNode {3031void document(PrintWriter writer) {32for (Node node : components) {33node.document(writer);34}35}3637String javaType() {38return name();39}4041void genJava(PrintWriter writer, int depth) {42genJavaClass(writer, depth);43}4445void genJavaWriteMethod(PrintWriter writer, int depth) {46genJavaWriteMethod(writer, depth, "private ");47}4849void genJavaWriteMethod(PrintWriter writer, int depth, String modifier) {50writer.println();51indent(writer, depth);52writer.print(modifier);53writer.println("void write(PacketStream ps) {");54genJavaWrites(writer, depth+1);55indent(writer, depth);56writer.println("}");57}5859void genJavaClassSpecifics(PrintWriter writer, int depth) {60switch (context.state) {61case Context.readingReply:62genJavaReadingClassBody(writer, depth, name());63break;6465case Context.writingCommand:66genJavaWritingClassBody(writer, depth, name());67genJavaWriteMethod(writer, depth);68break;6970default:71error("Group in outer");72break;73}74}7576public void genJavaDeclaration(PrintWriter writer, int depth) {77writer.println();78genJavaComment(writer, depth);79indent(writer, depth);80writer.print("final ");81writer.print(name());82writer.print(" a" + name());83writer.println(";");84}8586public String javaParam() {87return name() + " a" + name();88}8990public void genJavaWrite(PrintWriter writer, int depth,91String writeLabel) {92genJavaDebugWrite(writer, depth, writeLabel, "\"\"");93indent(writer, depth);94writer.println(writeLabel + ".write(ps);");95}9697String javaRead() {98error("Internal - Should not call AbstractGroupNode.javaRead()");99return "";100}101102public void genJavaRead(PrintWriter writer, int depth,103String readLabel) {104genJavaDebugRead(writer, depth, readLabel, "\"\"");105indent(writer, depth);106writer.print(readLabel);107writer.print(" = new ");108writer.print(name());109writer.println("(vm, ps);");110}111}112113114