Fixed test for static final fields that don't use <clinit>.
Static final fields that are initialized by a compile-time constant
expression are replaced by copies of the constant value. This is done by
the compiler, and the dex file format passes it on.
Change-Id: I19c9b63508a4632ac32b8b877f33d68bfb3b054b
diff --git a/test/Statics/Statics.java b/test/Statics/Statics.java
index b777650..d7158d4 100644
--- a/test/Statics/Statics.java
+++ b/test/Statics/Statics.java
@@ -1,16 +1,15 @@
// Copyright 2011 Google Inc. All Rights Reserved.
class Statics {
- static boolean s0 = true;
- static byte s1 = 5;
- static char s2 = 'a';
- static short s3 = (short) 65000;
- static int s4 = 2000000000;
- static long s5 = 0x123456789abcdefL;
- static float s6 = 0.5f;
- static double s7 = 16777217;
- static Object s8 = "android";
- static Object[] s9 = { "a", "b" };
+ static final boolean s0 = true;
+ static final byte s1 = 5;
+ static final char s2 = 'a';
+ static final short s3 = (short) 65000;
+ static final int s4 = 2000000000;
+ static final long s5 = 0x1234567890abcdefL;
+ static final float s6 = 0.5f;
+ static final double s7 = 16777217;
+ static final String s8 = "android";
static boolean getS0() {
return s0;
@@ -36,10 +35,7 @@
static double getS7() {
return s7;
}
- static Object getS8() {
+ static String getS8() {
return s8;
}
- static Object[] getS9() {
- return s9;
- }
}
diff --git a/test/StaticsFromCode/StaticsFromCode.java b/test/StaticsFromCode/StaticsFromCode.java
new file mode 100644
index 0000000..b62d99e
--- /dev/null
+++ b/test/StaticsFromCode/StaticsFromCode.java
@@ -0,0 +1,9 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+
+class StaticsFromCode {
+ static final Object s0 = "android";
+
+ static Object getS0() {
+ return s0;
+ }
+}