8343693: [JVMCI] Override ModifiersProvider.isConcrete in ResolvedJavaType to be isArray() || !isAbstract()

Reviewed-by: never
This commit is contained in:
Yudi Zheng 2024-11-26 20:50:49 +00:00
parent 7ae6069ee8
commit 8da6435d4d
3 changed files with 20 additions and 3 deletions

View File

@ -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
@ -137,9 +137,11 @@ public interface ModifiersProvider {
}
/**
* 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();

View File

@ -402,4 +402,9 @@ public interface ResolvedJavaType extends JavaType, ModifiersProvider, Annotated
default ResolvedJavaField resolveField(UnresolvedJavaField unresolvedJavaField, ResolvedJavaType accessingClass) {
return null;
}
@Override
default boolean isConcrete() {
return isArray() || !isAbstract();
}
}

View File

@ -196,6 +196,16 @@ public class TestResolvedJavaType extends TypeUniverse {
}
}
@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