Skip to content

Commit f2dce48

Browse files
committed
Add comments after top-level type declaration in the package declaration
JabRef/jabref-koppor#716 jabgui/src/main/java/org/jabref/gui/openoffice/Bootstrap.java (#976)
1 parent e528141 commit f2dce48

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/gr/uom/java/xmi/UMLModelASTReader.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)