-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
345 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package de.lomboker.lib; | ||
|
||
import com.github.javaparser.ast.body.MethodDeclaration; | ||
import com.github.javaparser.ast.comments.Comment; | ||
import com.github.javaparser.ast.expr.Expression; | ||
import com.github.javaparser.ast.expr.MethodCallExpr; | ||
import com.github.javaparser.ast.expr.StringLiteralExpr; | ||
import com.github.javaparser.ast.stmt.ExpressionStmt; | ||
|
||
import java.util.Optional; | ||
|
||
public class Fuzzy { | ||
|
||
protected static void markWithStringLiteral(MethodDeclaration md, String message) { | ||
Expression info = new StringLiteralExpr(message); | ||
Expression e2 = new MethodCallExpr(info, "trim"); | ||
|
||
//it is callers responsibility to ensure that there is a body | ||
md.getBody().get().getStatements().add(new ExpressionStmt(e2)); | ||
//md.getBody().get().getStatements().add(0, new ExpressionStmt(e2)); | ||
//inserting in first place messes up indentation | ||
} | ||
|
||
/* Discontinued: I was unable to find a way to add comments on their own line | ||
* so they can be easily be removed | ||
* and coexist with existing comments */ | ||
@Deprecated | ||
private static MethodDeclaration addTodo(MethodDeclaration md, String message) { | ||
Optional<Comment> c = md.getComment(); | ||
if (c.isEmpty()) { | ||
md.setLineComment(message); | ||
} else { | ||
String content = c.get().getContent(); | ||
if (!content.isEmpty()) | ||
content += "\n "; | ||
c.get().setContent(content + message); | ||
} | ||
return md; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.