Add test for field initializers

This commit is contained in:
Chris Smowton
2021-08-24 14:02:53 +01:00
parent c8d98ae649
commit 5a2dfda09e
7 changed files with 58 additions and 0 deletions

View File

@@ -4,4 +4,14 @@ public class FieldTest {
float ff, g = 2.3f, hhh;
static Object obj = null, obj2;
@SuppressWarnings("rawtypes") java.util.List l, m;
int x = 0;
int y = x = 1;
{
x = 2; // Shouldn't show up as an initializer
}
static int z = 0;
static int w = z = 1;
static {
z = 2; // Shouldn't show up as an initializer
}
}