TestFilerConstraints.java revision 698
698N/A * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 553N/A * or visit www.oracle.com if you need additional information or have any 0N/A * @bug 6380018 6453386 6457283 0N/A * @summary Test that the constraints guaranteed by the Filer and maintained 0N/A * @author Joseph D. Darcy 0N/A * @build TestFilerConstraints 0N/A * A processor that verifies the explicit and implicit constraints in 0N/A * the Filer contract are maintained: 0N/A * During each run of an annotation processing tool, a file with a 0N/A * given pathname may be created only once. If that file already 0N/A * exists before the first attempt to create it, the old contents 0N/A * will be deleted. Any subsequent attempt to create the same file 0N/A * during a run will throw a FilerException, as will attempting to 0N/A * open both a class file and source file for the same type name. 0N/A * Specific checks will include: 0N/A * <li> Source and class files can be written to from either a Writer or an OutputStream. 0N/A * <li> Calling close multiple times does not re-register the file for 0N/A // Open two source files 0N/A // Hold open across rounds 0N/A // Close Src1 a second time 0N/A // Close Src2 a second time 0N/A // Close a second time 0N/A // int value = (0xff00 & (classFile2Bytes[i]<<8)) | classFile2Bytes[i+1]; 0N/A // System.out.print(Integer.toHexString(value)); 0N/A // System.out.println(); 0N/A // Close a second time 0N/A * Test that the single expected expected type, name, is the root 0N/A // Try to open a resource over a source file 0N/A // Try to open a resource over a class file 0N/A {
202,
254,
186,
190,
0,
0,
0,
50,
0N/A 0,
13,
10,
0,
3,
0,
10,
7,
0N/A 0,
11,
7,
0,
12,
1,
0,
6,
0N/A 60,
105,
110,
105,
116,
62,
1,
0,
0N/A 3,
40,
41,
86,
1,
0,
4,
67,
0N/A 111,
100,
101,
1,
0,
15,
76,
105,
0N/A 110,
101,
78,
117,
109,
98,
101,
114,
0N/A 84,
97,
98,
108,
101,
1,
0,
10,
0N/A 83,
111,
117,
114,
99,
101,
70,
105,
0N/A 108,
101,
1,
0,
15,
67,
108,
97,
0N/A 115,
115,
70,
105,
108,
101,
49,
46,
0N/A 106,
97,
118,
97,
12,
0,
4,
0,
0N/A 5,
1,
0,
10,
67,
108,
97,
115,
0N/A 115,
70,
105,
108,
101,
49,
1,
0,
0N/A 16,
106,
97,
118,
97,
47,
108,
97,
0N/A 110,
103,
47,
79,
98,
106,
101,
99,
0N/A 116,
0,
33,
0,
2,
0,
3,
0,
0N/A 0,
0,
0,
0,
1,
0,
1,
0,
0N/A 4,
0,
5,
0,
1,
0,
6,
0,
0N/A 0,
0,
29,
0,
1,
0,
1,
0,
0N/A 0,
0,
5,
42,
183,
0,
1,
177,
0N/A 0,
0,
0,
1,
0,
7,
0,
0,
0N/A 0,
6,
0,
1,
0,
0,
0,
1,
0N/A 0,
1,
0,
8,
0,
0,
0,
2,
0N/A {
202,
254,
186,
190,
0,
0,
0,
50,
0N/A 0,
13,
10,
0,
3,
0,
10,
7,
0N/A 0,
11,
7,
0,
12,
1,
0,
6,
0N/A 60,
105,
110,
105,
116,
62,
1,
0,
0N/A 3,
40,
41,
86,
1,
0,
4,
67,
0N/A 111,
100,
101,
1,
0,
15,
76,
105,
0N/A 110,
101,
78,
117,
109,
98,
101,
114,
0N/A 84,
97,
98,
108,
101,
1,
0,
10,
0N/A 83,
111,
117,
114,
99,
101,
70,
105,
0N/A 108,
101,
1,
0,
15,
67,
108,
97,
0N/A 115,
115,
70,
105,
108,
101,
50,
46,
0N/A 106,
97,
118,
97,
12,
0,
4,
0,
0N/A 5,
1,
0,
10,
67,
108,
97,
115,
0N/A 115,
70,
105,
108,
101,
50,
1,
0,
0N/A 16,
106,
97,
118,
97,
47,
108,
97,
0N/A 110,
103,
47,
79,
98,
106,
101,
99,
0N/A 116,
0,
33,
0,
2,
0,
3,
0,
0N/A 0,
0,
0,
0,
1,
0,
1,
0,
0N/A 4,
0,
5,
0,
1,
0,
6,
0,
0N/A 0,
0,
29,
0,
1,
0,
1,
0,
0N/A 0,
0,
5,
42,
183,
0,
1,
177,
0N/A 0,
0,
0,
1,
0,
7,
0,
0,
0N/A 0,
6,
0,
1,
0,
0,
0,
1,
0N/A 0,
1,
0,
8,
0,
0,
0,
2,