author | duke |
Wed, 05 Jul 2017 18:59:39 +0200 | |
changeset 18044 | f1a01fb5f958 |
parent 15380 | ac6c46b447d1 |
child 19500 | 26d88d483764 |
permissions | -rw-r--r-- |
15368
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
1 |
/* |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
4 |
* |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
8 |
* |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
13 |
* accompanied this code). |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
14 |
* |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
18 |
* |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
21 |
* questions. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
22 |
*/ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
23 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
24 |
import java.util.*; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
25 |
import java.io.*; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
26 |
import java.net.*; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
27 |
import java.nio.file.*; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
28 |
import java.nio.file.attribute.*; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
29 |
import java.nio.charset.*; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
30 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
31 |
import com.sun.tools.sjavac.Main; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
32 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
33 |
public |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
34 |
class SJavac { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
35 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
36 |
public static void main(String... args) throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
37 |
SJavac s = new SJavac(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
38 |
s.test(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
39 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
40 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
41 |
FileSystem defaultfs = FileSystems.getDefault(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
42 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
43 |
// Where to put generated sources that will |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
44 |
// test aspects of sjavac, ie JTWork/scratch/gensrc |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
45 |
Path gensrc; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
46 |
// More gensrc dirs are used to test merging of serveral source roots. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
47 |
Path gensrc2; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
48 |
Path gensrc3; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
49 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
50 |
// Where to put compiled classes. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
51 |
Path bin; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
52 |
// Where to put c-header files. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
53 |
Path headers; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
54 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
55 |
// The sjavac compiler. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
56 |
Main main = new Main(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
57 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
58 |
// Remember the previous bin and headers state here. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
59 |
Map<String,Long> previous_bin_state; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
60 |
Map<String,Long> previous_headers_state; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
61 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
62 |
public void test() throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
63 |
gensrc = defaultfs.getPath("gensrc"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
64 |
gensrc2 = defaultfs.getPath("gensrc2"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
65 |
gensrc3 = defaultfs.getPath("gensrc3"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
66 |
bin = defaultfs.getPath("bin"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
67 |
headers = defaultfs.getPath("headers"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
68 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
69 |
Files.createDirectory(gensrc); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
70 |
Files.createDirectory(gensrc2); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
71 |
Files.createDirectory(gensrc3); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
72 |
Files.createDirectory(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
73 |
Files.createDirectory(headers); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
74 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
75 |
initialCompile(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
76 |
incrementalCompileNoChanges(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
77 |
incrementalCompileDroppingClasses(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
78 |
incrementalCompileWithChange(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
79 |
incrementalCompileDropAllNatives(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
80 |
incrementalCompileAddNative(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
81 |
incrementalCompileChangeNative(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
82 |
compileWithOverrideSource(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
83 |
compileWithInvisibleSources(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
84 |
compileCircularSources(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
85 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
86 |
delete(gensrc); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
87 |
delete(gensrc2); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
88 |
delete(gensrc3); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
89 |
delete(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
90 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
91 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
92 |
void initialCompile() throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
93 |
System.out.println("\nInitial compile of gensrc."); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
94 |
System.out.println("----------------------------"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
95 |
populate(gensrc, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
96 |
"alfa/AINT.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
97 |
"package alfa; public interface AINT { void aint(); }", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
98 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
99 |
"alfa/A.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
100 |
"package alfa; public class A implements AINT { "+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
101 |
"public final static int DEFINITION = 17; public void aint() { } }", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
102 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
103 |
"alfa/AA.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
104 |
"package alfa;"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
105 |
"// A package private class, not contributing to the public api.\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
106 |
"class AA {"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
107 |
" // A properly nested static inner class.\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
108 |
" static class AAA { }\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
109 |
" // A properly nested inner class.\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
110 |
" class AAAA { }\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
111 |
" Runnable foo() {\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
112 |
" // A proper anonymous class.\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
113 |
" return new Runnable() { public void run() { } };\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
114 |
" }\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
115 |
" AAA aaa;\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
116 |
" AAAA aaaa;\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
117 |
" AAAAA aaaaa;\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
118 |
"}\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
119 |
"class AAAAA {\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
120 |
" // A bad auxiliary class, but no one is referencing it\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
121 |
" // from outside of this source file, therefore it is ok.\n"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
122 |
"}\n", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
123 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
124 |
"beta/BINT.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
125 |
"package beta;public interface BINT { void foo(); }", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
126 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
127 |
"beta/B.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
128 |
"package beta; import alfa.A; public class B {"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
129 |
"private int b() { return A.DEFINITION; } native void foo(); }"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
130 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
131 |
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
132 |
"--server:portfile=testserver,background=false", "--log=debug"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
133 |
previous_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
134 |
previous_headers_state = collectState(headers); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
135 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
136 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
137 |
void incrementalCompileNoChanges() throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
138 |
System.out.println("\nTesting that no change in sources implies no change in binaries."); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
139 |
System.out.println("------------------------------------------------------------------"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
140 |
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
141 |
"--server:portfile=testserver,background=false", "--log=debug"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
142 |
Map<String,Long> new_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
143 |
verifyEqual(new_bin_state, previous_bin_state); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
144 |
Map<String,Long> new_headers_state = collectState(headers); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
145 |
verifyEqual(previous_headers_state, new_headers_state); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
146 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
147 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
148 |
void incrementalCompileDroppingClasses() throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
149 |
System.out.println("\nTesting that deleting AA.java deletes all"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
150 |
System.out.println("generated inner class as well as AA.class"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
151 |
System.out.println("-----------------------------------------"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
152 |
removeFrom(gensrc, "alfa/AA.java"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
153 |
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
154 |
"--server:portfile=testserver,background=false", "--log=debug"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
155 |
Map<String,Long> new_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
156 |
verifyThatFilesHaveBeenRemoved(previous_bin_state, new_bin_state, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
157 |
"bin/alfa/AA$1.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
158 |
"bin/alfa/AA$AAAA.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
159 |
"bin/alfa/AA$AAA.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
160 |
"bin/alfa/AAAAA.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
161 |
"bin/alfa/AA.class"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
162 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
163 |
previous_bin_state = new_bin_state; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
164 |
Map<String,Long> new_headers_state = collectState(headers); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
165 |
verifyEqual(previous_headers_state, new_headers_state); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
166 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
167 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
168 |
void incrementalCompileWithChange() throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
169 |
System.out.println("\nNow update the A.java file with a new timestamps and"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
170 |
System.out.println("new final static definition. This should trigger a recompile,"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
171 |
System.out.println("not only of alfa, but also beta."); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
172 |
System.out.println("But check that the generated native header was not updated!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
173 |
System.out.println("Since we did not modify the native api of B."); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
174 |
System.out.println("-------------------------------------------------------------"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
175 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
176 |
populate(gensrc,"alfa/A.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
177 |
"package alfa; public class A implements AINT { "+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
178 |
"public final static int DEFINITION = 18; public void aint() { } private void foo() { } }"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
179 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
180 |
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
181 |
"--server:portfile=testserver,background=false", "--log=debug"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
182 |
Map<String,Long> new_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
183 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
184 |
verifyNewerFiles(previous_bin_state, new_bin_state, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
185 |
"bin/alfa/A.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
186 |
"bin/alfa/AINT.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
187 |
"bin/beta/B.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
188 |
"bin/beta/BINT.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
189 |
"bin/javac_state"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
190 |
previous_bin_state = new_bin_state; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
191 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
192 |
Map<String,Long> new_headers_state = collectState(headers); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
193 |
verifyEqual(new_headers_state, previous_headers_state); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
194 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
195 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
196 |
void incrementalCompileDropAllNatives() throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
197 |
System.out.println("\nNow update the B.java file with one less native method,"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
198 |
System.out.println("ie it has no longer any methods!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
199 |
System.out.println("Verify that beta_B.h is removed!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
200 |
System.out.println("---------------------------------------------------------"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
201 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
202 |
populate(gensrc,"beta/B.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
203 |
"package beta; import alfa.A; public class B {"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
204 |
"private int b() { return A.DEFINITION; } }"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
205 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
206 |
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
207 |
"--server:portfile=testserver,background=false", "--log=debug"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
208 |
Map<String,Long> new_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
209 |
verifyNewerFiles(previous_bin_state, new_bin_state, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
210 |
"bin/beta/B.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
211 |
"bin/beta/BINT.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
212 |
"bin/javac_state"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
213 |
previous_bin_state = new_bin_state; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
214 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
215 |
Map<String,Long> new_headers_state = collectState(headers); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
216 |
verifyThatFilesHaveBeenRemoved(previous_headers_state, new_headers_state, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
217 |
"headers/beta_B.h"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
218 |
previous_headers_state = new_headers_state; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
219 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
220 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
221 |
void incrementalCompileAddNative() throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
222 |
System.out.println("\nNow update the B.java file with a final static annotated with @Native."); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
223 |
System.out.println("Verify that beta_B.h is added again!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
224 |
System.out.println("------------------------------------------------------------------------"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
225 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
226 |
populate(gensrc,"beta/B.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
227 |
"package beta; import alfa.A; public class B {"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
228 |
"private int b() { return A.DEFINITION; } "+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
229 |
"@java.lang.annotation.Native final static int alfa = 42; }"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
230 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
231 |
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
232 |
"--server:portfile=testserver,background=false", "--log=debug"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
233 |
Map<String,Long> new_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
234 |
verifyNewerFiles(previous_bin_state, new_bin_state, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
235 |
"bin/beta/B.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
236 |
"bin/beta/BINT.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
237 |
"bin/javac_state"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
238 |
previous_bin_state = new_bin_state; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
239 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
240 |
Map<String,Long> new_headers_state = collectState(headers); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
241 |
verifyThatFilesHaveBeenAdded(previous_headers_state, new_headers_state, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
242 |
"headers/beta_B.h"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
243 |
previous_headers_state = new_headers_state; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
244 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
245 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
246 |
void incrementalCompileChangeNative() throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
247 |
System.out.println("\nNow update the B.java file with a new value for the final static"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
248 |
" annotated with @Native."); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
249 |
System.out.println("Verify that beta_B.h is rewritten again!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
250 |
System.out.println("-------------------------------------------------------------------"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
251 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
252 |
populate(gensrc,"beta/B.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
253 |
"package beta; import alfa.A; public class B {"+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
254 |
"private int b() { return A.DEFINITION; } "+ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
255 |
"@java.lang.annotation.Native final static int alfa = 43; }"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
256 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
257 |
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
258 |
"--server:portfile=testserver,background=false", "--log=debug"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
259 |
Map<String,Long> new_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
260 |
verifyNewerFiles(previous_bin_state, new_bin_state, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
261 |
"bin/beta/B.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
262 |
"bin/beta/BINT.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
263 |
"bin/javac_state"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
264 |
previous_bin_state = new_bin_state; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
265 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
266 |
Map<String,Long> new_headers_state = collectState(headers); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
267 |
verifyNewerFiles(previous_headers_state, new_headers_state, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
268 |
"headers/beta_B.h"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
269 |
previous_headers_state = new_headers_state; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
270 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
271 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
272 |
void compileWithOverrideSource() throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
273 |
System.out.println("\nNow verify that we can override sources to be compiled."); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
274 |
System.out.println("Compile gensrc and gensrc2. However do not compile broken beta.B in gensrc,"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
275 |
System.out.println("only compile ok beta.B in gensrc2."); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
276 |
System.out.println("---------------------------------------------------------------------------"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
277 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
278 |
delete(gensrc); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
279 |
delete(gensrc2); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
280 |
delete(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
281 |
previous_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
282 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
283 |
populate(gensrc,"alfa/A.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
284 |
"package alfa; import beta.B; import gamma.C; public class A { B b; C c; }", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
285 |
"beta/B.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
286 |
"package beta; public class B { broken", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
287 |
"gamma/C.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
288 |
"package gamma; public class C { }"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
289 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
290 |
populate(gensrc2, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
291 |
"beta/B.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
292 |
"package beta; public class B { }"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
293 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
294 |
compile("-x", "beta", "gensrc", "gensrc2", "-d", "bin", "-h", "headers", "-j", "1", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
295 |
"--server:portfile=testserver,background=false"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
296 |
Map<String,Long> new_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
297 |
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
298 |
"bin/alfa/A.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
299 |
"bin/beta/B.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
300 |
"bin/gamma/C.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
301 |
"bin/javac_state"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
302 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
303 |
System.out.println("----- Compile with exluded beta went well!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
304 |
delete(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
305 |
compileExpectFailure("gensrc", "gensrc2", "-d", "bin", "-h", "headers", "-j", "1", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
306 |
"--server:portfile=testserver,background=false"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
307 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
308 |
System.out.println("----- Compile without exluded beta failed, as expected! Good!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
309 |
delete(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
310 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
311 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
312 |
void compileWithInvisibleSources() throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
313 |
System.out.println("\nNow verify that we can make sources invisible to linking (sourcepath)."); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
314 |
System.out.println("Compile gensrc and link against gensrc2 and gensrc3, however"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
315 |
System.out.println("gensrc2 contains broken code in beta.B, thus we must exclude that package"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
316 |
System.out.println("fortunately gensrc3 contains a proper beta.B."); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
317 |
System.out.println("------------------------------------------------------------------------"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
318 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
319 |
// Start with a fresh gensrcs and bin. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
320 |
delete(gensrc); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
321 |
delete(gensrc2); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
322 |
delete(gensrc3); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
323 |
delete(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
324 |
previous_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
325 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
326 |
populate(gensrc,"alfa/A.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
327 |
"package alfa; import beta.B; import gamma.C; public class A { B b; C c; }"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
328 |
populate(gensrc2,"beta/B.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
329 |
"package beta; public class B { broken", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
330 |
"gamma/C.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
331 |
"package gamma; public class C { }"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
332 |
populate(gensrc3, "beta/B.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
333 |
"package beta; public class B { }"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
334 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
335 |
compile("gensrc", "-x", "beta", "-sourcepath", "gensrc2", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
336 |
"-sourcepath", "gensrc3", "-d", "bin", "-h", "headers", "-j", "1", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
337 |
"--server:portfile=testserver,background=false"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
338 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
339 |
System.out.println("The first compile went well!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
340 |
Map<String,Long> new_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
341 |
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
342 |
"bin/alfa/A.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
343 |
"bin/javac_state"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
344 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
345 |
System.out.println("----- Compile with exluded beta went well!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
346 |
delete(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
347 |
compileExpectFailure("gensrc", "-sourcepath", "gensrc2", "-sourcepath", "gensrc3", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
348 |
"-d", "bin", "-h", "headers", "-j", "1", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
349 |
"--server:portfile=testserver,background=false"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
350 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
351 |
System.out.println("----- Compile without exluded beta failed, as expected! Good!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
352 |
delete(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
353 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
354 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
355 |
void compileCircularSources() throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
356 |
System.out.println("\nNow verify that circular sources split on multiple cores can be compiled."); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
357 |
System.out.println("---------------------------------------------------------------------------"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
358 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
359 |
// Start with a fresh gensrcs and bin. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
360 |
delete(gensrc); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
361 |
delete(gensrc2); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
362 |
delete(gensrc3); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
363 |
delete(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
364 |
previous_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
365 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
366 |
populate(gensrc,"alfa/A.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
367 |
"package alfa; public class A { beta.B b; }", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
368 |
"beta/B.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
369 |
"package beta; public class B { gamma.C c; }", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
370 |
"gamma/C.java", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
371 |
"package gamma; public class C { alfa.A a; }"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
372 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
373 |
compile("gensrc", "-d", "bin", "-h", "headers", "-j", "3", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
374 |
"--server:portfile=testserver,background=false","--log=debug"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
375 |
Map<String,Long> new_bin_state = collectState(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
376 |
verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
377 |
"bin/alfa/A.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
378 |
"bin/beta/B.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
379 |
"bin/gamma/C.class", |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
380 |
"bin/javac_state"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
381 |
delete(bin); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
382 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
383 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
384 |
void removeFrom(Path dir, String... args) throws IOException { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
385 |
for (String filename : args) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
386 |
Path p = dir.resolve(filename); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
387 |
Files.delete(p); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
388 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
389 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
390 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
391 |
void populate(Path src, String... args) throws IOException { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
392 |
if (!Files.exists(src)) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
393 |
Files.createDirectory(src); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
394 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
395 |
String[] a = args; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
396 |
for (int i = 0; i<a.length; i+=2) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
397 |
String filename = a[i]; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
398 |
String content = a[i+1]; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
399 |
Path p = src.resolve(filename); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
400 |
Files.createDirectories(p.getParent()); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
401 |
PrintWriter out = new PrintWriter(Files.newBufferedWriter(p, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
402 |
Charset.defaultCharset())); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
403 |
out.println(content); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
404 |
out.close(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
405 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
406 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
407 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
408 |
void delete(Path root) throws IOException { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
409 |
if (!Files.exists(root)) return; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
410 |
Files.walkFileTree(root, new SimpleFileVisitor<Path>() { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
411 |
@Override |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
412 |
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
413 |
{ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
414 |
Files.delete(file); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
415 |
return FileVisitResult.CONTINUE; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
416 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
417 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
418 |
@Override |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
419 |
public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
420 |
{ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
421 |
if (e == null) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
422 |
if (!dir.equals(root)) Files.delete(dir); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
423 |
return FileVisitResult.CONTINUE; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
424 |
} else { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
425 |
// directory iteration failed |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
426 |
throw e; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
427 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
428 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
429 |
}); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
430 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
431 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
432 |
void compile(String... args) throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
433 |
int rc = main.go(args, System.out, System.err); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
434 |
if (rc != 0) throw new Exception("Error during compile!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
435 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
436 |
// Wait a second, to get around the (temporary) problem with |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
437 |
// second resolution in the Java file api. But do not do this |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
438 |
// on windows where the timestamps work. |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
439 |
long in_a_sec = System.currentTimeMillis()+1000; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
440 |
while (in_a_sec > System.currentTimeMillis()) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
441 |
try { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
442 |
Thread.sleep(1000); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
443 |
} catch (InterruptedException e) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
444 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
445 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
446 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
447 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
448 |
void compileExpectFailure(String... args) throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
449 |
int rc = main.go(args, System.out, System.err); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
450 |
if (rc == 0) throw new Exception("Expected error during compile! Did not fail!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
451 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
452 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
453 |
Map<String,Long> collectState(Path dir) throws IOException |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
454 |
{ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
455 |
final Map<String,Long> files = new HashMap<>(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
456 |
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
457 |
@Override |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
458 |
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
459 |
throws IOException |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
460 |
{ |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
461 |
files.put(file.toString(),new Long(Files.getLastModifiedTime(file).toMillis())); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
462 |
return FileVisitResult.CONTINUE; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
463 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
464 |
}); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
465 |
return files; |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
466 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
467 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
468 |
void verifyThatFilesHaveBeenRemoved(Map<String,Long> from, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
469 |
Map<String,Long> to, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
470 |
String... args) throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
471 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
472 |
Set<String> froms = from.keySet(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
473 |
Set<String> tos = to.keySet(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
474 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
475 |
if (froms.equals(tos)) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
476 |
throw new Exception("Expected new state to have fewer files than previous state!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
477 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
478 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
479 |
for (String t : tos) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
480 |
if (!froms.contains(t)) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
481 |
throw new Exception("Expected "+t+" to exist in previous state!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
482 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
483 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
484 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
485 |
for (String f : args) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
486 |
f = f.replace("/", File.separator); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
487 |
if (!froms.contains(f)) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
488 |
throw new Exception("Expected "+f+" to exist in previous state!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
489 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
490 |
if (tos.contains(f)) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
491 |
throw new Exception("Expected "+f+" to have been removed from the new state!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
492 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
493 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
494 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
495 |
if (froms.size() - args.length != tos.size()) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
496 |
throw new Exception("There are more removed files than the expected list!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
497 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
498 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
499 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
500 |
void verifyThatFilesHaveBeenAdded(Map<String,Long> from, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
501 |
Map<String,Long> to, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
502 |
String... args) throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
503 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
504 |
Set<String> froms = from.keySet(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
505 |
Set<String> tos = to.keySet(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
506 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
507 |
if (froms.equals(tos)) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
508 |
throw new Exception("Expected new state to have more files than previous state!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
509 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
510 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
511 |
for (String t : froms) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
512 |
if (!tos.contains(t)) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
513 |
throw new Exception("Expected "+t+" to exist in new state!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
514 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
515 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
516 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
517 |
for (String f : args) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
518 |
f = f.replace("/", File.separator); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
519 |
if (!tos.contains(f)) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
520 |
throw new Exception("Expected "+f+" to have been added to new state!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
521 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
522 |
if (froms.contains(f)) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
523 |
throw new Exception("Expected "+f+" to not exist in previous state!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
524 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
525 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
526 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
527 |
if (froms.size() + args.length != tos.size()) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
528 |
throw new Exception("There are more added files than the expected list!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
529 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
530 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
531 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
532 |
void verifyNewerFiles(Map<String,Long> from, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
533 |
Map<String,Long> to, |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
534 |
String... args) throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
535 |
if (!from.keySet().equals(to.keySet())) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
536 |
throw new Exception("Expected the set of files to be identical!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
537 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
538 |
Set<String> files = new HashSet<String>(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
539 |
for (String s : args) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
540 |
files.add(s.replace("/", File.separator)); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
541 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
542 |
for (String fn : from.keySet()) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
543 |
long f = from.get(fn); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
544 |
long t = to.get(fn); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
545 |
if (files.contains(fn)) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
546 |
if (t <= f) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
547 |
throw new Exception("Expected "+fn+" to have a more recent timestamp!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
548 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
549 |
} else { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
550 |
if (t != f) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
551 |
throw new Exception("Expected "+fn+" to have the same timestamp!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
552 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
553 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
554 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
555 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
556 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
557 |
String print(Map<String,Long> m) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
558 |
StringBuilder b = new StringBuilder(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
559 |
Set<String> keys = m.keySet(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
560 |
for (String k : keys) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
561 |
b.append(k+" "+m.get(k)+"\n"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
562 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
563 |
return b.toString(); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
564 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
565 |
|
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
566 |
void verifyEqual(Map<String,Long> from, Map<String,Long> to) throws Exception { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
567 |
if (!from.equals(to)) { |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
568 |
System.out.println("FROM---"+print(from)); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
569 |
System.out.println("TO-----"+print(to)); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
570 |
throw new Exception("The dir should not differ! But it does!"); |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
571 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
572 |
} |
2577ddb7e710
8004658: Add internal smart javac wrapper to solve JEP 139
ohrstrom
parents:
diff
changeset
|
573 |
} |