Skip to content

Commit f99bdd4

Browse files
committed
HHH-18505 fix npe occurring while processing module descriptor
Signed-off-by: Gavin King <[email protected]>
1 parent 5d45d19 commit f99bdd4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tooling/metamodel-generator/src/main/java/org/hibernate/processor/HibernateProcessor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ private void processClasses(RoundEnvironment roundEnvironment) {
367367
try {
368368
if ( !included( element )
369369
|| hasAnnotation( element, Constants.EXCLUDE )
370-
|| hasAnnotation( context.getElementUtils().getPackageOf(element), Constants.EXCLUDE ) ) {
370+
|| hasPackageAnnotation( element, Constants.EXCLUDE ) ) {
371371
// skip it completely
372372
}
373373
else if ( isEntityOrEmbeddable( element ) ) {
@@ -420,6 +420,11 @@ else if ( element instanceof TypeElement ) {
420420
}
421421
}
422422

423+
private boolean hasPackageAnnotation(Element element, String annotation) {
424+
final PackageElement pack = context.getElementUtils().getPackageOf( element ); // null for module descriptor
425+
return pack != null && hasAnnotation( pack, annotation );
426+
}
427+
423428
private void createMetaModelClasses() {
424429

425430
for ( Metamodel aux : context.getMetaAuxiliaries() ) {

0 commit comments

Comments
 (0)