Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2024, 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
Expand Down Expand Up @@ -137,9 +137,11 @@ default boolean isAbstract() {
}

/**
* Checks that the method is concrete and not abstract.
* Returns true if this element is a method with a concrete implementation, or a type that can
* be instantiated. For example, array types return true for both {@link #isAbstract()} and this
* method.
*
* @return whether the method is a concrete method
* @see ResolvedJavaType#isConcrete()
*/
default boolean isConcrete() {
return !isAbstract();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,9 @@ default ResolvedJavaType lookupType(UnresolvedJavaType unresolvedJavaType, boole
default ResolvedJavaField resolveField(UnresolvedJavaField unresolvedJavaField, ResolvedJavaType accessingClass) {
return null;
}

@Override
default boolean isConcrete() {
return isArray() || !isAbstract();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,16 @@ public void isArrayTest() {
}
}

@Test
public void isConcreteTest() {
for (Class<?> c : classes) {
ResolvedJavaType type = metaAccess.lookupJavaType(c);
boolean expected = c.isArray() || !isAbstract(c.getModifiers());
boolean actual = type.isConcrete();
assertEquals(expected, actual);
}
}

@Test
public void lambdaInternalNameTest() {
// Verify that the last dot in lambda types is properly handled when transitioning from
Expand Down