1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
// In this test, method main() in class CheckedExceptions declares that it
// throws I, where I is an interface. This should not cause an assert nor an
// exception because JVMS 4.7.5 says that type checks of the classes listed
// in the Exceptions attributes are only enforced at compile time. (Note that
// the types in a method's throws clause are passed to the JVM using the
// Exceptions attribute.)
// interface I { }
file "I.class" {
0xCAFEBABE;
0; // minor version
59; // version
[7] { // Constant Pool
; // first element is empty
class #2; // #1 at 0x0A
Utf8 "I"; // #2 at 0x0D
class #4; // #3 at 0x11
Utf8 "java/lang/Object"; // #4 at 0x14
Utf8 "SourceFile"; // #5 at 0x27
Utf8 "CheckedExceptions.java"; // #6 at 0x34
} // Constant Pool
0x0600; // access [ ACC_INTERFACE ]
#1;// this_cpx
#3;// super_cpx
[0] { // Interfaces
} // Interfaces
[0] { // fields
} // fields
[0] { // methods
} // methods
[1] { // Attributes
Attr(#5, 2) { // SourceFile at 0x5B
#6;
} // end SourceFile
} // Attributes
} // end class I
// public class CheckedExceptions {
// public static void main(String argv[]) throws I {
// System.out.println("Hello");
// }
// }
class CheckedExceptions {
0xCAFEBABE;
0; // minor version
59; // version
[32] { // Constant Pool
; // first element is empty
Method #2 #3; // #1 at 0x0A
class #4; // #2 at 0x0F
NameAndType #5 #6; // #3 at 0x12
Utf8 "java/lang/Object"; // #4 at 0x17
Utf8 "<init>"; // #5 at 0x2A
Utf8 "()V"; // #6 at 0x33
Field #8 #9; // #7 at 0x39
class #10; // #8 at 0x3E
NameAndType #11 #12; // #9 at 0x41
Utf8 "java/lang/System"; // #10 at 0x46
Utf8 "out"; // #11 at 0x59
Utf8 "Ljava/io/PrintStream;"; // #12 at 0x5F
String #14; // #13 at 0x77
Utf8 "Hello"; // #14 at 0x7A
Method #16 #17; // #15 at 0x82
class #18; // #16 at 0x87
NameAndType #19 #20; // #17 at 0x8A
Utf8 "java/io/PrintStream"; // #18 at 0x8F
Utf8 "println"; // #19 at 0xA5
Utf8 "(Ljava/lang/String;)V"; // #20 at 0xAF
class #22; // #21 at 0xC7
Utf8 "CheckedExceptions"; // #22 at 0xCA
Utf8 "Code"; // #23 at 0xDE
Utf8 "LineNumberTable"; // #24 at 0xE5
Utf8 "main"; // #25 at 0xF7
Utf8 "([Ljava/lang/String;)V"; // #26 at 0xFE
Utf8 "Exceptions"; // #27 at 0x0117
class #29; // #28 at 0x0124
Utf8 "I"; // #29 at 0x0127
Utf8 "SourceFile"; // #30 at 0x0148
Utf8 "CheckedExceptions.java"; // #31 at 0x0155
} // Constant Pool
0x0021; // access [ ACC_PUBLIC ACC_SUPER ]
#21;// this_cpx
#2;// super_cpx
[0] { // Interfaces
} // Interfaces
[0] { // fields
} // fields
[2] { // methods
{ // Member at 0x017A
0x0001; // access
#5; // name_cpx
#6; // sig_cpx
[1] { // Attributes
Attr(#23, 29) { // Code at 0x0182
1; // max_stack
1; // max_locals
Bytes[5]{
0x2AB70001B1;
}
[0] { // Traps
} // end Traps
[1] { // Attributes
Attr(#24, 6) { // LineNumberTable at 0x0199
[1] { // LineNumberTable
0 3; // at 0x01A5
}
} // end LineNumberTable
} // Attributes
} // end Code
} // Attributes
} // Member
;
{ // Member at 0x01A5
0x0009; // access
#25; // name_cpx
#26; // sig_cpx
[2] { // Attributes
Attr(#23, 37) { // Code at 0x01AD
2; // max_stack
1; // max_locals
Bytes[9]{
0xB20007120DB6000F;
0xB1;
}
[0] { // Traps
} // end Traps
[1] { // Attributes
Attr(#24, 10) { // LineNumberTable at 0x01C8
[2] { // LineNumberTable
0 6; // at 0x01D4
8 7; // at 0x01D8
}
} // end LineNumberTable
} // Attributes
} // end Code
;
Attr(#27, 4) { // Exceptions at 0x01D8
[1] { // Exceptions
#28; // at 0x01E2
}
} // end Exceptions
} // Attributes
} // Member
} // methods
[1] { // Attributes
Attr(#30, 2) { // SourceFile at 0x01E4
#31;
} // end SourceFile
} // Attributes
} // end class CheckedExceptions
|