From 848d782ab39f6d7936c71013e9e84ddc79be84c4 Mon Sep 17 00:00:00 2001 From: GerardPaligot Date: Fri, 24 Jun 2016 16:35:19 +0200 Subject: [PATCH] fix(comment): Allows usage of the new flag only. Closes #721 --- .../spoon/reflect/visitor/DefaultJavaPrettyPrinter.java | 8 ++++---- src/test/java/spoon/test/comment/CommentTest.java | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java index 95fb37dd441..deffc87fa9e 100644 --- a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java +++ b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java @@ -1126,7 +1126,7 @@ public void visitCtSuperAccess(CtSuperAccess f) { @Override public void visitCtComment(CtComment comment) { - if (!env.isGenerateJavadoc() && !env.isCommentsEnabled() && context.elementStack.size() > 1) { + if (!(env.isGenerateJavadoc() || env.isCommentsEnabled()) && context.elementStack.size() > 1) { return; } switch (comment.getCommentType()) { @@ -1613,7 +1613,7 @@ public DefaultJavaPrettyPrinter writeThrowsClause(CtExecutable e) { } private void printComment(CtComment comment) { - if (!env.isGenerateJavadoc() || !env.isCommentsEnabled() || comment == null) { + if (!(env.isGenerateJavadoc() || env.isCommentsEnabled()) || comment == null) { return; } scan(comment); @@ -1621,7 +1621,7 @@ private void printComment(CtComment comment) { } private void printComment(List comments) { - if (!env.isGenerateJavadoc() || !env.isCommentsEnabled() || comments == null) { + if (!(env.isGenerateJavadoc() || env.isCommentsEnabled()) || comments == null) { return; } for (CtComment comment : comments) { @@ -1642,7 +1642,7 @@ private void printComment(CtElement e, CommentOffset offset) { private List getComments(CtElement e, CommentOffset offset) { List commentsToPrint = new ArrayList<>(); - if (!env.isGenerateJavadoc() || !env.isCommentsEnabled() || e == null) { + if (!(env.isGenerateJavadoc() || env.isCommentsEnabled()) || e == null) { return commentsToPrint; } for (CtComment comment : e.getComments()) { diff --git a/src/test/java/spoon/test/comment/CommentTest.java b/src/test/java/spoon/test/comment/CommentTest.java index 9989b685960..e11499e54c6 100644 --- a/src/test/java/spoon/test/comment/CommentTest.java +++ b/src/test/java/spoon/test/comment/CommentTest.java @@ -42,7 +42,6 @@ private Factory getSpoonFactory() { launcher.run(new String[] { "-i", "./src/test/java/spoon/test/comment/testclasses/", "-o", "./target/spooned/", - "-j", "-c" }); return launcher.getFactory();