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 * @test
26 * @bug 8033735
27 * @summary check backtrace field introspection
28 * @modules java.base/jdk.internal.misc
29 * @library /testlibrary
30 * @run main ThrowableIntrospectionSegfault
31 */
32
33 import java.lang.reflect.*;
34
35 public class ThrowableIntrospectionSegfault {
36 public static void main(java.lang.String[] unused) {
37 // Construct a throwable object.
38 Throwable throwable = new Throwable();
39 throwable.fillInStackTrace();
40
41 // Retrieve a reflection handle to the private backtrace field.
42 Class class1 = throwable.getClass();
43 Field field;
44 try {
45 field = class1.getDeclaredField("backtrace");
46 }
47 catch (NoSuchFieldException e) {
48 System.err.println("Can't retrieve field handle Throwable.backtrace: " + e.toString());
49 return;
|
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 * @test
26 * @bug 8033735
27 * @summary check backtrace field introspection
28 * @modules java.base/jdk.internal.misc
29 * @run main ThrowableIntrospectionSegfault
30 */
31
32 import java.lang.reflect.*;
33
34 public class ThrowableIntrospectionSegfault {
35 public static void main(java.lang.String[] unused) {
36 // Construct a throwable object.
37 Throwable throwable = new Throwable();
38 throwable.fillInStackTrace();
39
40 // Retrieve a reflection handle to the private backtrace field.
41 Class class1 = throwable.getClass();
42 Field field;
43 try {
44 field = class1.getDeclaredField("backtrace");
45 }
46 catch (NoSuchFieldException e) {
47 System.err.println("Can't retrieve field handle Throwable.backtrace: " + e.toString());
48 return;
|