Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Deconstructor <: MemberPattern <: Executable #9

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/java.base/share/classes/java/lang/Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,27 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectStreamField;
import java.lang.reflect.AccessFlag;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.AnnotatedType;
import java.lang.reflect.AccessFlag;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Deconstructor;
import java.lang.reflect.PatternBinding;
import java.lang.reflect.Executable;
import java.lang.reflect.Field;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.GenericDeclaration;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Member;
import java.lang.constant.Constable;
import java.lang.reflect.MemberPattern;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.PatternBinding;
import java.lang.reflect.Proxy;
import java.lang.reflect.RecordComponent;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.constant.Constable;
import java.net.URL;
import java.nio.ByteBuffer;
import java.security.AccessController;
Expand All @@ -88,7 +89,6 @@
import jdk.internal.access.SharedSecrets;
import jdk.internal.classfile.impl.BoundAttribute;
import jdk.internal.constant.ConstantUtils;
import jdk.internal.javac.PreviewFeature;
import jdk.internal.loader.BootLoader;
import jdk.internal.loader.BuiltinClassLoader;
import jdk.internal.misc.Unsafe;
Expand All @@ -113,7 +113,6 @@
import sun.reflect.annotation.*;
import sun.reflect.misc.ReflectUtil;

import static java.lang.ClassLoader.getPlatformClassLoader;
import static java.lang.constant.ConstantDescs.CD_void;

/**
Expand Down Expand Up @@ -2343,7 +2342,7 @@ private Method[] filterOutDeconstructorsFromMethods(Method[] in) {
* @see #getDeclaredDeconstructors()
* @since 23
*/
public Deconstructor<?> [] getDeconstructors() throws SecurityException {
public Deconstructor<?>[] getDeconstructors() throws SecurityException {
return getDeclaredDeconstructors0(EMPTY_CLASS_ARRAY, Member.PUBLIC);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@
import java.lang.invoke.LambdaForm.BasicType;
import java.lang.invoke.MethodHandleImpl.Intrinsic;
import java.lang.reflect.Constructor;
import java.lang.reflect.Deconstructor;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.MemberPattern;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.PatternBinding;
import java.nio.ByteOrder;
import java.security.ProtectionDomain;
import java.util.ArrayList;
Expand All @@ -71,8 +70,6 @@
import static java.lang.invoke.MethodHandleStatics.newInternalError;
import static java.lang.invoke.MethodType.methodType;

import java.lang.runtime.Carriers;

/**
* This class consists exclusively of static methods that operate on or return
* method handles. They fall into several categories:
Expand Down Expand Up @@ -3519,7 +3516,7 @@ public MethodHandle unreflectConstructor(Constructor<?> c) throws IllegalAccessE
* @throws IllegalAccessException if access checking fails
* @throws NullPointerException if the argument is null
*/
public MethodHandle unreflectDeconstructor(Deconstructor<?> d) throws IllegalAccessException {
public MethodHandle unreflectDeconstructor(MemberPattern<?> d) throws IllegalAccessException {
biboudis marked this conversation as resolved.
Show resolved Hide resolved
Class<?> ownerType = d.getDeclaringClass(); // Implicit null-check of d
try {
return unreflect(
Expand Down
Loading
Loading