You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/08/09 13:38:19 UTC

[GitHub] [netbeans] Akshay-Gupta-Oracle opened a new pull request #2305: [NETBEANS-3693] Create only one instance of javac

Akshay-Gupta-Oracle opened a new pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305


   Use only one instance of javac to parse multiple files when multiple java files needed to be parsed at once when netbeans is running without nb-javac.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] Akshay-Gupta-Oracle commented on a change in pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
Akshay-Gupta-Oracle commented on a change in pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#discussion_r492842281



##########
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:
       This is handled above on the if-else conditions starting at line 440. If nb-javac is installed then sequential parsing will not be null and remaining code will be same as of before this PR.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] Akshay-Gupta-Oracle commented on a change in pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
Akshay-Gupta-Oracle commented on a change in pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#discussion_r492842281



##########
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:
       This is handled above on the if-else conditions starting at line 440. If nb-javac is installed then sequential parsing will not be null and remaining code will be same as of before this PR.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] lahodaj commented on pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
lahodaj commented on pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#issuecomment-707569975


   Looks good to me.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] lkishalmi merged pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
lkishalmi merged pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] lahodaj commented on a change in pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] Akshay-Gupta-Oracle commented on a change in pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
Akshay-Gupta-Oracle commented on a change in pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#discussion_r502961349



##########
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:
       You're correct @jlahoda I've removed the oninstance variable form second if. and added (sequentialParsing != null || oneInstanceJava) instead. 
   Now this PR is final




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] Akshay-Gupta-Oracle closed pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
Akshay-Gupta-Oracle closed pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] lahodaj commented on a change in pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
lahodaj commented on a change in pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#discussion_r492639776



##########
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 suspect this will disable "sequential" processing when nb-javac is installed, right? Or do I miss something here?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] arvindaprameya removed a comment on pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
arvindaprameya removed a comment on pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#issuecomment-707525447


   Approved, can go  for 12.2


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] Akshay-Gupta-Oracle commented on a change in pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
Akshay-Gupta-Oracle commented on a change in pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#discussion_r502961349



##########
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:
       You're correct @jlahoda removed the oninstance variable form second if.
   Now this PR is final




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] arvindaprameya commented on pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
arvindaprameya commented on pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#issuecomment-697165059


   Approved, thanks for doing this Akshay.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] arvindaprameya commented on pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
arvindaprameya commented on pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#issuecomment-707525447


   Approved, can go  for 12.2


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] lahodaj commented on a change in pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
lahodaj commented on a change in pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#discussion_r492639776



##########
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 suspect this will disable "sequential" processing when nb-javac is installed, right? Or do I miss something here?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] Akshay-Gupta-Oracle commented on a change in pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
Akshay-Gupta-Oracle commented on a change in pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#discussion_r502961349



##########
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:
       You're correct @jlahoda I've removed the oninstance variable form second if.
   Now this PR is final




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] Akshay-Gupta-Oracle commented on a change in pull request #2305: [NETBEANS-3693] Create only one instance of javac

Posted by GitBox <gi...@apache.org>.
Akshay-Gupta-Oracle commented on a change in pull request #2305:
URL: https://github.com/apache/netbeans/pull/2305#discussion_r495721210



##########
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:
       Is this OK @jlahoda, can this PR be merged now??




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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