summaryrefslogtreecommitdiff
path: root/test/569-checker-pattern-replacement/src-multidex/DerivedWithFinalField.java
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-02-04 19:46:56 +0000
committer Vladimir Marko <vmarko@google.com> 2016-02-10 10:12:22 +0000
commitf8b3b8bc37fb04d8ae113ae6bfcf4de2f5a700d4 (patch)
treecee02ae8f42e413e2d6af2140cd2f08e6ea34e6d /test/569-checker-pattern-replacement/src-multidex/DerivedWithFinalField.java
parent8b0e9b87ab6e54237b2d1e101b8cce7ea6443238 (diff)
Try to substitute constructor chains for IPUTs.
Match a constructor chain where each constructor either forwards some or all of its arguments to the next (i.e. superclass constructor or a constructor in the same class) and may pass extra zeros (of any type, including null), followed by any number of IPUTs on "this", storing either arguments or zeros, until we reach the contructor of java.lang.Object. When collecting IPUTs from the constructor chain, remove any IPUTs that store the same field as an IPUT that comes later. This is safe in this case even if those IPUTs store volatile fields because the uninitialized object reference wasn't allowed to escape yet. Also remove any IPUTs that store zero values as the allocated object is already zero initialized. (cherry picked from commit 354efa6cdf558b2331e8fec539893fa51763806e) Change-Id: I691e3b82e550e7a3272ce6a81647c7fcd02c01b1
Diffstat (limited to 'test/569-checker-pattern-replacement/src-multidex/DerivedWithFinalField.java')
-rw-r--r--test/569-checker-pattern-replacement/src-multidex/DerivedWithFinalField.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/569-checker-pattern-replacement/src-multidex/DerivedWithFinalField.java b/test/569-checker-pattern-replacement/src-multidex/DerivedWithFinalField.java
new file mode 100644
index 0000000000..5b39b8a182
--- /dev/null
+++ b/test/569-checker-pattern-replacement/src-multidex/DerivedWithFinalField.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public final class DerivedWithFinalField extends BaseWithFinalField {
+ DerivedWithFinalField() {
+ this(0);
+ }
+
+ DerivedWithFinalField(int intValue) {
+ super(intValue);
+ doubleField = 0.0;
+ }
+
+ DerivedWithFinalField(double doubleValue) {
+ super(0);
+ doubleField = doubleValue;
+ }
+
+ DerivedWithFinalField(int intValue, double doubleValue) {
+ super(intValue);
+ doubleField = doubleValue;
+ }
+
+ public final double doubleField;
+}