New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid compilation error in mixed Scala/Java projects that use Java annotations with default values #3415
Comments
Imported From: https://issues.scala-lang.org/browse/SI-3415?orig=1 |
@milessabin said: |
spiros said: |
spiros said: It might be related to the default argument changes that happen recently in trunk r21794. Given the Java annotation package hello;
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
@Inherited
public @interface Hello {
String msg() default "hello world";
} and the Scala class: package hello
class HelloWorld {
@Hello
def method() { }
} when I try to compile from the command line using the command scalac hello/* I get the following message: hello/Hello.java:10: error: not found: type _root_
String msg() default "hello world";
^
hello/HelloWorld.scala:4: error: annotation hello.Hello is missing argument msg
@Hello
^
two errors found |
@milessabin said: |
spiros said: Thanks for the quick fix! |
This bug was introduced in Scala 2.8.0RC2. In a Scala project if we define a Java annotation with default values and try to compile we get the following message: "not found: type root".
An annotation like the following produces the above compilation error
This bug is really important since the only reason a Scala programmer has to write Java is for defining annotations. Many of the mixed Scala/Java projects contain annotations and this bug prevents any development in those projects.
The text was updated successfully, but these errors were encountered: