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
Scalac fails to recognize static final fields as constants when parsing Java sources #5333
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5333?orig=1
|
@vigdorchik said: |
@lrytz said (edited on Oct 20, 2014 12:56:08 PM UTC): public class A {
public static final int N = 0;
public static final int K = A.N + A.N; // needs to have ConstantType
} Also, the way things are set up in Scalac, a compile-time constant (in Scala) needs to have an inferred type. In Java, there's always an explicit type. So we need to be able to decide somehow if the type (for K) should be inferred or not. |
@adriaanm said: |
Attempting to compile attached files with scalac results in an error:
If Const.java is compiled with javac first, scalac does not report any errors:
javac Const.java
scalac Test.scala IntAnnotation.java
Another example: https://gist.github.com/lrytz/838709adcfb0f08eb2c5. SBT runs the scala compiler only once.
The text was updated successfully, but these errors were encountered: