1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 public class TestPutField 26 version 53:0 27 { 28 29 final Field test_field:"I"; 30 31 32 public Method <init>:"()V" 33 stack 2 locals 1 34 { 35 aload_0; 36 dup; 37 invokespecial Method java/lang/Object.<init>:"()V"; 38 bipush 13; 39 putfield Field test_field:"I"; 40 return; 41 } 42 43 public Method aMethod:"()I" 44 stack 2 locals 2 45 { 46 aload_0; 47 getfield Field test_field:"I"; 48 istore_1; 49 aload_0; 50 bipush 14; 51 putfield Field test_field:"I"; 52 iload_1; 53 ireturn; 54 } 55 56 57 public static Method test:"()V" 58 stack 2 locals 2 59 { 60 new class TestPutField; 61 astore_0; 62 aload_0; 63 invokespecial Method <init>:"()V"; 64 getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; 65 astore_1; 66 aload_1; 67 aload_0; 68 invokevirtual Method aMethod:"()I"; 69 invokevirtual Method java/io/PrintStream.println:"(I)V"; 70 aload_1; 71 aload_0; 72 getfield Field test_field:"I"; 73 invokevirtual Method java/io/PrintStream.println:"(I)V"; 74 return; 75 } 76 77 }