HHH-18505 fix npe occurring while processing module descriptor

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-08-20 13:08:37 +02:00
parent 5d45d19005
commit f99bdd4b8d

View File

@ -367,7 +367,7 @@ private void processClasses(RoundEnvironment roundEnvironment) {
try {
if ( !included( element )
|| hasAnnotation( element, Constants.EXCLUDE )
|| hasAnnotation( context.getElementUtils().getPackageOf(element), Constants.EXCLUDE ) ) {
|| hasPackageAnnotation( element, Constants.EXCLUDE ) ) {
// skip it completely
}
else if ( isEntityOrEmbeddable( element ) ) {
@ -420,6 +420,11 @@ else if ( element instanceof TypeElement ) {
}
}
private boolean hasPackageAnnotation(Element element, String annotation) {
final PackageElement pack = context.getElementUtils().getPackageOf( element ); // null for module descriptor
return pack != null && hasAnnotation( pack, annotation );
}
private void createMetaModelClasses() {
for ( Metamodel aux : context.getMetaAuxiliaries() ) {