panacekcz / checker-framework

Pluggable type-checking for Java
http://checkerframework.org/
Other
0 stars 0 forks source link

Arrays of type char[] and byte[] with constant initializer are not compatible with ArrayLen annotation #1

Open panacekcz opened 7 years ago

panacekcz commented 7 years ago

Currently, these tests do not pass (wrong):

byte @ArrayLen(2) [] bytes = new byte[] {100, '%'};
char @ArrayLen(3) [] chars = new char[] {45, 'A', '%'};

While these tests pass (correct):

int @ArrayLen(3) [] ints = new int[] {2, 2, 2};
byte @StringVal("d%") [] bytes = new byte[] {100, '%'};
char @StringVal("-A%") [] chars = new char[] {45, 'A', '%'};

This should be resolved when @StringVal("d%") is a subtype of @ArrayLen(2).