1 // ASM: a very small and fast Java bytecode manipulation framework 2 // Copyright (c) 2000-2011 INRIA, France Telecom 3 // All rights reserved. 4 // 5 // Redistribution and use in source and binary forms, with or without 6 // modification, are permitted provided that the following conditions 7 // are met: 8 // 1. Redistributions of source code must retain the above copyright 9 // notice, this list of conditions and the following disclaimer. 10 // 2. Redistributions in binary form must reproduce the above copyright 11 // notice, this list of conditions and the following disclaimer in the 12 // documentation and/or other materials provided with the distribution. 13 // 3. Neither the name of the copyright holders nor the names of its 14 // contributors may be used to endorse or promote products derived from 15 // this software without specific prior written permission. 16 // 17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 // THE POSSIBILITY OF SUCH DAMAGE. 28 package jdk3; 29 30 import java.io.Serializable; 31 32 /** 33 * Class which, compiled with the JDK 1.3.0, produces all the class file structures from that 34 * version. Must be compiled with "javac -g". 35 */ 36 abstract class AllStructures implements Runnable, Cloneable, Serializable { 37 38 private static final String UTF8 = "\u0008\u0080\u0800\u8000"; 39 private static final long serialVersionUID = 123456L; 40 41 public int f0; 42 protected float f1; 43 long f2; 44 private double f3; 45 static AllStructures f4; 46 final byte f5 = 1; 47 transient char f6; 48 volatile short f7; 49 boolean f8; 50 51 static { 52 f4 = null; 53 } 54 m0()55 public int m0() { 56 return f0; 57 } 58 m1()59 protected float m1() { 60 return f1; 61 } 62 m2()63 long m2() { 64 return f2; 65 } 66 m3()67 private double m3() { 68 return f3; 69 } 70 m4()71 static AllStructures m4() { 72 return f4; 73 } 74 m5()75 final byte m5() { 76 return f5; 77 } 78 m6()79 strictfp char m6() { 80 return f6; 81 } 82 m7()83 short m7() { 84 return f7; 85 } 86 m8()87 abstract boolean m8(); 88 main(String[] args)89 public static void main(String[] args) {} 90 run()91 public void run() {} 92 clone()93 public synchronized Object clone() { 94 return this; 95 } 96 nativeMethod()97 private native void nativeMethod(); 98 anonymousInnerClass()99 private Runnable anonymousInnerClass() throws Exception { 100 if (f0 > 0) { 101 throw new Exception(); 102 } 103 return new Runnable() { 104 public void run() { 105 new InnerClass(new InnerClass(f3 + m3()).f0); 106 } 107 }; 108 } 109 110 private class InnerClass { 111 private final double f0; 112 113 private InnerClass(double f0) { 114 this.f0 = f0; 115 } 116 } 117 } 118