< prev index next >
test/hotspot/jtreg/runtime/valhalla/valuetypes/verifier/VerifierValueTypes.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2018, 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.
--- 1,7 ----
/*
! * Copyright (c) 2018, 2019, 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.
*** 33,56 ****
public static void runTestVerifyError(String test_name, String message) throws Exception {
System.out.println("Testing: " + test_name);
try {
Class newClass = Class.forName(test_name);
} catch (java.lang.VerifyError e) {
if (!e.getMessage().contains(message)) {
! throw new RuntimeException( "Wrong VerifyError: " + e.getMessage());
}
}
}
public static void runTestFormatError(String test_name, String message) throws Exception {
System.out.println("Testing: " + test_name);
try {
Class newClass = Class.forName(test_name);
} catch (java.lang.ClassFormatError e) {
if (!e.getMessage().contains(message)) {
! throw new RuntimeException( "Wrong ClassFormatError: " + e.getMessage());
}
}
}
public static void main(String[] args) throws Exception {
--- 33,58 ----
public static void runTestVerifyError(String test_name, String message) throws Exception {
System.out.println("Testing: " + test_name);
try {
Class newClass = Class.forName(test_name);
+ throw new RuntimeException("Expected VerifyError exception not thrown");
} catch (java.lang.VerifyError e) {
if (!e.getMessage().contains(message)) {
! throw new RuntimeException("Wrong VerifyError: " + e.getMessage());
}
}
}
public static void runTestFormatError(String test_name, String message) throws Exception {
System.out.println("Testing: " + test_name);
try {
Class newClass = Class.forName(test_name);
+ throw new RuntimeException("Expected ClassFormatError exception not thrown");
} catch (java.lang.ClassFormatError e) {
if (!e.getMessage().contains(message)) {
! throw new RuntimeException("Wrong ClassFormatError: " + e.getMessage());
}
}
}
public static void main(String[] args) throws Exception {
*** 94,108 ****
runTestVerifyError("defValueObj", "Invalid type on operand stack in withfield instruction");
// Test VerifyError is thrown if a withfield's class operand is not a value type.
runTestVerifyError("withfieldObj", "Bad type on operand stack");
! // Test that an array of value types is not assignable to [Ljava/lang/Object;.
runTestVerifyError("NoArrayCov",
"Type '[QNoArrayCov;' (current frame, stack[1]) is not assignable to '[Ljava/lang/Object;'");
! // Test that an array of value types is not assignable to an array of interfaces.
runTestVerifyError("NoArrayCovIntf",
"Type '[QNoArrayCovIntf;' (current frame, stack[1]) is not assignable to '[LII;'");
// Test that null is not assignable to a value type.
runTestVerifyError("NoNullVT",
--- 96,110 ----
runTestVerifyError("defValueObj", "Invalid type on operand stack in withfield instruction");
// Test VerifyError is thrown if a withfield's class operand is not a value type.
runTestVerifyError("withfieldObj", "Bad type on operand stack");
! // Test that an array of value types is not assignable to [Ljava/lang/Object; (Non-covariance).
runTestVerifyError("NoArrayCov",
"Type '[QNoArrayCov;' (current frame, stack[1]) is not assignable to '[Ljava/lang/Object;'");
! // Test that an array of value types is not assignable to an array of interfaces (Non-covariance).
runTestVerifyError("NoArrayCovIntf",
"Type '[QNoArrayCovIntf;' (current frame, stack[1]) is not assignable to '[LII;'");
// Test that null is not assignable to a value type.
runTestVerifyError("NoNullVT",
< prev index next >