Skip to content
Closed
Show file tree
Hide file tree
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
Expand Up @@ -1148,7 +1148,8 @@ ResolvedJavaMethod[] getDeclaredConstructors(HotSpotResolvedObjectTypeImpl klass
native ResolvedJavaMethod[] getDeclaredConstructors(HotSpotResolvedObjectTypeImpl klass, long klassPointer);

/**
* Gets the {@link ResolvedJavaMethod}s for all non-overpass and non-initializer methods of {@code klass}.
* Gets the {@link ResolvedJavaMethod}s for all non-overpass and non-initializer
* methods of {@code klass}.
*/
ResolvedJavaMethod[] getDeclaredMethods(HotSpotResolvedObjectTypeImpl klass) {
return getDeclaredMethods(klass, klass.getKlassPointer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,9 @@ public boolean isDefault() {
}

/*
* Currently in hotspot a method can either be a "normal" or an "overpass" method.
* Overpass methods are instance methods which are created when otherwise a valid candidate
* for method resolution would not be found.
* Currently in hotspot a method can either be a "normal" or an "overpass"
* method. Overpass methods are instance methods which are created when
* otherwise a valid candidate for method resolution would not be found.
*/
@Override
public boolean isDeclared() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,11 @@ default ResolvedJavaMethod[] getDeclaredMethods(boolean forceLink) {
}

/**
* Returns a list containing all methods present within this type. This list can include
* methods implicitly created and used by the VM that are not present in {@link #getDeclaredMethods}.
* The returned List is unmodifiable; calls to any mutator method
* will always cause {@code UnsupportedOperationException} to be thrown.
* Returns a list containing all methods present within this type. This list can
* include methods implicitly created and used by the VM that are not present in
* {@link #getDeclaredMethods}. The returned List is unmodifiable; calls to any
* mutator method will always cause {@code UnsupportedOperationException} to be
* thrown.
*
* @param forceLink if {@code true}, forces this type to be {@link #link linked}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1024,12 +1024,10 @@ public void getAllMethodsTest() {
for (Class<?> c : classes) {
ResolvedJavaType type = metaAccess.lookupJavaType(c);
Set<ResolvedJavaMethod> allMethods = new HashSet<>(type.getAllMethods(true));
boolean included = Arrays.stream(type.getDeclaredMethods()).allMatch(m -> allMethods.contains(m));
included = included && Arrays.stream(type.getDeclaredConstructors()).allMatch(m -> allMethods.contains(m));
if (included && type.getClassInitializer() != null) {
included = allMethods.contains(type.getClassInitializer());
}
assertTrue(included);
Stream<ResolvedJavaMethod> allKnownMethods = Stream.concat(Arrays.stream(type.getDeclaredMethods()), Arrays.stream(type.getDeclaredConstructors()));
allKnownMethods = Stream.concat(allKnownMethods, Stream.ofNullable(type.getClassInitializer()));
List<ResolvedJavaMethod> missingMethods = allKnownMethods.filter(m -> !allMethods.contains(m)).toList();
assertTrue(missingMethods.toString(), missingMethods.isEmpty());
}
}

Expand Down