1b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe/*
2b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe * Copyright (C) 2015 The Android Open Source Project
3b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe *
4b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe * Licensed under the Apache License, Version 2.0 (the "License");
5b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe * you may not use this file except in compliance with the License.
6b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe * You may obtain a copy of the License at
7b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe *
8b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe *      http://www.apache.org/licenses/LICENSE-2.0
9b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe *
10b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe * Unless required by applicable law or agreed to in writing, software
11b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe * distributed under the License is distributed on an "AS IS" BASIS,
12b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe * See the License for the specific language governing permissions and
14b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe * limitations under the License.
15b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe */
16b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe
17b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampepublic class A {
18b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe    // Object fields add padding in the Foo class object layout. Therefore the field 'i' should
19b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe    // be at a different offset compared to the A class from the ex DEX file.
20b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe    public final Object anObject = null;
21b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe    public final Object anotherObject = null;
22b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe    // Use volatile to defeat inlining of the constructor + load-elimination.
23b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe    public volatile int i;
24b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe
25b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe    public A() {
26b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe      i = 10;
27b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe    }
28b9aec2ccd8b9f39a4ddadde5ca8304cea6b1b188Andreas Gampe}
29