Skip to content

Commit

Permalink
fix(comment): fix bug in the usage of the new flag (closes #721)
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardPaligot authored and monperrus committed Jun 24, 2016
1 parent e34b6c4 commit 3095468
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ public <T> void visitCtSuperAccess(CtSuperAccess<T> 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()) {
Expand Down Expand Up @@ -1613,15 +1613,15 @@ 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);
writeln().writeTabs();
}

private void printComment(List<CtComment> comments) {
if (!env.isGenerateJavadoc() || !env.isCommentsEnabled() || comments == null) {
if (!(env.isGenerateJavadoc() || env.isCommentsEnabled()) || comments == null) {
return;
}
for (CtComment comment : comments) {
Expand All @@ -1642,7 +1642,7 @@ private void printComment(CtElement e, CommentOffset offset) {

private List<CtComment> getComments(CtElement e, CommentOffset offset) {
List<CtComment> commentsToPrint = new ArrayList<>();
if (!env.isGenerateJavadoc() || !env.isCommentsEnabled() || e == null) {
if (!(env.isGenerateJavadoc() || env.isCommentsEnabled()) || e == null) {
return commentsToPrint;
}
for (CtComment comment : e.getComments()) {
Expand Down
1 change: 0 additions & 1 deletion src/test/java/spoon/test/comment/CommentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3095468

Please sign in to comment.