use of jdk.incubator.foreign.Addressable in project openj9 by eclipse.
the class InvalidDownCallTests method test_mismatchedCharArgWithCharLayout.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Mismatched size .*")
public void test_mismatchedCharArgWithCharLayout() throws Throwable {
MethodType mt = MethodType.methodType(char.class, char.class, char.class);
FunctionDescriptor fd = FunctionDescriptor.of(C_SHORT, C_CHAR, C_SHORT);
Addressable functionSymbol = nativeLibLookup.lookup("createNewCharFrom2Chars").get();
MethodHandle mh = clinker.downcallHandle(functionSymbol, mt, fd);
fail("Failed to throw out IllegalArgumentException in the case of the mismatched layout");
}
use of jdk.incubator.foreign.Addressable in project openj9 by eclipse.
the class InvalidDownCallTests method test_invalidIntegerTypeOnReturn.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The return type must be .*")
public void test_invalidIntegerTypeOnReturn() throws Throwable {
MethodType mt = MethodType.methodType(Integer.class, int.class, int.class);
FunctionDescriptor fd = FunctionDescriptor.of(C_INT, C_INT, C_INT);
Addressable functionSymbol = nativeLibLookup.lookup("add2Ints").get();
MethodHandle mh = clinker.downcallHandle(functionSymbol, mt, fd);
fail("Failed to throw out IllegalArgumentException in the case of the Integer return type");
}
use of jdk.incubator.foreign.Addressable in project openj9 by eclipse.
the class InvalidDownCallTests method test_invalidByteTypeArgument.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The passed-in argument type at index .*")
public void test_invalidByteTypeArgument() throws Throwable {
MethodType mt = MethodType.methodType(byte.class, Byte.class, byte.class);
FunctionDescriptor fd = FunctionDescriptor.of(C_CHAR, C_CHAR, C_CHAR);
Addressable functionSymbol = nativeLibLookup.lookup("add2Bytes").get();
MethodHandle mh = clinker.downcallHandle(functionSymbol, mt, fd);
fail("Failed to throw out IllegalArgumentException in the case of the Byte argument");
}
use of jdk.incubator.foreign.Addressable in project openj9 by eclipse.
the class InvalidDownCallTests method test_invalidLongTypeArgument.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The passed-in argument type at index .*")
public void test_invalidLongTypeArgument() throws Throwable {
MethodType mt = MethodType.methodType(long.class, long.class, Long.class);
FunctionDescriptor fd = FunctionDescriptor.of(longLayout, longLayout, longLayout);
Addressable functionSymbol = nativeLibLookup.lookup("add2Longs").get();
MethodHandle mh = clinker.downcallHandle(functionSymbol, mt, fd);
fail("Failed to throw out IllegalArgumentException in the case of the Long argument");
}
use of jdk.incubator.foreign.Addressable in project openj9 by eclipse.
the class InvalidDownCallTests method test_mismatchedIntArgLayoutWithLongType.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Mismatched size .*")
public void test_mismatchedIntArgLayoutWithLongType() throws Throwable {
MethodType mt = MethodType.methodType(long.class, long.class, long.class);
FunctionDescriptor fd = FunctionDescriptor.of(longLayout, longLayout, C_INT);
Addressable functionSymbol = nativeLibLookup.lookup("add2Longs").get();
MethodHandle mh = clinker.downcallHandle(functionSymbol, mt, fd);
fail("Failed to throw out IllegalArgumentException in the case of the mismatched int layout");
}
Aggregations