@@ -470,6 +470,9 @@ private void processRecordDeclaration(CompilationUnit cu, RecordDeclaration reco
470470 if (comment .getLocationInfo ().before (locationInfo ) && !locationInfo .nextLine (comment .getLocationInfo ())) {
471471 umlClass .getPackageDeclarationComments ().add (comment );
472472 }
473+ else if (locationInfo .getEndLine () < comment .getLocationInfo ().getStartLine ()) {
474+ umlClass .getPackageDeclarationComments ().add (comment );
475+ }
473476 }
474477 comments .removeAll (umlClass .getPackageDeclarationComments ());
475478 }
@@ -573,6 +576,9 @@ private void processAnnotationTypeDeclaration(CompilationUnit cu, AnnotationType
573576 if (comment .getLocationInfo ().before (locationInfo ) && !locationInfo .nextLine (comment .getLocationInfo ())) {
574577 umlClass .getPackageDeclarationComments ().add (comment );
575578 }
579+ else if (locationInfo .getEndLine () < comment .getLocationInfo ().getStartLine ()) {
580+ umlClass .getPackageDeclarationComments ().add (comment );
581+ }
576582 }
577583 comments .removeAll (umlClass .getPackageDeclarationComments ());
578584 }
@@ -633,6 +639,9 @@ private void processEnumDeclaration(CompilationUnit cu, EnumDeclaration enumDecl
633639 if (comment .getLocationInfo ().before (locationInfo ) && !locationInfo .nextLine (comment .getLocationInfo ())) {
634640 umlClass .getPackageDeclarationComments ().add (comment );
635641 }
642+ else if (locationInfo .getEndLine () < comment .getLocationInfo ().getStartLine ()) {
643+ umlClass .getPackageDeclarationComments ().add (comment );
644+ }
636645 }
637646 comments .removeAll (umlClass .getPackageDeclarationComments ());
638647 }
@@ -764,6 +773,9 @@ private void processTypeDeclaration(CompilationUnit cu, TypeDeclaration typeDecl
764773 if (comment .getLocationInfo ().before (locationInfo ) && !locationInfo .nextLine (comment .getLocationInfo ())) {
765774 umlClass .getPackageDeclarationComments ().add (comment );
766775 }
776+ else if (locationInfo .getEndLine () < comment .getLocationInfo ().getStartLine ()) {
777+ umlClass .getPackageDeclarationComments ().add (comment );
778+ }
767779 }
768780 comments .removeAll (umlClass .getPackageDeclarationComments ());
769781 }
0 commit comments