You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jl...@apache.org on 2019/04/01 06:29:26 UTC

[incubator-netbeans] branch master updated: When multiple sources are needed to create a model of a single file, only attribute the requested file, not all its dependencies (enter should be enough for the dependencies)

This is an automated email from the ASF dual-hosted git repository.

jlahoda pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 5cc3c20  When multiple sources are needed to create a model of a single file, only attribute the requested file, not all its dependencies (enter should be enough for the dependencies)
5cc3c20 is described below

commit 5cc3c2085365a8face43f06d398085b22d7baf22
Author: Jan Lahoda <la...@gmail.com>
AuthorDate: Mon Apr 1 08:29:18 2019 +0200

    When multiple sources are needed to create a model of a single file, only attribute the requested file, not all its dependencies (enter should be enough for the dependencies)
---
 .../netbeans/modules/java/source/parsing/JavacParser.java | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/java/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java b/java/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
index 61b4306..b6e8017 100644
--- a/java/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
+++ b/java/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
@@ -25,6 +25,9 @@ import com.sun.source.util.JavacTask;
 import com.sun.source.util.Trees;
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.comp.AttrContext;
+import com.sun.tools.javac.comp.Env;
+import com.sun.tools.javac.main.JavaCompiler;
 import com.sun.tools.javac.util.Abort;
 
 import org.netbeans.lib.nbjavac.services.CancelAbort;
@@ -631,7 +634,17 @@ public class JavacParser extends Parser {
                 }
                 long start = System.currentTimeMillis ();
                 JavacTaskImpl jti = currentInfo.getJavacTask();
-                PostFlowAnalysis.analyze(jti.analyze(), jti.getContext());
+                JavaCompiler compiler = JavaCompiler.instance(jti.getContext());
+                List<Env<AttrContext>> savedTodo = new ArrayList<>(compiler.todo);
+                try {
+                    compiler.todo.retainFiles(Collections.singletonList(currentInfo.jfo));
+                    savedTodo.removeAll(compiler.todo);
+                    PostFlowAnalysis.analyze(jti.analyze(), jti.getContext());
+                } finally {
+                    for (Env<AttrContext> env : savedTodo) {
+                        compiler.todo.offer(env);
+                    }
+                }
                 currentPhase = Phase.RESOLVED;
                 long end = System.currentTimeMillis ();
                 logTime(currentInfo.getFileObject(),currentPhase,(end-start));


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

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