Skip to content

Java record varargs field works in separate compilation, but not in joint compilation #24167

@Florian3k

Description

@Florian3k

Compiler version

3.3.7 (LTS), 3.7.3, 3.8.0-RC1-bin-20251011-be16a7b-NIGHTLY

Minimized code

Rec.java:

public record Rec(int... xs) {}

main.scala:

@main def main() = val r = Rec(1) val xs = r.xs()

Output

Separate compilation (success):

javac Rec.java && scala-cli compile main.scala --classpath=. --server=false

Joint compilation (error)

scala-cli compile main.scala Rec.java --server=false:

3 | val xs = r.xs() | ^ | Cannot return repeated parameter type Int* 1 error found Compilation failed 

Expectation

Both should compile successfully.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions