aboutsummaryrefslogtreecommitdiff
path: root/src/delombok
diff options
context:
space:
mode:
Diffstat (limited to 'src/delombok')
-rw-r--r--src/delombok/lombok/delombok/PrettyCommentsPrinter.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/delombok/lombok/delombok/PrettyCommentsPrinter.java b/src/delombok/lombok/delombok/PrettyCommentsPrinter.java
index 16c06f50..57f0a1d8 100644
--- a/src/delombok/lombok/delombok/PrettyCommentsPrinter.java
+++ b/src/delombok/lombok/delombok/PrettyCommentsPrinter.java
@@ -337,7 +337,7 @@ public class PrettyCommentsPrinter extends JCTree.Visitor {
* Traversal methods
*************************************************************************/
- /** Exception to propogate IOException through visitXXX methods */
+ /** Exception to propagate IOException through visitXXX methods */
private static class UncheckedIOException extends Error {
static final long serialVersionUID = -4032692679158424751L;
UncheckedIOException(IOException e) {
@@ -657,6 +657,11 @@ public class PrettyCommentsPrinter extends JCTree.Visitor {
}
}
print(" ");
+ // <Added for delombok by Reinier Zwitserloot>
+ if ((tree.mods.flags & INTERFACE) != 0) {
+ removeImplicitModifiersForInterfaceMembers(tree.defs);
+ }
+ // </Added for delombok by Reinier Zwitserloot>
if ((tree.mods.flags & ENUM) != 0) {
printEnumBody(tree.defs);
} else {
@@ -668,6 +673,21 @@ public class PrettyCommentsPrinter extends JCTree.Visitor {
}
}
+ // Added for delombok by Reinier Zwitserloot
+ private void removeImplicitModifiersForInterfaceMembers(List<JCTree> defs) {
+ for (JCTree def :defs) {
+ if (def instanceof JCVariableDecl) {
+ ((JCVariableDecl) def).mods.flags &= ~(Flags.PUBLIC | Flags.STATIC | Flags.FINAL);
+ }
+ if (def instanceof JCMethodDecl) {
+ ((JCMethodDecl) def).mods.flags &= ~(Flags.PUBLIC | Flags.ABSTRACT);
+ }
+ if (def instanceof JCClassDecl) {
+ ((JCClassDecl) def).mods.flags &= ~(Flags.PUBLIC | Flags.STATIC);
+ }
+ }
+ }
+
public void visitMethodDef(JCMethodDecl tree) {
try {
boolean isConstructor = tree.name == tree.name.table.fromChars("<init>".toCharArray(), 0, 6);