Skip to content

Commit e335290

Browse files
authored
javac plugin: keep parameter names
By adding `-parameters` when we build java code using the java compiler plugin we retain parameter names and therefore we get: ``` func sayHello(_ x: Int32, _ y: Int32) -> Int32 ``` rather than ``` func sayHello(_ arg0: Int32, _ arg1: Int32) -> Int32 ``` which is a slightly nicer developer experience. When using with already built jars we can't influence that, but whenever using with java sources we actually build we should recommend keeping that flag probably.
1 parent a6efd5d commit e335290

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Plugins/JavaCompilerPlugin/JavaCompilerPlugin.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ struct JavaCompilerBuildToolPlugin: BuildToolPlugin {
5858
.appending(path: "bin")
5959
.appending(path: "javac"),
6060
arguments: javaFiles.map { $0.path(percentEncoded: false) } + [
61-
"-d", javaClassFileURL.path()
61+
"-d", javaClassFileURL.path(),
62+
"-parameters", // keep parameter names, which allows us to emit them in generated Swift decls
6263
],
6364
inputFiles: javaFiles,
6465
outputFiles: classFiles

0 commit comments

Comments
 (0)