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
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.jpamodelgen;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -67,6 +67,7 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
public static final String ADD_SUPPRESS_WARNINGS_ANNOTATION = "addSuppressWarningsAnnotation";

private static final Boolean ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS = Boolean.FALSE;
private static final List<String> HANDLED_ELEMENT_KINDS = Arrays.asList("CLASS", "RECORD");

private Context context;

Expand Down Expand Up @@ -221,7 +222,7 @@ private boolean isJPAEntity(Element element) {
private void handleRootElementAnnotationMirrors(final Element element) {
List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors();
for ( AnnotationMirror mirror : annotationMirrors ) {
if ( !ElementKind.CLASS.equals( element.getKind() ) ) {
if ( !HANDLED_ELEMENT_KINDS.contains( element.getKind().name() ) ) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package org.hibernate.jpamodelgen.annotation;

import java.util.Arrays;
import java.util.List;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
Expand Down Expand Up @@ -288,6 +289,8 @@ private String getFullyQualifiedClassNameOfTargetEntity(AnnotationMirror mirror,
*/
class BasicAttributeVisitor extends SimpleTypeVisitor6<Boolean, Element> {

private static final List<String> HANDLED_ELEMENT_KINDS = Arrays.asList("CLASS", "INTERFACE", "RECORD");

private final Context context;

public BasicAttributeVisitor(Context context) {
Expand All @@ -313,7 +316,7 @@ public Boolean visitDeclared(DeclaredType declaredType, Element element) {
return Boolean.TRUE;
}

if ( ElementKind.CLASS.equals( element.getKind() ) || ElementKind.INTERFACE.equals( element.getKind() ) ) {
if ( HANDLED_ELEMENT_KINDS.contains( element.getKind().name() ) ) {
TypeElement typeElement = ( (TypeElement) element );
String typeName = typeElement.getQualifiedName().toString();
if ( Constants.BASIC_TYPES.contains( typeName ) ) {
Expand Down