Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/make/src/classes/build/tools/jdwpgen/AbstractGroupNode.java
32287 views
1
/*
2
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package build.tools.jdwpgen;
27
28
import java.io.*;
29
30
abstract class AbstractGroupNode extends AbstractTypeListNode {
31
32
void document(PrintWriter writer) {
33
for (Node node : components) {
34
node.document(writer);
35
}
36
}
37
38
String javaType() {
39
return name();
40
}
41
42
void genJava(PrintWriter writer, int depth) {
43
genJavaClass(writer, depth);
44
}
45
46
void genJavaWriteMethod(PrintWriter writer, int depth) {
47
genJavaWriteMethod(writer, depth, "private ");
48
}
49
50
void genJavaWriteMethod(PrintWriter writer, int depth, String modifier) {
51
writer.println();
52
indent(writer, depth);
53
writer.print(modifier);
54
writer.println("void write(PacketStream ps) {");
55
genJavaWrites(writer, depth+1);
56
indent(writer, depth);
57
writer.println("}");
58
}
59
60
void genJavaClassSpecifics(PrintWriter writer, int depth) {
61
switch (context.state) {
62
case Context.readingReply:
63
genJavaReadingClassBody(writer, depth, name());
64
break;
65
66
case Context.writingCommand:
67
genJavaWritingClassBody(writer, depth, name());
68
genJavaWriteMethod(writer, depth);
69
break;
70
71
default:
72
error("Group in outer");
73
break;
74
}
75
}
76
77
public void genJavaDeclaration(PrintWriter writer, int depth) {
78
writer.println();
79
genJavaComment(writer, depth);
80
indent(writer, depth);
81
writer.print("final ");
82
writer.print(name());
83
writer.print(" a" + name());
84
writer.println(";");
85
}
86
87
public String javaParam() {
88
return name() + " a" + name();
89
}
90
91
public void genJavaWrite(PrintWriter writer, int depth,
92
String writeLabel) {
93
genJavaDebugWrite(writer, depth, writeLabel, "\"\"");
94
indent(writer, depth);
95
writer.println(writeLabel + ".write(ps);");
96
}
97
98
String javaRead() {
99
error("Internal - Should not call AbstractGroupNode.javaRead()");
100
return "";
101
}
102
103
public void genJavaRead(PrintWriter writer, int depth,
104
String readLabel) {
105
genJavaDebugRead(writer, depth, readLabel, "\"\"");
106
indent(writer, depth);
107
writer.print(readLabel);
108
writer.print(" = new ");
109
writer.print(name());
110
writer.println("(vm, ps);");
111
}
112
}
113
114