Fix deserialization of enum annotation arguments at runtime

This commit is contained in:
Alexander Udalov
2015-02-27 17:22:02 +03:00
parent f36ef6f546
commit 4fb420f3f1
12 changed files with 177 additions and 13 deletions

View File

@@ -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() {}
}