aboutsummaryrefslogtreecommitdiff
path: root/src/delombok/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2010-11-06 21:17:44 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2010-11-06 21:17:44 +0100
commit384bff18c9ff93f001aa8a938ba721914e101c0d (patch)
treeb1e7557ea47cde2f7c8dbc742fcd22be7dba593c /src/delombok/lombok
parentfcf39d88b489d03bc93cecf0e98e7ffbb7a162aa (diff)
downloadlombok-384bff18c9ff93f001aa8a938ba721914e101c0d.tar.gz
lombok-384bff18c9ff93f001aa8a938ba721914e101c0d.tar.bz2
lombok-384bff18c9ff93f001aa8a938ba721914e101c0d.zip
implicit flags in interfaces (all methods become public abstract, etc) are now no longer printed in delombok
Diffstat (limited to 'src/delombok/lombok')
-rw-r--r--src/delombok/lombok/delombok/PrettyCommentsPrinter.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/delombok/lombok/delombok/PrettyCommentsPrinter.java b/src/delombok/lombok/delombok/PrettyCommentsPrinter.java
index 16c06f50..febb4b7f 100644
--- a/src/delombok/lombok/delombok/PrettyCommentsPrinter.java
+++ b/src/delombok/lombok/delombok/PrettyCommentsPrinter.java
@@ -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);