|
[#676] |
project: compiler |
priority: low |
category: bug |
|
submitter |
assigned to |
status |
date submitted |
|
Iulian |
Nikolay |
fixed |
2006-07-25 17:48:47.0 |
subject |
IncompatibleClassChangeError using Java annotations |
code |
// java file
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
public @interface Slider {
int min();
int max();
}
// scala code
object Main extends Application {
val x: Slider = null;
def method = x.max
method
}
|
what happened |
'Slider's symbol will be seen as a class, not as an interface (no 'INTERFACE' flag), and the backend will emit t\
he wrong invoke opcode
|
what expected |
Slider should be marked as an interface by the classfile parser. Or not? It does not seem like an omission, but rather intentional. Code inside the classfile parser explicitely tests that an interface is /not/ an annotation. Nik, do you remember why is it a bad idea to see annotations as interfaces in the compiler? Anyway, currently they are seen as classes (for instance, scalac would not complain if one wrote 'new Slider'!) and that's definitely wrong. |
[back to overview] |