-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:annotationscompat:javaitype:bugstat:deprecated featureIssues tied to features which were deprecated at some point.Issues tied to features which were deprecated at some point.
Description
Compiler version
3.7.3
Minimized code
https://github.com/gaeljw/scala3_deprecated_java_annotation (uses SBT but the code itself is minimized)
For the record, here's the minimal example that I'm using in this repo:
import io.cucumber.junit.CucumberOptions // <-- this annotation is Java and Deprecated
@CucumberOptions(
features = Array("test/features/internal")
)
class CucumberRunner {
}
package io.cucumber.junit;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Deprecated
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface CucumberOptions {
String[] features() default {};
}
When compiling with -deprecation
(and -Werror
) flags, no error occurs in Scala 3 whereas it does in Scala 2.
The linked repository contains both the Scala 2 and Scala 3 project examples.
Output
Scala 2:
(cd testscala2 && sbt "Test / compile")
[info] welcome to sbt 1.11.6 (Red Hat, Inc. Java 21.0.8)
[info] loading settings for project global-plugins from plugins.sbt...
[info] loading global plugins from /home/jourdang/.sbt/1.0/plugins
[info] loading project definition from /tmp/testwarndeprecatedjavaannotation/testscala2/project
[info] loading settings for project root from build.sbt...
[info] set current project to testscala2 (in build file:/tmp/testwarndeprecatedjavaannotation/testscala2/)
[info] compiling 1 Scala source to /tmp/testwarndeprecatedjavaannotation/testscala2/target/scala-2.13/test-classes ...
[error] /tmp/testwarndeprecatedjavaannotation/testscala2/src/test/scala/example/CucumberRunner.scala:9:7: Java annotation CucumberOptions in package junit is deprecated
[error] class CucumberRunner {
[error] ^
[error] one error found
[error] (Test / compileIncremental) Compilation failed
[error] Total time: 2 s, completed 11 sept. 2025, 18:05:08
Scala 3: no error.
(cd testscala3 && sbt "Test / compile")
[info] welcome to sbt 1.11.6 (Red Hat, Inc. Java 21.0.8)
[info] loading settings for project global-plugins from plugins.sbt...
[info] loading global plugins from /home/jourdang/.sbt/1.0/plugins
[info] loading project definition from /tmp/testwarndeprecatedjavaannotation/testscala3/project
[info] loading settings for project root from build.sbt...
[info] set current project to testscala3 (in build file:/tmp/testwarndeprecatedjavaannotation/testscala3/)
[success] Total time: 1 s, completed 11 sept. 2025, 18:04:36
Expectation
An error should also be raised in Scala 3.
SethTisue
Metadata
Metadata
Assignees
Labels
area:annotationscompat:javaitype:bugstat:deprecated featureIssues tied to features which were deprecated at some point.Issues tied to features which were deprecated at some point.