8364319: Move java.lang.constant.AsTypeMethodHandleDesc to jdk.internal

Reviewed-by: redestad
This commit is contained in:
Chen Liang 2025-08-14 21:41:14 +00:00
parent c5cbcac828
commit 8c363b3e3e
3 changed files with 16 additions and 10 deletions

View file

@ -44,7 +44,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import static java.lang.constant.DirectMethodHandleDesc.*;
import static java.lang.constant.DirectMethodHandleDesc.Kind.STATIC;
/**
@ -338,9 +337,6 @@ public final class ConstantDescs {
*/
public static final MethodTypeDesc MTD_void = MethodTypeDesc.of(CD_void);
static final DirectMethodHandleDesc MHD_METHODHANDLE_ASTYPE
= MethodHandleDesc.ofMethod(Kind.VIRTUAL, CD_MethodHandle, "asType",
MethodTypeDesc.of(CD_MethodHandle, CD_MethodType));
/**
* Returns a {@link MethodHandleDesc} corresponding to a bootstrap method for
* an {@code invokedynamic} callsite, which is a static method whose leading

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2025, 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
@ -28,6 +28,7 @@ import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import jdk.internal.constant.AsTypeMethodHandleDesc;
import jdk.internal.constant.DirectMethodHandleDescImpl;
import static java.lang.constant.ConstantDescs.CD_void;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2025, 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
@ -22,8 +22,13 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.lang.constant;
package jdk.internal.constant;
import java.lang.constant.ConstantDescs;
import java.lang.constant.DirectMethodHandleDesc;
import java.lang.constant.DynamicConstantDesc;
import java.lang.constant.MethodHandleDesc;
import java.lang.constant.MethodTypeDesc;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
@ -37,15 +42,19 @@ import static java.util.Objects.requireNonNull;
* {@link MethodHandle} constant that performs a {@link MethodHandle#asType(MethodType)}
* adaptation on another {@link MethodHandle}.
*/
final class AsTypeMethodHandleDesc extends DynamicConstantDesc<MethodHandle>
public final class AsTypeMethodHandleDesc extends DynamicConstantDesc<MethodHandle>
implements MethodHandleDesc {
private static final DirectMethodHandleDesc MHD_METHODHANDLE_ASTYPE
= MethodHandleDesc.ofMethod(DirectMethodHandleDesc.Kind.VIRTUAL, CD_MethodHandle, "asType",
MethodTypeDesc.of(CD_MethodHandle, ConstantDescs.CD_MethodType));
private final MethodHandleDesc underlying;
private final MethodTypeDesc type;
AsTypeMethodHandleDesc(MethodHandleDesc underlying, MethodTypeDesc type) {
public AsTypeMethodHandleDesc(MethodHandleDesc underlying, MethodTypeDesc type) {
super(BSM_INVOKE, ConstantDescs.DEFAULT_NAME, CD_MethodHandle,
ConstantDescs.MHD_METHODHANDLE_ASTYPE, underlying, type);
MHD_METHODHANDLE_ASTYPE, underlying, type);
this.underlying = requireNonNull(underlying);
this.type = requireNonNull(type);
}