forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IntlGen.java
531 lines (448 loc) · 21.9 KB
/
IntlGen.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.hermes;
import com.squareup.javapoet.*;
import java.io.*;
import java.nio.file.Path;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.lang.model.element.Modifier;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class Main {
private static Set<String> s_grandfatheredTagsRegular = new HashSet<>();
// The fixed list of BCP 47 grandfathered language tags as in
// https://www.rfc-editor.org/rfc/bcp/bcp47.txt
private static Set<String> s_grandfatheredTagsRaw =
new HashSet<>(
Arrays.asList(
"art-lojban",
"cel-gaulish",
"en-GB-oed",
"i-ami",
"i-bnn",
"i-default",
"i-enochian",
"i-hak",
"i-klingon",
"i-lux",
"i-mingo",
"i-navajo",
"i-pwn",
"i-tao",
"i-tay",
"i-tsu",
"no-bok",
"no-nyn",
"sgn-BE-FR",
"sgn-BE-NL",
"sgn-CH-DE",
"zh-guoyu",
"zh-hakka",
"zh-min",
"zh-min-nan",
"zh-xiang"));
// Unzipped CLDR
private static String s_cldrPath = "E:\\cldr\\cldr-release-37";
private static String readFileAsString(String filePath) throws IOException {
StringBuffer fileData = new StringBuffer();
BufferedReader reader = new BufferedReader(new FileReader(filePath));
char[] buf = new char[1024];
int numRead = 0;
while ((numRead = reader.read(buf)) != -1) {
String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
}
reader.close();
return fileData.toString();
}
private static String resolveFilePath(String base, String relative) {
String fullpath = Path.of(base, relative).toAbsolutePath().toString();
return fullpath;
}
public static Document geCLDRSupplementalMetadataDOM()
throws IOException, ParserConfigurationException, SAXException {
DocumentBuilderFactory domfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder domBuilder = domfactory.newDocumentBuilder();
domBuilder.setEntityResolver(
new EntityResolver() {
@Override
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
if (systemId.contains("ldmlSupplemental.dtd")) {
return new InputSource(new StringReader(""));
} else {
return null;
}
}
});
return domBuilder.parse(
new FileInputStream(
resolveFilePath(s_cldrPath, "common/supplemental/supplementalMetadata.xml")));
}
public static NodeList getRegionAliasesDomNode(Document supplementalMetadataDOM)
throws XPathExpressionException {
XPath xPath = XPathFactory.newInstance().newXPath();
String expression = "/supplementalData/metadata/alias/territoryAlias";
NodeList nodeList =
(NodeList)
xPath.compile(expression).evaluate(supplementalMetadataDOM, XPathConstants.NODESET);
return nodeList;
}
public static NodeList getLanguageAliasesDomNode(Document supplementalMetadataDOM)
throws XPathExpressionException {
XPath xPath = XPathFactory.newInstance().newXPath();
String expression = "/supplementalData/metadata/alias/languageAlias";
NodeList nodeList =
(NodeList)
xPath.compile(expression).evaluate(supplementalMetadataDOM, XPathConstants.NODESET);
return nodeList;
}
public static void processLanguageAliasesDomNodestoHashMaps(
NodeList languageAliasNodeList,
Hashtable<String, String> grandfatheredTags,
Hashtable<String, String> languageAliasWith2chars,
Hashtable<String, String> languageAliasWith3chars,
Hashtable<String, String[]> complexLanguageAliasMapWith2chars,
Hashtable<String, String[]> complexLanguageAliasMapWith3chars) {
for (int i = 0; i < languageAliasNodeList.getLength(); i++) {
Node languageAliasNode = languageAliasNodeList.item(i);
NamedNodeMap languageAliasAttributes = languageAliasNode.getAttributes();
String type = languageAliasAttributes.getNamedItem("type").getNodeValue();
String replacement = languageAliasAttributes.getNamedItem("replacement").getNodeValue();
// Process grandfathered tags first.
if (s_grandfatheredTagsRaw.contains(type)
|| s_grandfatheredTagsRegular.contains(type.replace('_', '-'))) {
grandfatheredTags.put(type.replace('_', '-'), replacement);
}
// We are interesting in language-id replacement, not more complex mappings with other
// subtags.
if (!unicodeLanguageSubtagRegexCompiled.matcher(type).matches()) continue;
if (unicodeLanguageSubtagRegexCompiled.matcher(replacement).matches()) {
if (type.length() == 2) {
languageAliasWith2chars.put(type, replacement);
} else if (type.length() == 3) {
languageAliasWith3chars.put(type, replacement);
} else {
// throw new RuntimeException("Invalid Language tag: " + type);
}
} else {
System.out.println("Complex language mapping: " + type + " ::" + replacement);
Matcher complexLanagueMatcher = unicodeLanguageIdRegexCompiled.matcher(replacement);
if (complexLanagueMatcher.matches()) {
String replacementLanguage = complexLanagueMatcher.group("language");
String replacementScript = complexLanagueMatcher.group("script");
String replacementRegion = complexLanagueMatcher.group("region");
String replacementVariants = complexLanagueMatcher.group("variants");
System.out.println(
replacementLanguage
+ ":"
+ replacementScript
+ ":"
+ replacementRegion
+ ":"
+ replacementVariants);
if (replacementVariants != null)
throw new RuntimeException(
"We don't support complex language replacements with variants");
if (type.length() == 2) {
complexLanguageAliasMapWith2chars.put(
type, new String[] {replacementLanguage, replacementScript, replacementRegion});
} else {
complexLanguageAliasMapWith3chars.put(
type, new String[] {replacementLanguage, replacementScript, replacementRegion});
}
}
// Complex language mapping not yet implemented.
}
}
}
public static void processRegionAliasesDomNodestoHashMaps(
NodeList regionAliasNodeList,
Hashtable<String, String> regionAliasWith2chars,
Hashtable<String, String> regionAliasWith3chars) {
for (int i = 0; i < regionAliasNodeList.getLength(); i++) {
Node regionAliasNode = regionAliasNodeList.item(i);
NamedNodeMap regionAliasAttributes = regionAliasNode.getAttributes();
String type = regionAliasAttributes.getNamedItem("type").getNodeValue();
String replacement = regionAliasAttributes.getNamedItem("replacement").getNodeValue();
if (unicodeRegionSubtagRegexCompiled.matcher(replacement).matches()) {
if (type.length() == 2) {
regionAliasWith2chars.put(type, replacement);
} else if (type.length() == 3) {
regionAliasWith3chars.put(type, replacement);
} else {
// throw new RuntimeException("Invalid region tag: " + type);
}
} else {
// Complex region mapping not yet implemented.
}
}
}
public static void populateSimpleLangageAliasFileds(
FieldSpec.Builder languageAliasKeysFieldBuilder,
FieldSpec.Builder languageAliasReplacementsFieldBuilder,
Hashtable<String, String> languageAliasMap) {
ArrayList<String> languageAliasKeys = new ArrayList<String>(languageAliasMap.keySet());
Collections.sort(languageAliasKeys);
ArrayList<String> languageAliasReplacements = new ArrayList<String>();
for (String key : languageAliasKeys) {
languageAliasReplacements.add(languageAliasMap.get(key));
}
languageAliasKeysFieldBuilder
.addModifiers(Modifier.FINAL, Modifier.PUBLIC, Modifier.STATIC)
.initializer("{\"" + String.join("\",\"", languageAliasKeys) + "\"}")
.build();
languageAliasReplacementsFieldBuilder
.addModifiers(Modifier.FINAL, Modifier.PUBLIC, Modifier.STATIC)
.initializer("{\"" + String.join("\",\"", languageAliasReplacements) + "\"}")
.build();
}
public static void populateGrandfatheredFileds(
FieldSpec.Builder grandFatheredKeysFieldBuilder,
FieldSpec.Builder grandfatheredReplacementsFieldBuilder,
Hashtable<String, String> grandfatheredMap) {
ArrayList<String> grandfatheredKeys = new ArrayList<String>(grandfatheredMap.keySet());
Collections.sort(grandfatheredKeys);
ArrayList<String> grandfatheredReplacements = new ArrayList<String>();
for (String key : grandfatheredKeys) {
grandfatheredReplacements.add(grandfatheredMap.get(key));
}
grandFatheredKeysFieldBuilder
.addModifiers(Modifier.FINAL, Modifier.PUBLIC, Modifier.STATIC)
.initializer("{\"" + String.join("\",\"", grandfatheredKeys) + "\"}")
.build();
grandfatheredReplacementsFieldBuilder
.addModifiers(Modifier.FINAL, Modifier.PUBLIC, Modifier.STATIC)
.initializer("{\"" + String.join("\",\"", grandfatheredReplacements) + "\"}")
.build();
}
public static void populateComplexLangageAliasFileds(
FieldSpec.Builder complexLanguageAliasKeysFieldBuilder,
FieldSpec.Builder complexLanguageAliasReplacementsLanguageFieldBuilder,
FieldSpec.Builder complexLanguageAliasReplacementsScriptFieldBuilder,
FieldSpec.Builder complexLanguageAliasReplacementsRegionFieldBuilder,
Hashtable<String, String[]> complexLanguageAliasMap) {
ArrayList<String> languageAliasKeys = new ArrayList<String>(complexLanguageAliasMap.keySet());
Collections.sort(languageAliasKeys);
ArrayList<String> languageAliasReplacementsLanguage = new ArrayList<String>();
ArrayList<String> languageAliasReplacementsScript = new ArrayList<String>();
ArrayList<String> languageAliasReplacementsRegion = new ArrayList<String>();
for (String key : languageAliasKeys) {
String[] mappings = complexLanguageAliasMap.get(key);
languageAliasReplacementsLanguage.add(mappings[0]);
languageAliasReplacementsScript.add(mappings[1]);
languageAliasReplacementsRegion.add(mappings[2]);
}
complexLanguageAliasKeysFieldBuilder
.addModifiers(Modifier.FINAL, Modifier.PUBLIC, Modifier.STATIC)
.initializer(
"{\"" + String.join("\",\"", languageAliasKeys) + "\"}".replaceAll("\"null\"", "null"))
.build();
String languageReplacement =
"{\"" + String.join("\",\"", languageAliasReplacementsLanguage) + "\"}";
complexLanguageAliasReplacementsLanguageFieldBuilder
.addModifiers(Modifier.FINAL, Modifier.PUBLIC, Modifier.STATIC)
.initializer(languageReplacement.replaceAll("\"null\"", "null"))
.build();
String scriptReplacement =
"{\"" + String.join("\",\"", languageAliasReplacementsScript) + "\"}";
complexLanguageAliasReplacementsScriptFieldBuilder
.addModifiers(Modifier.FINAL, Modifier.PUBLIC, Modifier.STATIC)
.initializer(scriptReplacement.replace("\"null\"", "null"))
.build();
String regionReplacement =
"{\"" + String.join("\",\"", languageAliasReplacementsRegion) + "\"}";
complexLanguageAliasReplacementsRegionFieldBuilder
.addModifiers(Modifier.FINAL, Modifier.PUBLIC, Modifier.STATIC)
.initializer(regionReplacement.replaceAll("\"null\"", "null"))
.build();
}
public static void populateRegionAliasFileds(
FieldSpec.Builder regionAliasKeysFieldBuilder,
FieldSpec.Builder regionAliasReplacementsFieldBuilder,
Hashtable<String, String> regionAliasMap) {
ArrayList<String> regionAliasKeys = new ArrayList<String>(regionAliasMap.keySet());
Collections.sort(regionAliasKeys);
ArrayList<String> regionAliasReplacements = new ArrayList<String>();
for (String key : regionAliasKeys) {
regionAliasReplacements.add(regionAliasMap.get(key));
}
regionAliasKeysFieldBuilder
.addModifiers(Modifier.FINAL, Modifier.PUBLIC, Modifier.STATIC)
.initializer("{\"" + String.join("\",\"", regionAliasKeys) + "\"}")
.build();
regionAliasReplacementsFieldBuilder
.addModifiers(Modifier.FINAL, Modifier.PUBLIC, Modifier.STATIC)
.initializer("{\"" + String.join("\",\"", regionAliasReplacements) + "\"}")
.build();
}
private static String unicodeLanguageIdRegex =
"^"
+ "(?<language>[a-z]{2,3}|[a-z]{5,8})"
+ "(?:(-|_)(?<script>[a-z]{4}))?"
+ "(?:(-|_)(?<region>([a-z]{2}|[0-9]{3})))?"
+ "(?<variants>((-|_)([a-z0-9]{5,8}|[0-9][a-z0-9]{3}))+)?"
+ "$";
private static String unicodeLanguageSubtagRegex = "^" + "([a-z]{2,3}|[a-z]{5,8})" + "$";
private static String unicodeRegionSubtagRegex = "^" + "([a-z]{2}|[0-9]{3})" + "$";
private static Pattern unicodeLanguageIdRegexCompiled =
Pattern.compile(unicodeLanguageIdRegex, Pattern.CASE_INSENSITIVE);
private static Pattern unicodeLanguageSubtagRegexCompiled =
Pattern.compile(unicodeLanguageSubtagRegex, Pattern.CASE_INSENSITIVE);
private static Pattern unicodeRegionSubtagRegexCompiled =
Pattern.compile(unicodeRegionSubtagRegex, Pattern.CASE_INSENSITIVE);
public static void main(String[] args)
throws IOException, ParserConfigurationException, SAXException, XPathExpressionException {
// String x = "{\"null\",\"null\",\"Latn\",\"null\",\"null\",\"null\"}";
// String y = x.replace("\"null\"", "null");
// System.out.println(y);
// System.exit(0);
// StringBuffer str = new StringBuffer(" abc def ");
// System.out.println("|" + str.toString() + "|" + str.length());
//
// int idx = 0;
// while (str.charAt(idx) == ' ') idx ++;
// str.delete(0, idx);
// System.out.println("|" + str.toString() + "|" + str.length());
//
// idx=str.length()-1;
// while(str.charAt(idx) == ' ') idx --;
// str.delete(idx+1, str.length());
// System.out.println("|" + str.toString() + "|" + str.length());
// Prepare regular grandfathered tags.
for (String grandfathered : s_grandfatheredTagsRaw) {
if (unicodeLanguageIdRegexCompiled.matcher(grandfathered).matches()) {
s_grandfatheredTagsRegular.add(grandfathered);
}
}
Document supplementalMetadataDOM = geCLDRSupplementalMetadataDOM();
NodeList languageAliasNodeList = getLanguageAliasesDomNode(supplementalMetadataDOM);
Hashtable<String, String> regularGrandfatheredTags = new Hashtable<>();
Hashtable<String, String> languageAliasMapWith2chars = new Hashtable<>();
Hashtable<String, String> languageAliasMapWith3chars = new Hashtable<>();
Hashtable<String, String[]> complexLanguageAliasMapWith2chars = new Hashtable<>();
Hashtable<String, String[]> complexLanguageAliasMapWith3chars = new Hashtable<>();
processLanguageAliasesDomNodestoHashMaps(
languageAliasNodeList,
regularGrandfatheredTags,
languageAliasMapWith2chars,
languageAliasMapWith3chars,
complexLanguageAliasMapWith2chars,
complexLanguageAliasMapWith3chars);
FieldSpec.Builder regularGrandfatheredKeysFieldBuilder =
FieldSpec.builder(String[].class, "regularGrandfatheredKeys");
FieldSpec.Builder regularGrandfatheredReplacementsFieldBuilder =
FieldSpec.builder(String[].class, "regularGrandfatheredReplacements");
populateGrandfatheredFileds(
regularGrandfatheredKeysFieldBuilder,
regularGrandfatheredReplacementsFieldBuilder,
regularGrandfatheredTags);
FieldSpec.Builder languageAliasKeys2FieldBuilder =
FieldSpec.builder(String[].class, "languageAliasKeys2");
FieldSpec.Builder languageAliasReplacements2FieldBuilder =
FieldSpec.builder(String[].class, "languageAliasReplacements2");
populateSimpleLangageAliasFileds(
languageAliasKeys2FieldBuilder,
languageAliasReplacements2FieldBuilder,
languageAliasMapWith2chars);
FieldSpec.Builder languageAliasKeys3FieldBuilder =
FieldSpec.builder(String[].class, "languageAliasKeys3");
FieldSpec.Builder languageAliasReplacements3FieldBuilder =
FieldSpec.builder(String[].class, "languageAliasReplacements3");
populateSimpleLangageAliasFileds(
languageAliasKeys3FieldBuilder,
languageAliasReplacements3FieldBuilder,
languageAliasMapWith3chars);
FieldSpec.Builder complexLanguageAliasKeysField2Builder =
FieldSpec.builder(String[].class, "complexLanguageAliasKeys2");
FieldSpec.Builder complexLanguageAliasReplacementsLanguage2FieldBuilder =
FieldSpec.builder(String[].class, "complexLanguageAliasReplacementsLanguage2");
FieldSpec.Builder complexLanguageAliasReplacementsScript2FieldBuilder =
FieldSpec.builder(String[].class, "complexLanguageAliasReplacementsScript2");
FieldSpec.Builder complexLanguageAliasReplacementsRegion2FieldBuilder =
FieldSpec.builder(String[].class, "complexLanguageAliasReplacementsRegion2");
populateComplexLangageAliasFileds(
complexLanguageAliasKeysField2Builder,
complexLanguageAliasReplacementsLanguage2FieldBuilder,
complexLanguageAliasReplacementsScript2FieldBuilder,
complexLanguageAliasReplacementsRegion2FieldBuilder,
complexLanguageAliasMapWith2chars);
FieldSpec.Builder complexLanguageAliasKeysField3Builder =
FieldSpec.builder(String[].class, "complexLanguageAliasKeys3");
FieldSpec.Builder complexLanguageAliasReplacementsLanguage3FieldBuilder =
FieldSpec.builder(String[].class, "complexLanguageAliasReplacementsLanguage3");
FieldSpec.Builder complexLanguageAliasReplacementsScript3FieldBuilder =
FieldSpec.builder(String[].class, "complexLanguageAliasReplacementsScript3");
FieldSpec.Builder complexLanguageAliasReplacementsRegion3FieldBuilder =
FieldSpec.builder(String[].class, "complexLanguageAliasReplacementsRegion3");
populateComplexLangageAliasFileds(
complexLanguageAliasKeysField3Builder,
complexLanguageAliasReplacementsLanguage3FieldBuilder,
complexLanguageAliasReplacementsScript3FieldBuilder,
complexLanguageAliasReplacementsRegion3FieldBuilder,
complexLanguageAliasMapWith3chars);
NodeList regionAliasNodeList = getRegionAliasesDomNode(supplementalMetadataDOM);
Hashtable<String, String> regionAliasMapWith2chars = new Hashtable<>();
Hashtable<String, String> regionAliasMapWith3chars = new Hashtable<>();
processRegionAliasesDomNodestoHashMaps(
regionAliasNodeList, regionAliasMapWith2chars, regionAliasMapWith3chars);
FieldSpec.Builder regionAliasKeys2FieldBuilder =
FieldSpec.builder(String[].class, "regionAliasKeys2");
FieldSpec.Builder regionAliasReplacements2FieldBuilder =
FieldSpec.builder(String[].class, "regionAliasReplacements2");
populateRegionAliasFileds(
regionAliasKeys2FieldBuilder,
regionAliasReplacements2FieldBuilder,
regionAliasMapWith2chars);
FieldSpec.Builder regionAliasKeys3FieldBuilder =
FieldSpec.builder(String[].class, "regionAliasKeys3");
FieldSpec.Builder regionAliasReplacements3FieldBuilder =
FieldSpec.builder(String[].class, "regionAliasReplacements3");
populateRegionAliasFileds(
regionAliasKeys3FieldBuilder,
regionAliasReplacements3FieldBuilder,
regionAliasMapWith3chars);
TypeSpec helloWorld =
TypeSpec.classBuilder("LanguageTagsGenerated")
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
.addField(regularGrandfatheredKeysFieldBuilder.build())
.addField(regularGrandfatheredReplacementsFieldBuilder.build())
.addField(languageAliasKeys2FieldBuilder.build())
.addField(languageAliasReplacements2FieldBuilder.build())
.addField(languageAliasKeys3FieldBuilder.build())
.addField(languageAliasReplacements3FieldBuilder.build())
.addField(complexLanguageAliasKeysField2Builder.build())
.addField(complexLanguageAliasReplacementsLanguage2FieldBuilder.build())
.addField(complexLanguageAliasReplacementsScript2FieldBuilder.build())
.addField(complexLanguageAliasReplacementsRegion2FieldBuilder.build())
.addField(complexLanguageAliasKeysField3Builder.build())
.addField(complexLanguageAliasReplacementsLanguage3FieldBuilder.build())
.addField(complexLanguageAliasReplacementsScript3FieldBuilder.build())
.addField(complexLanguageAliasReplacementsRegion3FieldBuilder.build())
.addField(regionAliasKeys2FieldBuilder.build())
.addField(regionAliasReplacements2FieldBuilder.build())
.addField(regionAliasKeys3FieldBuilder.build())
.addField(regionAliasReplacements3FieldBuilder.build())
.build();
JavaFile javaFile = JavaFile.builder("com.company", helloWorld).build();
javaFile.writeTo(System.out);
}
}