mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8199149: Improve the exception message thrown by VarHandle of unsupported operation
Reviewed-by: liach, jvernee
This commit is contained in:
parent
354c6605e3
commit
d7b9416406
4 changed files with 12 additions and 5 deletions
|
@ -26,6 +26,7 @@ package java.lang.invoke;
|
|||
|
||||
import jdk.internal.vm.annotation.DontInline;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import jdk.internal.vm.annotation.Hidden;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
|
||||
import java.lang.invoke.VarHandle.AccessMode;
|
||||
|
@ -108,6 +109,7 @@ final class VarForm {
|
|||
}
|
||||
|
||||
@ForceInline
|
||||
@Hidden
|
||||
final MemberName getMemberName(int mode) {
|
||||
// Can be simplified by calling getMemberNameOrNull, but written in this
|
||||
// form to improve interpreter/coldpath performance.
|
||||
|
@ -115,7 +117,7 @@ final class VarForm {
|
|||
if (mn == null) {
|
||||
mn = resolveMemberName(mode);
|
||||
if (mn == null) {
|
||||
throw new UnsupportedOperationException();
|
||||
throw new UnsupportedOperationException(AccessMode.valueFromOrdinal(mode).methodName());
|
||||
}
|
||||
}
|
||||
return mn;
|
||||
|
@ -132,7 +134,7 @@ final class VarForm {
|
|||
|
||||
@DontInline
|
||||
MemberName resolveMemberName(int mode) {
|
||||
AccessMode value = AccessMode.values()[mode];
|
||||
AccessMode value = AccessMode.valueFromOrdinal(mode);
|
||||
String methodName = value.methodName();
|
||||
MethodType type = methodType_table[value.at.ordinal()].insertParameterTypes(0, VarHandle.class);
|
||||
return memberName_table[mode] = MethodHandles.Lookup.IMPL_LOOKUP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue