HHH-16261 - Avoid explicit use of ElementKind.RECORD to make code compilable under JDK 11

This commit is contained in:
Cedomir Igaly 2023-04-02 13:48:54 +02:00 committed by Christian Beikov
parent bb3c647252
commit 2246f4225c
2 changed files with 3 additions and 2 deletions

View File

@ -223,7 +223,7 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
private void handleRootElementAnnotationMirrors(final Element element) { private void handleRootElementAnnotationMirrors(final Element element) {
List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors(); List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors();
for ( AnnotationMirror mirror : annotationMirrors ) { for ( AnnotationMirror mirror : annotationMirrors ) {
if ( !ElementKind.CLASS.equals( element.getKind() ) && !ElementKind.RECORD.equals( element.getKind() ) ) { if ( !element.getKind().isClass() || ElementKind.ENUM.equals( element.getKind() ) ) {
continue; continue;
} }

View File

@ -316,7 +316,8 @@ class BasicAttributeVisitor extends SimpleTypeVisitor6<Boolean, Element> {
return Boolean.TRUE; return Boolean.TRUE;
} }
if ( ElementKind.CLASS.equals( element.getKind() ) || ElementKind.INTERFACE.equals( element.getKind() ) || ElementKind.RECORD.equals( element.getKind() ) ) { if ( ( element.getKind().isClass() && !ElementKind.ENUM.equals( element.getKind() ) ) ||
ElementKind.INTERFACE.equals( element.getKind() ) ) {
TypeElement typeElement = ( (TypeElement) element ); TypeElement typeElement = ( (TypeElement) element );
String typeName = typeElement.getQualifiedName().toString(); String typeName = typeElement.getQualifiedName().toString();
if ( Constants.BASIC_TYPES.contains( typeName ) ) { if ( Constants.BASIC_TYPES.contains( typeName ) ) {