lahodaj commented on a change in pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#discussion_r496585100



##########
File path: 
java/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
##########
@@ -424,9 +434,28 @@ private void parseImpl(
                     break;
                 default:
                     init (snapshot, task, false);
+                    DiagnosticListener<JavaFileObject> diagnosticListener;
+                    JavacTaskImpl javacTask;
+                    boolean 
oneInstanceJava=Boolean.getBoolean("java.enable.single.javac") && 
this.snapshotSize <= this.MAX_FILE_SIZE;
+                    if (sequentialParsing == null && ciImpl == null && 
oneInstanceJava) {
+                        List<JavaFileObject> jfos = new ArrayList<>();
+                        for (Snapshot s : snapshots) {
+                            
jfos.add(FileObjects.sourceFileObject(s.getSource().getFileObject(), root, 
JavaFileFilterQuery.getFilter(s.getSource().getFileObject()), s.getText()));
+                        }
+                        diagnosticListener = new 
CompilationInfoImpl.DiagnosticListenerImpl(this.root, jfos.get(0), this.cpInfo);
+                        javacTask = JavacParser.createJavacTask(this.file, 
jfos, this.root, this.cpInfo,
+                                this, diagnosticListener, false);
+                    } else if (ciImpl != null &&  oneInstanceJava) {
+                        diagnosticListener = ciImpl.getDiagnosticListener();
+                        javacTask = ciImpl.getJavacTask();
+                        oldParsedTrees=ciImpl.getParsedTrees();
+                    } else {
+                        diagnosticListener = null;
+                        javacTask = null;
+                    }
                     ciImpl = createCurrentInfo(this, file, root, snapshot,
-                        sequentialParsing == null || ciImpl == null ? null : 
ciImpl.getJavacTask(),
-                        sequentialParsing == null || ciImpl == null ? null : 
ciImpl.getDiagnosticListener());
+                        javacTask,

Review comment:
       I note that the if on line 448 is also checking oneInstanceJava. So it 
seems to me that is sequentialParsing != null and oneInstanceJava == false, the 
it will always fall to the else section and go file-by-file. Or what do I miss?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to