diff --git a/java/ql/lib/semmle/code/java/Expr.qll b/java/ql/lib/semmle/code/java/Expr.qll index 0ac6d83e7fe..9179801d743 100644 --- a/java/ql/lib/semmle/code/java/Expr.qll +++ b/java/ql/lib/semmle/code/java/Expr.qll @@ -1244,7 +1244,11 @@ class ClassInstanceExpr extends Expr, ConstructorCall, @classinstancexpr { override Stmt getEnclosingStmt() { result = Expr.super.getEnclosingStmt() } /** Gets a printable representation of this expression. */ - override string toString() { result = "new " + this.getConstructor().getName() + "(...)" } + override string toString() { + result = "new " + this.getConstructor().getName() + "(...)" + or + not exists(this.getConstructor()) and result = "" + } override string getAPrimaryQlClass() { result = "ClassInstanceExpr" } }