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

8071693: Introspector ignores default interface methods #13544

Closed
wants to merge 13 commits into from
Closed
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -35,23 +35,22 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.sun.beans.TypeResolver;
import com.sun.beans.finder.MethodFinder;

final class MethodInfo {

static final HashSet<Class<?>> IGNORABLE_INTERFACES = new HashSet<>(6);
static {
IGNORABLE_INTERFACES.add(AutoCloseable.class);
IGNORABLE_INTERFACES.add(Cloneable.class);
IGNORABLE_INTERFACES.add(Closeable.class);
IGNORABLE_INTERFACES.add(Comparable.class);
IGNORABLE_INTERFACES.add(Externalizable.class);
IGNORABLE_INTERFACES.add(Serializable.class);
}
static final Set<Class<?>> IGNORABLE_INTERFACES = Set.of(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. Why only this specific interfaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This a list of commonly implemented interfaces that don't need to be inspected because they are "known empty". This list is inspired by Spring's ClassUtils. Happy to add any others that deserve to be in there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that serializable is commonly implemented, this may be a worthwhile optimisation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should have some explanation comment, about why this interfaces are ignored and how they were chosen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ac90a10.

AutoCloseable.class,
Cloneable.class,
Closeable.class,
Comparable.class,
Externalizable.class,
Serializable.class
);

final Method method;
final Class<?> type;