@@ -339,7 +339,7 @@ private static InitializationBlock createInitializationBlock(InitializerDeclarat
339
339
return throwStmt .asThrowStmt ().getExpression ().toString ();
340
340
}
341
341
}).collect (Collectors .toList ()));
342
- initializationBlock .setCode (LexicalPreservingPrinter .setup (initializerDeclaration .getBody ()). toString ( ));
342
+ initializationBlock .setCode (LexicalPreservingPrinter .print (initializerDeclaration .getBody ()));
343
343
initializationBlock .setStartLine (
344
344
initializerDeclaration .getRange ().isPresent () ? initializerDeclaration .getRange ().get ().begin .line
345
345
: -1 );
@@ -563,7 +563,7 @@ private static Pair<String, Callable> processCallableDeclaration(CallableDeclara
563
563
callableNode .setStartLine (callableDecl .getRange ().isPresent () ? callableDecl .getRange ().get ().begin .line : -1 );
564
564
callableNode .setEndLine (callableDecl .getRange ().isPresent () ? callableDecl .getRange ().get ().end .line : -1 );
565
565
callableNode .setReferencedTypes (getReferencedTypes (body ));
566
- callableNode .setCode (body .isPresent () ? LexicalPreservingPrinter .setup (body .get ()). toString ( ) : "" );
566
+ callableNode .setCode (body .isPresent () ? LexicalPreservingPrinter .print (body .get ()) : "" );
567
567
callableNode .setCodeStartLine (body .isPresent ()? body .get ().getBegin ().get ().line : -1 );
568
568
569
569
callableNode .setAccessedFields (getAccessedFields (body , classFields , typeName ));
@@ -1090,7 +1090,7 @@ public static Pair<Map<String, JavaCompilationUnit>, Map<String, List<Problem>>>
1090
1090
for (SourceRoot sourceRoot : projectRoot .getSourceRoots ()) {
1091
1091
for (ParseResult <CompilationUnit > parseResult : sourceRoot .tryToParse ()) {
1092
1092
if (parseResult .isSuccessful ()) {
1093
- CompilationUnit compilationUnit = parseResult .getResult ().get ();
1093
+ CompilationUnit compilationUnit = LexicalPreservingPrinter . setup ( parseResult .getResult ().get () );
1094
1094
symbolTable .put (compilationUnit .getStorage ().get ().getPath ().toString (),
1095
1095
processCompilationUnit (compilationUnit ));
1096
1096
} else {
@@ -1116,7 +1116,7 @@ public static Pair<Map<String, JavaCompilationUnit>, Map<String, List<Problem>>>
1116
1116
JavaParser javaParser = new JavaParser (parserConfiguration );
1117
1117
ParseResult <CompilationUnit > parseResult = javaParser .parse (code );
1118
1118
if (parseResult .isSuccessful ()) {
1119
- CompilationUnit compilationUnit = parseResult .getResult ().get ();
1119
+ CompilationUnit compilationUnit = LexicalPreservingPrinter . setup ( parseResult .getResult ().get () );
1120
1120
Log .debug ("Successfully parsed code. Now processing compilation unit" );
1121
1121
symbolTable .put ("<pseudo-path>" , processCompilationUnit (compilationUnit ));
1122
1122
} else {
@@ -1158,7 +1158,7 @@ public static Pair<Map<String, JavaCompilationUnit>, Map<String, List<Problem>>>
1158
1158
for (Path javaFilePath : javaFilePaths ) {
1159
1159
ParseResult <CompilationUnit > parseResult = javaParser .parse (javaFilePath );
1160
1160
if (parseResult .isSuccessful ()) {
1161
- CompilationUnit compilationUnit = parseResult .getResult ().get ();
1161
+ CompilationUnit compilationUnit = LexicalPreservingPrinter . setup ( parseResult .getResult ().get () );
1162
1162
System .out .println ("Successfully parsed file: " + javaFilePath .toString ());
1163
1163
symbolTable .put (compilationUnit .getStorage ().get ().getPath ().toString (),
1164
1164
processCompilationUnit (compilationUnit ));
0 commit comments