mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-23 15:51:59 +00:00
Fix deserialization of enum annotation arguments at runtime
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
//ALLOW_AST_ACCESS
|
||||
package test;
|
||||
|
||||
// This test checks that we don't accidentally call toString() on an enum value
|
||||
// to determine which enum entry appears in the annotation, and call name() instead
|
||||
|
||||
public class EnumArgumentWithCustomToString {
|
||||
public enum E {
|
||||
CAKE {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LIE";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public @interface EnumAnno {
|
||||
E value();
|
||||
}
|
||||
|
||||
public @interface EnumArrayAnno {
|
||||
E[] value();
|
||||
}
|
||||
|
||||
@EnumAnno(E.CAKE)
|
||||
@EnumArrayAnno({E.CAKE, E.CAKE})
|
||||
void annotated() {}
|
||||
}
|
||||
Reference in New Issue
Block a user