Debian Codegraph @

org.eclipse.jdt.core.tests.model/workspace/Converter/src/examples.oneofeach/ASTPosterChild.java

raw
1 /*******************************************************************************
2 * Copyright (c) 2002 IBM Corp. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial implementation
10 ******************************************************************************/
11 /*
12 * Syntactically correct Java program containing at least an instance of
13 * each different kind of construct in the Java language (1.4).
14 */
15 // PackageDeclaration
16 package examples.oneofeach;
17
18 // ImportDeclaration (single-type)
19 import java.io.Serializable;
20 // ImportDeclaration (on-demand)
21 import java.util.*;
22
23 /**
24 * TypeDeclaration (class)
25 */
26 public final class ASTPosterChild extends java.lang.Object
27 implements Serializable, ASTPosterInterface {
28
29 /**
30 * FieldDeclaration
31 */
32 public transient boolean[] f1 = {true, false};
33
34 // Initializer
35 {
36 f1 = null;
37 }
38
39 /**
40 * MethodDeclaration (constructor)
41 */
42 ASTPosterChild() {
43 // ConstructorInvocation
44 this(true);
45 }
46
47 /**
48 * MethodDeclaration (constructor)
49 */
50 ASTPosterChild(boolean flag) {
51 // SuperConstructorInvocation
52 super();
53 }
54
55 /**
56 * MethodDeclaration (method)
57 */
58 public void op() {
59
60 // PrimitiveType, NumberLiteral
61 byte a = 0;
62 // BooleanLiteral
63 boolean b = true;
64 // CharacterLiteral
65 char c = 'x';
66 short s = 1;
67 long l = 1L;
68 float f = 1.0f;
69 double d = 1e6;
70 // SimpleType, StringLiteral
71 String z = "hello";//$NON-NLS-1$
72 // NullLiteral
73 Vector o1 = null;
74 // ArrayType, ArrayInitializer
75 int[] t1 = {1};
76 int[][] t2 = {{1,2}, {3,4}};
77 int[][][] t3 = null;
78 // ClassInstanceCreation
79 java.lang.Object o = new Object();
80 // ArrayCreation (initializer)
81 Object[] o2 = new Object[]{"0", "1"};//$NON-NLS-1$//$NON-NLS-2$
82 // ArrayCreation (dimensions)
83 Object[][] o3 = new Object[3][];
84 // Assigment
85 o3 = null;
86 // ArrayAccess
87 Object x1 = o3[0];
88 // CastExpression
89 Object x2 = (Object) o3;
90 // ConditionalExpression
91 int x3 = b ? 1 : 2;
92 // FieldAccess
93 Object x4 = System.out;
94 // InfixExpression
95 String x5 = "a" + "b";//$NON-NLS-1$//$NON-NLS-2$
96 // InfixExpression (extended operands)
97 String x6 = "a" + "b" + "c" + "d";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
98 // MethodInvocation
99 notifyAll();
100 // ParenthesizedExpression
101 Object x7 = ((o));
102 // PostfixExpression
103 l++;
104 // PrefixExpression
105 --l;
106 // ThisExpression
107 Object x8 = ASTPosterChild.this;
108 // TypeLiteral
109 Object x9 = void.class;
110
111 // AssertStatement
112 // assert true: "unhappy";//$NON-NLS-1$
113 // Block
114 {}
115 // DoStatement
116 do {
117 } while (false);
118 // VariableDeclarationStatement
119 int i;
120 // ExpressionStatement
121 i = 1;
122 // LabeledStatement
123 looping:
124 // ForStatement, VariableDeclarationExpression
125 for (int j=0; j<10; j++) {
126 // ContinueStatement
127 continue looping;
128 }
129 // IfStatement
130 if (false)
131 System.exit(0);
132 else
133 i++;
134 // SwitchStatement
135 switch (2) {
136 // SwitchCase
137 case 2:
138 // BreakStatement
139 break;
140 default:
141 // EmptyStatement
142 ;
143 }
144 // SynchronizedStatement
145 synchronized (this) {
146 }
147 // TryStatement
148 try {
149 // ThrowStatement
150 throw new RuntimeException();
151 } catch (Exception e) // CatchClause
152 {
153 } finally {
154 }
155
156 // TypeDeclarationStatement
157 abstract class X {
158 int f;
159 void m() {
160 }
161 }
162 // ClassInstanceCreation (with body declarations)
163 Object anon = new X() {
164 void m() {
165 // SuperMethodInvocation
166 super.m();
167 // SuperFieldAccess
168 super.f = 1;
169 }
170 };
171 // WhileStatement
172 boolean b1 = true;
173 while (b1);
174 // ReturnStatement;
175 return;
176 }
177
178 }
179
180 /**
181 * TypeDeclaration (interface)
182 */
183 interface ASTPosterInterface {
184
185 String FOO = "hi";//$NON-NLS-1$
186 void op();
187
188 }