Skip to content

Commit

Permalink
Do not log position for elements without a position in smpl
Browse files Browse the repository at this point in the history
  • Loading branch information
I-Al-Istannen committed Aug 28, 2023
1 parent fa8b316 commit 12a258a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spoon-smpl/src/main/java/spoon/smpl/SmPLMethodCFG.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ private void replace(CtElement e) {
* @param e Element about to be replaced
*/
private void logReplacementWarning(CtElement e) {
if (!e.getPosition().isValidPosition()) {
String code = e.toString();
LoggerFactory.getLogger("spoon-smpl")
.warn("Unsupported element excluded from control flow graph at unknown location: "
+ e.getClass().getSimpleName()
+ code.substring(0, Math.min(40, code.length())));
return;
}
String file = Optional.ofNullable(e.getPosition())
.map(x -> x.getFile())
.map(x -> x.getName())
Expand Down

0 comments on commit 12a258a

Please sign in to comment.