Skip to content

Adding a method to a Java annotation breaks tasty-compatibility #19951

Closed
@Florian3k

Description

@Florian3k

Compiler version

3.4.0, 3.3.3 (also 3.2.0, 3.1.0, 3.0.0)

Minimized code

Run on jvm newer than 8:

File test.scala:

object Foo {
  @Deprecated
  def foo(): Unit = ???
}

scalac test.scala -release:8 -d Foo.jar
scalac -decompile Foo.jar

Output

Fails with

-- Error: test.scala:2:4 -----------------------------------------------------
2 |    @Deprecated
  |    ^^^^^^^^^^^
  |wrong number of arguments at <no phase> for (since: String, forRemoval: Boolean): Deprecated: (Deprecated#<init> : (since: String, forRemoval: Boolean): Deprecated), expected: 2, found: 0
1 error found

Expectation

Something like that:

/** Decompiled from Foo.jar(Foo.tasty) */
@scala.annotation.internal.SourceFile("test.scala") object Foo {
  @java.lang.Deprecated def foo(): scala.Unit = scala.Predef.???
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions