Skip to content

Commit

Permalink
java: use some Java 21 features
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed Dec 13, 2023
1 parent 881a8f0 commit fd9533f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cli-impl/src/main/java/org/aya/cli/library/LibraryCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ public static int compile(
@NotNull Path libraryRoot
) throws IOException {
if (!Files.exists(libraryRoot)) {
reporter.reportString("Specified library root does not exist: " + libraryRoot);
reporter.reportString(STR."Specified library root does not exist: \{libraryRoot}");
return 1;
}
try {
return newCompiler(primFactory, reporter, flags, advisor, libraryRoot).start();
} catch (LibraryConfigData.BadConfig bad) {
reporter.reportString("Cannot load malformed library: " + bad.getMessage());
reporter.reportString(STR."Cannot load malformed library: \{bad.getMessage()}");
return 1;
}
}
Expand Down Expand Up @@ -141,8 +141,8 @@ private void resolveImportsIfNeeded(@NotNull LibrarySource source) throws IOExce
known.noneMatch(k -> k.moduleName().equals(s.moduleName())));
known.appendAll(dedup);
});
reporter.reportNest("Done in " + StringUtil.timeToString(
System.currentTimeMillis() - startTime), LibraryOwner.DEFAULT_INDENT + 2);
reporter.reportNest(STR."Done in \{StringUtil.timeToString(
System.currentTimeMillis() - startTime)}", LibraryOwner.DEFAULT_INDENT + 2);
return depGraph;
}

Expand Down Expand Up @@ -188,7 +188,7 @@ private void pretty(ImmutableSeq<LibrarySource> modified) throws IOException {
});
// THE BIG GAME
modified.forEachChecked(src -> {
// reportNest("[Pretty] " + QualifiedID.join(src.moduleName()));
// reportNest(STR."[Pretty] \{QualifiedID.join(src.moduleName())}");
var doc = src.pretty(ImmutableSeq.empty(), prettierOptions);
var text = renderOptions.render(outputTarget, doc, setup);
var outputFileName = AyaFiles.stripAyaSourcePostfix(src.displayPath().toString()) + outputTarget.fileExt;
Expand All @@ -214,7 +214,7 @@ private boolean make() throws IOException {
owner.addModulePath(dep.outDir());
}

reporter.reportString("Compiling " + library.name());
reporter.reportString(STR."Compiling \{library.name()}");
var startTime = System.currentTimeMillis();
if (anyDepChanged || flags.remake()) {
owner.librarySources().forEach(this::clearModified);
Expand All @@ -231,8 +231,8 @@ private boolean make() throws IOException {
}

var make = make(modified);
reporter.reportNest("Library loaded in " + StringUtil.timeToString(
System.currentTimeMillis() - startTime), LibraryOwner.DEFAULT_INDENT + 2);
reporter.reportNest(STR."Library loaded in \{StringUtil.timeToString(
System.currentTimeMillis() - startTime)}", LibraryOwner.DEFAULT_INDENT + 2);
pretty(modified);
return make;
}
Expand Down Expand Up @@ -376,7 +376,7 @@ private void tyckOne(@NotNull LibrarySource file) {
QualifiedID.join(moduleName), file.displayPath()), LibraryOwner.DEFAULT_INDENT);
var mod = moduleLoader.load(moduleName);
if (mod == null || file.resolveInfo().get() == null)
throw new InternalException("Unable to load module: " + moduleName);
throw new InternalException(STR."Unable to load module: \{moduleName}");
}
}

Expand Down

0 comments on commit fd9533f

Please sign in to comment.