http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/src/org/netbeans/modules/java/source/ElementUtils.java
----------------------------------------------------------------------
diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/ElementUtils.java 
b/java.source.base/src/org/netbeans/modules/java/source/ElementUtils.java
new file mode 100644
index 0000000..757bc57
--- /dev/null
+++ b/java.source.base/src/org/netbeans/modules/java/source/ElementUtils.java
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.source;
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.code.Kinds.Kind;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.CompletionFailure;
+import com.sun.tools.javac.code.Symbol.ModuleSymbol;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
+import java.util.Set;
+import javax.lang.model.element.ModuleElement;
+import javax.lang.model.element.TypeElement;
+import org.netbeans.api.java.source.CompilationInfo;
+
+/** TODO
+ *
+ * @author lahvac
+ */
+public class ElementUtils {
+
+    public static TypeElement getTypeElementByBinaryName(CompilationInfo info, 
String name) {
+        return 
getTypeElementByBinaryName(CompilationInfoAccessor.getInstance().getJavacTask(info),
 name);
+    }
+
+    public static TypeElement getTypeElementByBinaryName(JavacTask task, 
String name) {
+        Set<? extends ModuleElement> allModules = 
task.getElements().getAllModuleElements();
+        
+        if (allModules.isEmpty()) {
+            Context ctx = ((JavacTaskImpl) task).getContext();
+            Symtab syms = Symtab.instance(ctx);
+            
+            return getTypeElementByBinaryName(task, syms.noModule, name);
+        }
+        
+        TypeElement result = null;
+        
+        for (ModuleElement me : allModules) {
+            TypeElement found = getTypeElementByBinaryName(task, me, name);
+            
+            if (found != null) {
+                if (result != null) return null;
+                result = found;
+            }
+        }
+        
+        return result;
+    }
+
+    public static TypeElement getTypeElementByBinaryName(CompilationInfo info, 
ModuleElement mod, String name) {
+        return 
getTypeElementByBinaryName(CompilationInfoAccessor.getInstance().getJavacTask(info),
 mod, name);
+    }
+
+    public static TypeElement getTypeElementByBinaryName(JavacTask task, 
ModuleElement mod, String name) {
+        Context ctx = ((JavacTaskImpl) task).getContext();
+        Names names = Names.instance(ctx);
+        Symtab syms = Symtab.instance(ctx);
+        final Name wrappedName = names.fromString(name);
+        ClassSymbol clazz = syms.enterClass((ModuleSymbol) mod, wrappedName);
+        
+        try {
+            clazz.complete();
+            
+            if (clazz.kind == Kind.TYP &&
+                clazz.flatName() == wrappedName) {
+                return clazz;
+            }
+        } catch (CompletionFailure cf) {
+        }
+
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/src/org/netbeans/modules/java/source/JavaSourceUtilImpl.java
----------------------------------------------------------------------
diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/JavaSourceUtilImpl.java 
b/java.source.base/src/org/netbeans/modules/java/source/JavaSourceUtilImpl.java
index 2f9cdcc..cc981dd 100644
--- 
a/java.source.base/src/org/netbeans/modules/java/source/JavaSourceUtilImpl.java
+++ 
b/java.source.base/src/org/netbeans/modules/java/source/JavaSourceUtilImpl.java
@@ -24,14 +24,15 @@ import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.tree.ModuleTree;
 import com.sun.source.tree.Tree;
 import com.sun.source.util.TreePath;
-import com.sun.source.util.TreePathScanner;
-import com.sun.source.util.TreeScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreePathScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreeScanner;
 import com.sun.source.util.Trees;
 import com.sun.tools.javac.code.ClassFinder;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.api.JavacTaskImpl;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.FileNotFoundException;
@@ -39,6 +40,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URI;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -50,6 +52,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.stream.Collectors;
 import java.util.stream.StreamSupport;
+
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.TypeElement;
 import javax.tools.Diagnostic;
@@ -57,6 +60,7 @@ import javax.tools.DiagnosticListener;
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.StandardLocation;
+
 import org.netbeans.api.annotations.common.CheckForNull;
 import org.netbeans.api.annotations.common.NonNull;
 import org.netbeans.api.annotations.common.NullAllowed;
@@ -222,11 +226,11 @@ public final class JavaSourceUtilImpl extends 
org.netbeans.modules.java.preproce
                     r.getProfile(),
                     null,
                     null,
-                    null,
                     aptUtils,
-                    null);
+                    null,
+                    Arrays.asList(toCompile));
             final Iterable<? extends JavaFileObject> generated = jt.generate(
-                    
StreamSupport.stream(jt.analyze(jt.enter(jt.parse(toCompile))).spliterator(), 
false)
+                    
StreamSupport.stream(jt.analyze(jt.enter(jt.parse())).spliterator(), false)
                             .filter((e) -> e.getKind().isClass() || 
e.getKind().isInterface())
                             .map((e) -> (TypeElement)e)
                             .collect(Collectors.toList()));
@@ -285,7 +289,7 @@ public final class JavaSourceUtilImpl extends 
org.netbeans.modules.java.preproce
                     @CheckForNull
                     public ModuleTree parseModule() throws IOException {
                         cc.toPhase(JavaSource.Phase.PARSED);
-                        final TreeScanner<ModuleTree, Void> scanner = new 
TreeScanner<ModuleTree, Void>() {
+                        final ErrorAwareTreeScanner<ModuleTree, Void> scanner 
= new ErrorAwareTreeScanner<ModuleTree, Void>() {
                             @Override
                             public ModuleTree visitModule(ModuleTree node, 
Void p) {
                                 return node;

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/src/org/netbeans/modules/java/source/JavadocEnv.java
----------------------------------------------------------------------
diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/JavadocEnv.java 
b/java.source.base/src/org/netbeans/modules/java/source/JavadocEnv.java
index 1843522..f62b8f6 100644
--- a/java.source.base/src/org/netbeans/modules/java/source/JavadocEnv.java
+++ b/java.source.base/src/org/netbeans/modules/java/source/JavadocEnv.java
@@ -44,8 +44,12 @@ import com.sun.tools.javadoc.main.FieldDocImpl;
 import com.sun.tools.javadoc.main.MethodDocImpl;
 import com.sun.tools.javadoc.main.ModifierFilter;
 import com.sun.tools.javadoc.main.PackageDocImpl;
+import com.sun.tools.javadoc.main.ProgramElementDocImpl;
 import java.io.IOException;
+import java.lang.reflect.Method;
 import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import javax.lang.model.element.Element;
 import org.netbeans.api.java.source.Task;
 import org.netbeans.api.java.source.ClasspathInfo;
@@ -105,7 +109,7 @@ public class JavadocEnv extends DocEnv {
         }
         ClassDocImpl result = classMap.get(clazz);
         if (result != null) {
-            if (treePath != null) result.setTreePath(treePath);
+            if (treePath != null) setTreePath(result, treePath);
             return;
         }
         if (isAnnotationType((JCClassDecl)treePath.getLeaf())) {       // 
flags of clazz may not yet be set
@@ -129,7 +133,7 @@ public class JavadocEnv extends DocEnv {
     protected void makeFieldDoc(VarSymbol var, TreePath treePath) {
         FieldDocImpl result = fieldMap.get(var);
         if (result != null) {
-            if (treePath != null) result.setTreePath(treePath);
+            if (treePath != null) setTreePath(result, treePath);
         } else {
             result = new JavadocField(this, var, treePath);
             fieldMap.put(var, result);
@@ -152,7 +156,7 @@ public class JavadocEnv extends DocEnv {
     protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) {
         MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
         if (result != null) {
-            if (treePath != null) result.setTreePath(treePath);
+            if (treePath != null) setTreePath(result, treePath);
         } else {
             result = new JavadocMethod(this, meth, treePath);
             methodMap.put(meth, result);
@@ -175,7 +179,7 @@ public class JavadocEnv extends DocEnv {
     protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) {
         ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth);
         if (result != null) {
-            if (treePath != null) result.setTreePath(treePath);
+            if (treePath != null) setTreePath(result, treePath);
         } else {
             result = new JavadocConstructor(this, meth, treePath);
             methodMap.put(meth, result);
@@ -198,12 +202,22 @@ public class JavadocEnv extends DocEnv {
     protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath 
treePath) {
         AnnotationTypeElementDocImpl result = 
(AnnotationTypeElementDocImpl)methodMap.get(meth);
         if (result != null) {
-            if (treePath != null) result.setTreePath(treePath);
+            if (treePath != null) setTreePath(result, treePath);
         } else {
             result = new JavadocAnnotationTypeElement(this, meth, treePath);
             methodMap.put(meth, result);
         }
     }
+    
+    private void setTreePath(ProgramElementDocImpl pe, TreePath treePath) {
+        try {
+            Method setTreePath = 
ProgramElementDocImpl.class.getDeclaredMethod("setTreePath", TreePath.class);
+            setTreePath.setAccessible(true);
+            setTreePath.invoke(pe, treePath);
+        } catch (Throwable ex) {
+            Logger.getLogger(JavadocEnv.class.getName()).log(Level.FINE, null, 
ex);
+        }
+    }
 
     /**
      * Return the AnnotationTypeElementDoc for a MethodSymbol.

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/src/org/netbeans/modules/java/source/TreeLoader.java
----------------------------------------------------------------------
diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/TreeLoader.java 
b/java.source.base/src/org/netbeans/modules/java/source/TreeLoader.java
deleted file mode 100644
index 0a4761e..0000000
--- a/java.source.base/src/org/netbeans/modules/java/source/TreeLoader.java
+++ /dev/null
@@ -1,779 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.java.source;
-
-import com.sun.source.tree.ClassTree;
-import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.tree.MethodTree;
-import com.sun.source.tree.PackageTree;
-import com.sun.source.tree.Tree;
-import com.sun.source.tree.TypeParameterTree;
-import com.sun.source.tree.VariableTree;
-import com.sun.source.util.JavacTask;
-import com.sun.source.util.TaskEvent;
-import com.sun.source.util.TaskListener;
-import com.sun.tools.javac.api.JavacTaskImpl;
-import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Scope;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.MethodSymbol;
-import com.sun.tools.javac.code.Symbol.VarSymbol;
-import com.sun.tools.javac.code.Symtab;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Types;
-import com.sun.tools.javac.comp.AttrContext;
-import com.sun.tools.javac.comp.Enter;
-import com.sun.tools.javac.comp.Env;
-import com.sun.tools.javac.main.JavaCompiler;
-import com.sun.tools.javac.model.LazyTreeLoader;
-import com.sun.tools.javac.tree.JCTree;
-import com.sun.tools.javac.tree.JCTree.JCClassDecl;
-import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
-import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
-import com.sun.tools.javac.tree.TreeScanner;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.CouplingAbort;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Log.DiscardDiagnosticHandler;
-import java.awt.EventQueue;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.InterruptedIOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.Reader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Pattern;
-import javax.swing.text.ChangedCharSetException;
-import javax.swing.text.MutableAttributeSet;
-import javax.swing.text.html.HTML;
-import javax.swing.text.html.HTML.Tag;
-import javax.swing.text.html.HTMLEditorKit;
-import javax.swing.text.html.HTMLEditorKit.ParserCallback;
-import javax.swing.text.html.parser.ParserDelegator;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardLocation;
-import org.netbeans.api.annotations.common.CheckForNull;
-import org.netbeans.api.annotations.common.NonNull;
-import org.netbeans.api.java.source.ClasspathInfo;
-import org.netbeans.api.java.source.ElementUtilities;
-import org.netbeans.api.java.source.SourceUtils;
-import org.netbeans.modules.java.source.indexing.JavaBinaryIndexer;
-import org.netbeans.modules.java.source.indexing.JavaIndex;
-import org.netbeans.modules.java.source.parsing.FileManagerTransaction;
-import org.netbeans.modules.java.source.parsing.FileObjects;
-import 
org.netbeans.modules.java.source.parsing.OutputFileManager.InvalidSourcePath;
-import org.netbeans.modules.java.source.usages.ClasspathInfoAccessor;
-import org.netbeans.modules.parsing.impl.indexing.IndexingUtils;
-import org.openide.filesystems.FileObject;
-import org.openide.filesystems.URLMapper;
-import org.openide.util.Exceptions;
-
-/**
- *
- * @author Dusan Balek
- */
-public class TreeLoader extends LazyTreeLoader {
-
-    private static final String OPTION_OUTPUT_ROOT = "output-root"; //NOI18N
-    private static final Pattern ctor_summary_name = 
Pattern.compile("constructor[_.]summary"); //NOI18N
-    private static final Pattern method_summary_name = 
Pattern.compile("method[_.]summary"); //NOI18N
-    private static final Pattern field_detail_name = 
Pattern.compile("field[_.]detail"); //NOI18N
-    private static final Pattern ctor_detail_name = 
Pattern.compile("constructor[_.]detail"); //NOI18N
-    private static final Pattern method_detail_name = 
Pattern.compile("method[_.]detail"); //NOI18N
-    private static final ThreadLocal<Boolean> isTreeLoading = new 
ThreadLocal<Boolean>();
-
-    public static void preRegister(final Context context, final ClasspathInfo 
cpInfo, final boolean detached) {
-        context.put(lazyTreeLoaderKey, new TreeLoader(context, cpInfo, 
detached));
-    }
-    
-    public static TreeLoader instance (final Context ctx) {
-        final LazyTreeLoader tl = LazyTreeLoader.instance(ctx);
-        return (tl instanceof TreeLoader) ? (TreeLoader)tl : null;
-    }
-
-    public static boolean isTreeLoading() {
-        return isTreeLoading.get() == Boolean.TRUE;
-    }
-
-    private static final Logger LOGGER = 
Logger.getLogger(TreeLoader.class.getName());
-    private static final boolean ALWAYS_ALLOW_JDOC_ARG_NAMES = 
Boolean.getBoolean("java.source.args.from.http.jdoc");  //NOI18N
-    public  static boolean DISABLE_CONFINEMENT_TEST = false; //Only for tests!
-    public  static boolean DISABLE_ARTIFICAL_PARAMETER_NAMES = false; //Only 
for tests!
-
-    private Context context;
-    private ClasspathInfo cpInfo;
-    private Map<ClassSymbol, StringBuilder> couplingErrors;
-    private boolean partialReparse;
-    //@GuardedBy("this")
-    private Thread owner;
-    //@GuardedBy("this")
-    private int depth;
-    private final boolean checkContention;
-
-    private TreeLoader(Context context, ClasspathInfo cpInfo, boolean 
detached) {
-        this.context = context;
-        this.cpInfo = cpInfo;
-        this.checkContention = detached;
-    }
-    
-    @Override
-    public boolean loadTreeFor(final ClassSymbol clazz, boolean persist) {
-        boolean contended = !attachTo(Thread.currentThread());
-        try {
-            assert DISABLE_CONFINEMENT_TEST || 
JavaSourceAccessor.getINSTANCE().isJavaCompilerLocked() || !contended;
-            if (clazz != null) {
-                if (Enter.instance(context).getEnv(clazz) != null) {
-                    return true;
-                }
-                try {
-                    FileObject fo = SourceUtils.getFile(clazz, cpInfo);
-                    final JavacTaskImpl jti = (JavacTaskImpl) 
context.get(JavacTask.class);
-                    JavaCompiler jc = JavaCompiler.instance(context);
-                    if (fo != null && jti != null) {
-                        final Log log = Log.instance(context);
-                        log.nerrors = 0;
-                        final JavaFileManager jfm = 
context.get(JavaFileManager.class);
-                        final Symtab syms = Symtab.instance(context);
-                        JavaFileObject jfo = FileObjects.sourceFileObject(fo, 
null);
-                        Map<ClassSymbol, StringBuilder> oldCouplingErrors = 
couplingErrors;
-                        boolean oldSkipAPT = jc.skipAnnotationProcessing;
-                        try {
-                            couplingErrors = new HashMap<ClassSymbol, 
StringBuilder>();
-                            jc.skipAnnotationProcessing = true;
-                            Iterable<? extends CompilationUnitTree> cuts = 
jti.parse(jfo);
-                            for (CompilationUnitTree cut : cuts) {
-                                ((JCTree.JCCompilationUnit)cut).modle = 
clazz.packge().modle;
-                            }
-                            jti.analyze(jti.enter(cuts));
-                            if (persist && log.nerrors == 0) {
-                                final File classFolder = getClassFolder(jfm, 
clazz);
-                                if (classFolder != null) {
-                                    jfm.handleOption(OPTION_OUTPUT_ROOT, 
Collections.singletonList(classFolder.getPath()).iterator()); //NOI18N
-                                    try {
-                                        if 
(jfm.hasLocation(StandardLocation.CLASS_OUTPUT) && canWrite(cpInfo)) {
-                                            Env<AttrContext> env = 
Enter.instance(context).getEnv(clazz);
-                                            HashMap<ClassSymbol, JCClassDecl> 
syms2trees;
-                                            if (env != null && 
pruneTree(env.tree, Symtab.instance(context), syms2trees = new HashMap<>())) {
-                                                
isTreeLoading.set(Boolean.TRUE);
-                                                try {
-                                                    dumpSymFile(jti, clazz, 
syms2trees);
-                                                } finally {
-                                                    isTreeLoading.remove();
-                                                }
-                                            }
-                                        } else {
-                                            final JavaFileObject cfo = 
clazz.classfile;
-                                            final FileObject cFileObject = 
URLMapper.findFileObject(cfo.toUri().toURL());
-                                            FileObject root = null;
-                                            if (cFileObject != null) {
-                                                root = cFileObject;
-                                                for (String pathElement : 
ElementUtilities.getBinaryName(clazz).split("\\.")) {
-                                                    root = root.getParent();
-                                                }
-                                            }
-                                            if (root != null) {
-                                                final FileObject rootFin = 
root;
-                                                
IndexingUtils.runAsScanWork(new Runnable() {
-                                                    @Override
-                                                    public void run() {
-                                                        try {
-                                                            
JavaBinaryIndexer.preBuildArgs(rootFin,cFileObject);
-                                                        } catch (IOException 
ioe) {
-                                                            
Exceptions.printStackTrace(ioe);
-                                                        }
-                                                    }
-                                                });
-                                            }
-                                        }
-                                    } finally {
-                                        jfm.handleOption(OPTION_OUTPUT_ROOT, 
Collections.singletonList("").iterator()); //NOI18N
-                                    }
-                                }
-                            }
-                            return true;
-                        } finally {
-                            jc.skipAnnotationProcessing = oldSkipAPT;
-                            log.nerrors = 0;
-                            for (Map.Entry<ClassSymbol, StringBuilder> e : 
couplingErrors.entrySet()) {
-                                dumpCouplingAbort(new 
CouplingAbort(e.getKey(), null), e.getValue().toString());
-                            }
-                            couplingErrors = oldCouplingErrors;
-                        }
-                    }
-                } catch (IOException ex) {
-                    Exceptions.printStackTrace(ex);
-                }
-            }
-            return false;
-        } finally {
-            dettachFrom(Thread.currentThread());
-        }
-    }
-    
-    @Override
-    public boolean loadParamNames(ClassSymbol clazz) {
-        boolean contended = !attachTo(Thread.currentThread());
-        try {
-            assert DISABLE_CONFINEMENT_TEST || 
JavaSourceAccessor.getINSTANCE().isJavaCompilerLocked() || !contended;
-            if (clazz != null) {
-                JavadocHelper.TextStream page = 
JavadocHelper.getJavadoc(clazz, ALWAYS_ALLOW_JDOC_ARG_NAMES, null);
-                if (page != null && (!page.isRemote() || 
!EventQueue.isDispatchThread())) {
-                    if (getParamNamesFromJavadocText(page, clazz)) {
-                        return true;
-                    }
-                }
-                if (!DISABLE_ARTIFICAL_PARAMETER_NAMES) {
-                    fillArtificalParamNames(clazz);
-                    return true;
-                }
-            }
-
-            return false;
-        } finally {
-            dettachFrom(Thread.currentThread());
-        }
-    }
-
-    @Override
-    public void couplingError(ClassSymbol clazz, Tree t) {
-        if (this.partialReparse) {
-            super.couplingError(clazz, t);
-        }
-        if (clazz != null && couplingErrors != null) {
-            StringBuilder sb = couplingErrors.get(clazz);            
-            if (sb != null)
-                sb.append(getTreeInfo(t));
-            else
-                couplingErrors.put(clazz, getTreeInfo(t));
-        } else {
-            dumpCouplingAbort(new CouplingAbort(clazz, t), null);
-        }
-    }
-
-    @Override
-    public void updateContext(Context context) {
-        this.context = context;
-    }
-
-    public final void startPartialReparse () {
-        this.partialReparse = true;
-    }
-
-    public final void endPartialReparse () {
-        this.partialReparse = false;
-    }
-
-    public static boolean pruneTree(final JCTree tree, final Symtab syms, 
final HashMap<ClassSymbol, JCClassDecl> syms2trees) {
-        final AtomicBoolean ret = new AtomicBoolean(true);
-        new TreeScanner() {
-            @Override
-            public void visitMethodDef(JCMethodDecl tree) {
-                super.visitMethodDef(tree);
-                if (tree.sym == null || tree.type == null || tree.type == 
syms.unknownType)
-                    ret.set(false);
-                tree.body = null;
-            }
-            @Override
-            public void visitVarDef(JCVariableDecl tree) {
-                super.visitVarDef(tree);
-                if (tree.sym == null || tree.type == null || tree.type == 
syms.unknownType)
-                    ret.set(false);
-                tree.init = null;
-            }
-            @Override
-            public void visitClassDef(JCClassDecl tree) {
-                scan(tree.mods);
-                scan(tree.typarams);
-                scan(tree.extending);
-                scan(tree.implementing);
-                if (tree.defs != null) {
-                    List<JCTree> prev = null;
-                    for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) 
{
-                        scan(l.head);
-                        if (l.head.getTag() == JCTree.Tag.BLOCK) {
-                            if (prev != null)
-                                prev.tail = l.tail;
-                            else
-                                tree.defs = l.tail;
-                        }
-                        prev = l;
-                    }
-                }
-                if (tree.sym == null || tree.type == null || tree.type == 
syms.unknownType) {
-                    ret.set(false);
-                } else if (syms2trees != null) {
-                    syms2trees.put(tree.sym, tree);
-                }
-            }
-            @Override
-            public void visitModuleDef(JCTree.JCModuleDecl tree) {
-                ret.set(false);
-                super.visitModuleDef(tree);
-            }
-        }.scan(tree);
-        return ret.get();
-    }
-
-    public static void dumpSymFile(
-            @NonNull final JavaFileManager jfm,
-            @NonNull final JavacTaskImpl jti,
-            @NonNull final ClassSymbol clazz,
-            @NonNull final File classFolder,
-            @NonNull final HashMap<ClassSymbol, JCClassDecl> syms2trees) 
throws IOException {
-        jfm.handleOption(OPTION_OUTPUT_ROOT, 
Collections.singletonList(classFolder.getPath()).iterator()); //NOI18N
-        try {
-            dumpSymFile(jti, clazz, syms2trees);
-        } finally {
-            jfm.handleOption(OPTION_OUTPUT_ROOT, 
Collections.singletonList("").iterator()); //NOI18N
-        }
-    }
-
-    @CheckForNull
-    private static File getClassFolder(
-        JavaFileManager jfm,
-        ClassSymbol clazz) throws IOException {
-        String binaryName = null;
-        String surl = null;
-        if (clazz.classfile != null) {
-            binaryName = 
jfm.inferBinaryName(StandardLocation.PLATFORM_CLASS_PATH, clazz.classfile);
-            if (binaryName == null)
-                binaryName = jfm.inferBinaryName(StandardLocation.CLASS_PATH, 
clazz.classfile);
-            surl = clazz.classfile.toUri().toURL().toExternalForm();
-        } else if (clazz.sourcefile != null) {
-            binaryName = jfm.inferBinaryName(StandardLocation.SOURCE_PATH, 
clazz.sourcefile);
-            surl = clazz.sourcefile.toUri().toURL().toExternalForm();
-        }
-        if (binaryName == null || surl == null) {
-            return null;
-        }
-        int index = 
surl.lastIndexOf(FileObjects.convertPackage2Folder(binaryName));
-        if (index > 0) {
-            return JavaIndex.getClassFolder(new URL(surl.substring(0, index)));
-        } else {
-            LOGGER.log(
-               Level.INFO,
-               "Invalid binary name when writing sym file for class: {0}, 
source: {1}, binary name {2}",    // NOI18N
-               new Object[] {
-                   clazz.flatname,
-                   surl,
-                   binaryName
-               });
-            return null;
-        }
-    }
-
-    private static void dumpSymFile(
-            @NonNull final JavacTaskImpl jti,
-            @NonNull final ClassSymbol clazz,
-            @NonNull final HashMap<ClassSymbol, JCClassDecl> syms2trees) 
throws IOException {
-        Log log = Log.instance(jti.getContext());
-        JavaCompiler compiler = JavaCompiler.instance(jti.getContext());
-        JavaFileObject prevLogTo = log.useSource(null);
-        DiscardDiagnosticHandler discardDiagnosticHandler = new 
Log.DiscardDiagnosticHandler(log);
-        final TaskListener listener = new TaskListener() {
-            @Override
-            public void started(TaskEvent e) {
-                if (e != null && e.getKind() == TaskEvent.Kind.GENERATE) {
-                    JCClassDecl tree = 
syms2trees.get((ClassSymbol)e.getTypeElement());
-                    if (tree != null)
-                        pruneTree(tree, Symtab.instance(jti.getContext()), 
null);
-                }
-            }
-            @Override
-            public void finished(TaskEvent e) {
-            }
-        };
-        boolean oldSkipAP = compiler.skipAnnotationProcessing;
-        try {
-            compiler.skipAnnotationProcessing = true;
-            jti.addTaskListener(listener);
-            jti.generate(Collections.singletonList(clazz));
-        } catch (InvalidSourcePath isp) {
-            LOGGER.log(Level.INFO, "InvalidSourcePath reported when writing 
sym file for class: {0}", clazz.flatname); // NOI18N
-        } finally {
-            jti.removeTaskListener(listener);
-            compiler.skipAnnotationProcessing = oldSkipAP;
-            log.popDiagnosticHandler(discardDiagnosticHandler);
-            log.useSource(prevLogTo);
-        }
-    }
-
-    private static final int MAX_DUMPS = 
Integer.getInteger("org.netbeans.modules.java.source.parsing.JavacParser.maxDumps",
 255);
-    
-    public static void dumpCouplingAbort(CouplingAbort couplingAbort, String 
treeInfo) {
-        if (treeInfo == null)
-            treeInfo = getTreeInfo(couplingAbort.getTree()).toString();
-        String dumpDir = System.getProperty("netbeans.user") + "/var/log/"; 
//NOI18N
-        JavaFileObject classFile = couplingAbort.getClassFile();
-        String cfURI = classFile != null ? classFile.toUri().toASCIIString() : 
"<unknown>"; //NOI18N
-        JavaFileObject sourceFile = couplingAbort.getSourceFile();
-        String sfURI = sourceFile != null ? sourceFile.toUri().toASCIIString() 
: "<unknown>"; //NOI18N
-        String origName = classFile != null ? classFile.getName() : "unknown"; 
//NOI18N
-        File f = new File(dumpDir + origName + ".dump"); // NOI18N
-        boolean dumpSucceeded = false;
-        int i = 1;
-        while (i < MAX_DUMPS) {
-            if (!f.exists())
-                break;
-            f = new File(dumpDir + origName + '_' + i + ".dump"); // NOI18N
-            i++;
-        }
-        if (!f.exists()) {
-            try {
-                f.getParentFile().mkdirs();
-                OutputStream os = new FileOutputStream(f);
-                PrintWriter writer = new PrintWriter(new 
OutputStreamWriter(os, "UTF-8")); // NOI18N
-                try {
-                    writer.println("Coupling error:"); //NOI18N
-                    writer.println(String.format("class file %s", cfURI)); 
//NOI18N
-                    writer.println(String.format("source file %s", sfURI)); 
//NOI18N
-                    writer.println("----- Source file content: 
----------------------------------------"); // NOI18N
-                    if (sourceFile != null) {
-                        try {
-                            writer.println(sourceFile.getCharContent(true));
-                        } catch (UnsupportedOperationException uoe) {
-                            writer.println("<unknown>"); //NOI18N
-                        }
-                    } else {
-                        writer.println("<unknown>"); //NOI18N
-                    }
-                    writer.print("----- Trees: 
-------------------------------------------------------"); // NOI18N
-                    writer.println(treeInfo);
-                    writer.println("----- Stack trace: 
---------------------------------------------"); // NOI18N
-                    couplingAbort.printStackTrace(writer);
-                } finally {
-                    writer.close();
-                    dumpSucceeded = true;
-                }
-            } catch (IOException ioe) {
-                LOGGER.log(Level.INFO, "Error when writing coupling error dump 
file!", ioe); // NOI18N
-            }
-        }
-        LOGGER.log(Level.WARNING, "Coupling error:\nclass file: {0}\nsource 
file: {1}{2}\n", new Object[] {cfURI, sfURI, treeInfo}); //NOI18N
-        if (!dumpSucceeded) {
-            LOGGER.log(Level.WARNING,
-                    "Dump could not be written. Either dump file could not " + 
// NOI18N
-                    "be created or all dump files were already used. Please " 
+ // NOI18N
-                    "check that you have write permission to '" + dumpDir + "' 
and " + // NOI18N
-                    "clean all *.dump files in that directory."); // NOI18N
-        }
-    }
-
-    private static StringBuilder getTreeInfo(Tree t) {
-        StringBuilder info = new StringBuilder("\n"); //NOI18N
-        if (t != null) {
-            switch (t.getKind()) {
-                case ANNOTATION_TYPE:
-                case CLASS:
-                case ENUM:
-                case INTERFACE:
-                    info.append("CLASS: ").append(((ClassTree) 
t).getSimpleName().toString()); //NOI18N
-                    break;
-                case VARIABLE:
-                    info.append("VARIABLE: ").append(((VariableTree) 
t).getName().toString()); //NOI18N
-                    break;
-                case METHOD:
-                    info.append("METHOD: ").append(((MethodTree) 
t).getName().toString()); //NOI18N
-                    break;
-                case TYPE_PARAMETER:
-                    info.append("TYPE_PARAMETER: 
").append(((TypeParameterTree) t).getName().toString()); //NOI18N
-                    break;
-                default:
-                    info.append("TREE: <unknown>"); //NOI18N
-                    break;
-            }
-        }
-        return info;
-    }
-
-    private boolean getParamNamesFromJavadocText(final 
JavadocHelper.TextStream page, final ClassSymbol clazz) {
-        HTMLEditorKit.Parser parser;
-        InputStream is = null;        
-        String charset = null;
-        for (;;) {
-            try{
-                is = page.openStream();
-                Reader reader = charset == null ? new InputStreamReader(is): 
new InputStreamReader(is, charset);
-                parser = new ParserDelegator();
-                parser.parse(reader, new ParserCallback() {                    
-
-                    private int state = 0; //init
-                    private String signature = null;
-                    private StringBuilder sb = null;
-
-                    @Override
-                    public void handleStartTag(HTML.Tag t, MutableAttributeSet 
a, int pos) {
-                        if (t == HTML.Tag.A) {
-                            String attrName = 
(String)a.getAttribute(HTML.Attribute.NAME);
-                            if (attrName != null && 
ctor_summary_name.matcher(attrName).matches()) {
-                                // we have found desired javadoc constructor 
info anchor
-                                state = 10; //ctos open
-                            } else if (attrName != null && 
method_summary_name.matcher(attrName).matches()) {
-                                // we have found desired javadoc method info 
anchor
-                                state = 20; //methods open
-                            } else if (attrName != null && 
field_detail_name.matcher(attrName).matches()) {
-                                state = 30; //end
-                            } else if (attrName != null && 
ctor_detail_name.matcher(attrName).matches()) {
-                                state = 30; //end
-                            } else if (attrName != null && 
method_detail_name.matcher(attrName).matches()) {
-                                state = 30; //end
-                            } else if (state == 12 || state == 22) {
-                                String attrHref = 
(String)a.getAttribute(HTML.Attribute.HREF);
-                                if (attrHref != null) {
-                                    int idx = attrHref.indexOf('#');
-                                    if (idx >= 0) {
-                                        signature = attrHref.substring(idx + 
1);
-                                        sb = new StringBuilder();
-                                    }
-                                }
-                            }
-                        } else if (t == HTML.Tag.TABLE) {
-                            if (state == 10 || state == 20)
-                                state++;
-                        } else if (t == HTML.Tag.CODE) {
-                            if (state == 11 || state == 21)
-                                state++;
-                        } else if (t == HTML.Tag.DIV && 
a.containsAttribute(HTML.Attribute.CLASS, "block")) { //NOI18N
-                            if (state == 11 && signature != null && sb != 
null) {
-                                setParamNames(signature, sb.toString().trim(), 
true);
-                                signature = null;
-                                sb = null;
-                            } else if (state == 21 && signature != null && sb 
!= null) {
-                                setParamNames(signature, sb.toString().trim(), 
false);
-                                signature = null;
-                                sb = null;
-                            }
-                        }
-                    }
-
-                    @Override
-                    public void handleEndTag(Tag t, int pos) {
-                        if (t == HTML.Tag.CODE) {
-                            if (state == 12 || state == 22)
-                                state--;
-                        } else if (t == HTML.Tag.TABLE) {
-                            if (state == 11 || state == 21)
-                                state--;
-                        }
-                    }
-
-                    @Override
-                    public void handleText(char[] data, int pos) {
-                        if (signature != null && sb != null && (state == 12 || 
state == 22))
-                            sb.append(data);
-                    }
-
-                    @Override
-                    public void handleSimpleTag(Tag t, MutableAttributeSet a, 
int pos) {
-                        if (t == HTML.Tag.BR) {
-                            if (state == 11 && signature != null && sb != 
null) {
-                                setParamNames(signature, sb.toString().trim(), 
true);
-                                signature = null;
-                                sb = null;
-                            } else if (state == 21 && signature != null && sb 
!= null) {
-                                setParamNames(signature, sb.toString().trim(), 
false);
-                                signature = null;
-                                sb = null;
-                            }
-                        }
-                    }
-
-                    private void setParamNames(String signature, String names, 
boolean isCtor) {
-                        ArrayList<String> paramTypes = new ArrayList<String>();
-                        int idx = -1;
-                        for(int i = 0; i < signature.length(); i++) {
-                            switch(signature.charAt(i)) {
-                                case '-':
-                                case '(':
-                                case ')':
-                                case ',':
-                                    if (idx > -1 && idx < i - 1) {
-                                        String typeName = 
signature.substring(idx + 1, i).trim();
-                                        if (typeName.endsWith("...")) //NOI18N
-                                            typeName = typeName.substring(0, 
typeName.length() - 3) + "[]"; //NOI18N
-                                        paramTypes.add(typeName);
-                                    }
-                                    idx = i;
-                                    break;
-                            }
-                        }
-                        String methodName = null;
-                        ArrayList<String> paramNames = new ArrayList<String>();
-                        idx = -1;
-                        for(int i = 0; i < names.length(); i++) {
-                            switch(names.charAt(i)) {
-                                case '(':
-                                    methodName = names.substring(0, i);
-                                    break;
-                                case ')':
-                                case ',':
-                                    if (idx > -1) {
-                                        paramNames.add(names.substring(idx + 
1, i));
-                                        idx = -1;
-                                    }
-                                    break;
-                                case 160: //&nbsp;
-                                    idx = i;
-                                    break;
-                            }
-                        }
-                        assert methodName != null : "Null methodName. 
Signature: [" + signature + "], Names: [" + names + "]";
-                        assert paramTypes.size() == paramNames.size() : 
"Inconsistent param types/names. Signature: [" + signature + "], Names: [" + 
names + "]";
-                        if (paramNames.size() > 0) {
-                            for (Symbol s : 
clazz.members().getSymbolsByName(isCtor
-                                    ? clazz.name.table.names.init
-                                    : 
clazz.name.table.fromString(methodName))) {
-                                if (s.kind == Kinds.Kind.MTH && s.owner == 
clazz) {
-                                    MethodSymbol sym = (MethodSymbol)s;
-                                    List<VarSymbol> params = sym.params;
-                                    if (checkParamTypes(params, paramTypes)) {
-                                        for (String name : paramNames) {
-                                            
params.head.setName(clazz.name.table.fromString(name));
-                                            params = params.tail;
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-
-                    private boolean checkParamTypes(List<VarSymbol> params, 
ArrayList<String> paramTypes) {
-                        Types types = Types.instance(context);
-                        for (String typeName : paramTypes) {
-                            if (params.isEmpty())
-                                return false;
-                            Type type = params.head.type;
-                            if (type.isParameterized())
-                                type = types.erasure(type);
-                            if (!typeName.equals(type.toString()))
-                                return false;
-                            params = params.tail;
-                        }
-                        return params.isEmpty();
-                    }
-                }, charset != null);
-                return true;
-            } catch (ChangedCharSetException e) {
-                if (charset == null) {
-                    charset = JavadocHelper.getCharSet(e);
-                    //restart with valid charset
-                } else {
-                    e.printStackTrace();
-                    break;
-                }
-            } catch (InterruptedIOException x) {
-                //Http javadoc timeout
-                break;
-            } catch(IOException ioe){
-                ioe.printStackTrace();
-                break;
-            }finally{
-                parser = null;
-                if (is!=null) {
-                    try{
-                        is.close();
-                    }catch(IOException ioe){
-                        ioe.printStackTrace();
-                    }
-                }
-            }
-        }
-        return false;
-    }
-    
-    private void fillArtificalParamNames(final ClassSymbol clazz) {
-        for (Symbol s : clazz.getEnclosedElements()) {
-            if (s instanceof MethodSymbol) {
-                MethodSymbol ms = (MethodSymbol) s;
-
-                if (ms.getParameters().isEmpty()) {
-                    continue;
-                }
-                
-                Set<String> usedNames = new HashSet<String>();
-                
-                for (VarSymbol vs : ms.getParameters()) {
-                    String name = 
JavaSourceAccessor.getINSTANCE().generateReadableParameterName(vs.asType().toString(),
 usedNames);
-
-                    vs.setName(clazz.name.table.fromString(name));
-                }
-            }
-        }
-    }
-
-    private synchronized boolean attachTo(final Thread thread) {
-        assert thread != null;
-        if (!checkContention) {
-            return true;
-        } else if (this.owner == null) {
-            assert this.depth == 0;
-            this.owner = thread;
-            this.depth++;
-            return true;
-        } else if (this.owner == thread) {
-            assert this.depth > 0;
-            this.depth++;
-            return true;
-        } else {
-            assert this.depth > 0;
-            return false;
-        }
-    }
-
-    private synchronized boolean dettachFrom(final Thread thread) {
-        assert thread != null;
-        if (!checkContention) {
-            return true;
-        } else if (this.owner == thread) {
-            assert depth > 0;
-            this.depth--;
-            if (this.depth == 0) {
-                this.owner = null;
-            }
-            return true;
-        } else {
-            return false;
-        }
-    }
-    
-    private boolean canWrite(final ClasspathInfo cpInfo) {
-        final FileManagerTransaction fmTx = 
ClasspathInfoAccessor.getINSTANCE().getFileManagerTransaction(cpInfo);
-        assert fmTx != null;
-        return fmTx.canWrite();
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/src/org/netbeans/modules/java/source/indexing/CompileWorker.java
----------------------------------------------------------------------
diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/CompileWorker.java
 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/CompileWorker.java
index 103b8f3..318219c 100644
--- 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/CompileWorker.java
+++ 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/CompileWorker.java
@@ -40,9 +40,9 @@ import org.netbeans.modules.parsing.spi.indexing.Indexable;
  *
  * @author Jan Lahoda, Dusan Balek
  */
-abstract class CompileWorker {
+public abstract class CompileWorker {
 
-    abstract ParsingOutput compile(ParsingOutput previous, Context context, 
JavaParsingContext javaContext, Collection<? extends CompileTuple> files);
+    protected abstract ParsingOutput compile(ParsingOutput previous, Context 
context, JavaParsingContext javaContext, Collection<? extends CompileTuple> 
files);
 
     protected void computeFQNs(final Map<JavaFileObject, List<String>> 
file2FQNs, CompilationUnitTree cut, CompileTuple tuple) {
         String pack;
@@ -89,26 +89,26 @@ abstract class CompileWorker {
         lm.free(freeCaches);
     }
     
-    static class ModuleName {
-        String name;
-        boolean assigned;
+    protected static class ModuleName {
+        public String name;
+        public boolean assigned;
         
-        ModuleName(final String name) {
+        public ModuleName(final String name) {
             this.name = name;
         }
     }
 
-    static class ParsingOutput {
-        final boolean success;
-        final boolean lowMemory;
-        final String moduleName;
-        final Map<JavaFileObject, List<String>> file2FQNs;
-        final Set<ElementHandle<TypeElement>> addedTypes;
-        final Set<ElementHandle<ModuleElement>> addedModules;
-        final Set<File> createdFiles;
-        final Set<Indexable> finishedFiles;
-        final Set<ElementHandle<TypeElement>> modifiedTypes;
-        final Set<javax.tools.FileObject> aptGenerated;
+    public static class ParsingOutput {
+        public final boolean success;
+        public final boolean lowMemory;
+        public final String moduleName;
+        public final Map<JavaFileObject, List<String>> file2FQNs;
+        public final Set<ElementHandle<TypeElement>> addedTypes;
+        public final Set<ElementHandle<ModuleElement>> addedModules;
+        public final Set<File> createdFiles;
+        public final Set<Indexable> finishedFiles;
+        public final Set<ElementHandle<TypeElement>> modifiedTypes;
+        public final Set<javax.tools.FileObject> aptGenerated;
 
         private ParsingOutput(
                 final boolean success,
@@ -134,7 +134,7 @@ abstract class CompileWorker {
             this.aptGenerated = aptGenerated;
         }
 
-        static ParsingOutput success (
+        public static ParsingOutput success (
                 @NullAllowed final String moduleName,
                 final Map<JavaFileObject, List<String>> file2FQNs,
                 final Set<ElementHandle<TypeElement>> addedTypes,
@@ -148,7 +148,7 @@ abstract class CompileWorker {
                     modifiedTypes, aptGenerated);
         }
 
-        static ParsingOutput failure(
+        public static ParsingOutput failure(
                 @NullAllowed final String moduleName,
                 final Map<JavaFileObject, List<String>> file2FQNs,
                 final Set<ElementHandle<TypeElement>> addedTypes,
@@ -162,7 +162,7 @@ abstract class CompileWorker {
                     modifiedTypes, aptGenerated);
         }
 
-        static ParsingOutput lowMemory(
+        public static ParsingOutput lowMemory(
                 @NullAllowed final String moduleName,
                 final Map<JavaFileObject, List<String>> file2FQNs,
                 final Set<ElementHandle<TypeElement>> addedTypes,

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/src/org/netbeans/modules/java/source/indexing/DiagnosticListenerImpl.java
----------------------------------------------------------------------
diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/DiagnosticListenerImpl.java
 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/DiagnosticListenerImpl.java
index 4103f83..507bb55 100644
--- 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/DiagnosticListenerImpl.java
+++ 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/DiagnosticListenerImpl.java
@@ -31,7 +31,7 @@ import javax.tools.Diagnostic;
 import javax.tools.DiagnosticListener;
 import javax.tools.JavaFileObject;
 
-class DiagnosticListenerImpl implements DiagnosticListener<JavaFileObject> {
+public class DiagnosticListenerImpl implements 
DiagnosticListener<JavaFileObject> {
 
     private static final Logger ERROR_LOG = 
Logger.getLogger(DiagnosticListenerImpl.class.getName() + "-errors");
     private final Map<URI, List<Diagnostic<? extends JavaFileObject>>> 
diagnostics = new HashMap<URI, List<Diagnostic<? extends JavaFileObject>>>();

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/src/org/netbeans/modules/java/source/indexing/FQN2Files.java
----------------------------------------------------------------------
diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/FQN2Files.java 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/FQN2Files.java
index 9348f2b..056ada4 100644
--- 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/FQN2Files.java
+++ 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/FQN2Files.java
@@ -18,7 +18,6 @@
  */
 package org.netbeans.modules.java.source.indexing;
 
-import com.sun.tools.javac.api.DuplicateClassChecker;
 import com.sun.tools.javac.code.Symbol;
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
@@ -48,7 +47,7 @@ import org.openide.util.Exceptions;
  *
  * @author Dusan Balek
  */
-public final class FQN2Files implements DuplicateClassChecker {
+public final class FQN2Files {
 
     private static final Logger LOG = 
Logger.getLogger(FQN2Files.class.getName());
     private static final String FQN2FILES_FILE = "fqn2files.properties"; 
//NOI18N
@@ -134,7 +133,6 @@ public final class FQN2Files implements 
DuplicateClassChecker {
         }
     }
 
-    @Override
     public boolean check(final Name fqn, final JavaFileObject jfo) {
         String value = props.getProperty(fqn.toString());
         try {

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexer.java
----------------------------------------------------------------------
diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexer.java
 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexer.java
index b70a354..c5e796c 100644
--- 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexer.java
+++ 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexer.java
@@ -27,6 +27,7 @@ import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -47,7 +48,7 @@ import org.netbeans.api.java.classpath.ClassPath;
 import org.netbeans.api.java.platform.JavaPlatform;
 import org.netbeans.api.java.source.ClasspathInfo;
 import org.netbeans.api.java.source.ElementHandle;
-import org.netbeans.modules.java.source.TreeLoader;
+import org.netbeans.modules.java.source.ElementUtils;
 import org.netbeans.modules.java.source.base.Module;
 import org.netbeans.modules.java.source.parsing.FileManagerTransaction;
 import org.netbeans.modules.java.source.parsing.FileObjects;
@@ -191,11 +192,10 @@ public class JavaBinaryIndexer extends BinaryIndexer {
             false,
             false,
             null);
-        final JavacTaskImpl jt = JavacParser.createJavacTask(cpInfo, new 
DevNullDiagnosticListener(), null, null, null, null, null, null, null);
-        TreeLoader.preRegister(jt.getContext(), cpInfo, true);
+        final JavacTaskImpl jt = JavacParser.createJavacTask(cpInfo, new 
DevNullDiagnosticListener(), null, null, null, null, null, null, 
Collections.emptyList());
         //Force JTImpl.prepareCompiler to get JTImpl into Context
         jt.enter();
-        TypeElement jc = (TypeElement) 
((JavacElements)jt.getElements()).getTypeElementByBinaryName(fqn);
+        TypeElement jc = ElementUtils.getTypeElementByBinaryName(jt, fqn);
         if (jc != null) {
             List<ExecutableElement> methods = 
ElementFilter.methodsIn(jt.getElements().getAllMembers(jc));
             for (ExecutableElement method : methods) {

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java
----------------------------------------------------------------------
diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java
 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java
index c84ad6f..1f61e68 100644
--- 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java
+++ 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java
@@ -113,6 +113,7 @@ import org.openide.util.Parameters;
 import org.openide.util.TopologicalSortException;
 import org.openide.util.BaseUtilities;
 import org.openide.util.Lookup;
+import org.openide.util.lookup.ServiceProvider;
 
 /**
  *
@@ -120,13 +121,12 @@ import org.openide.util.Lookup;
  */
 public class JavaCustomIndexer extends CustomIndexer {
 
-            static       boolean NO_ONE_PASS_COMPILE_WORKER = 
Boolean.getBoolean(JavaCustomIndexer.class.getName() + 
".no.one.pass.compile.worker");
+    public  static       boolean NO_ONE_PASS_COMPILE_WORKER = 
Boolean.getBoolean(JavaCustomIndexer.class.getName() + 
".no.one.pass.compile.worker");
     private static final String DUMP_ON_LOW_MEM = 
System.getProperty(JavaCustomIndexer.class.getName() + ".dump.on.low.mem");    
//NOI18N
     private static final String SOURCE_PATH = "sourcePath"; //NOI18N
     private static final String APT_SOURCE_OUTPUT = "apSrcOut"; //NOI18N
     private static final Pattern ANONYMOUS = Pattern.compile("\\$[0-9]"); 
//NOI18N
     private static final ClassPath EMPTY = 
ClassPathSupport.createClassPath(new URL[0]);
-    private static final int TRESHOLD = 500;
 
     @Override
     protected void index(final Iterable<? extends Indexable> files, final 
Context context) {
@@ -251,10 +251,7 @@ public class JavaCustomIndexer extends CustomIndexer {
                     int round = 0;
                     String moduleName = null;
                     while (round++ < 2) {
-                        CompileWorker[] WORKERS = {
-                            toCompileRound.size() < TRESHOLD ? new 
SuperOnePassCompileWorker() : new OnePassCompileWorker(),
-                            new MultiPassCompileWorker()
-                        };
+                        CompileWorker[] WORKERS = 
Lookup.getDefault().lookup(CompileWorkerProvider.class).getWorkers(toCompileRound);
                         for (CompileWorker w : WORKERS) {
                             compileResult = w.compile(compileResult, context, 
javaContext, toCompileRound);
                             if (compileResult == null || 
context.isCancelled()) {
@@ -675,7 +672,7 @@ public class JavaCustomIndexer extends CustomIndexer {
         return result;
     }
 
-    static void addAptGenerated(
+    public static void addAptGenerated(
             @NonNull final Context context,
             @NonNull JavaParsingContext javaContext,
             @NonNull final CompileTuple source,
@@ -686,14 +683,14 @@ public class JavaCustomIndexer extends CustomIndexer {
         }
     }
 
-    static void setErrors(Context context, CompileTuple active, 
DiagnosticListenerImpl errors) {
+    public static void setErrors(Context context, CompileTuple active, 
DiagnosticListenerImpl errors) {
         if (!active.virtual) {
             Iterable<Diagnostic<? extends JavaFileObject>> filteredErrorsList 
= Iterators.filter(errors.getDiagnostics(active.jfo), new 
FilterOutJDK7AndLaterWarnings());
             ErrorsCache.setErrors(context.getRootURI(), active.indexable, 
filteredErrorsList, active.aptGenerated ? ERROR_CONVERTOR_NO_BADGE : 
ERROR_CONVERTOR);
         }
     }
 
-    static void brokenPlatform(
+    public static void brokenPlatform(
             @NonNull final Context ctx,
             @NonNull final Iterable<? extends CompileTuple> files,
             @NullAllowed final Diagnostic<JavaFileObject> diagnostic) {
@@ -1391,4 +1388,20 @@ public class JavaCustomIndexer extends CustomIndexer {
             return vote;
         }
     }
+    
+    public static interface CompileWorkerProvider {
+        public CompileWorker[] getWorkers(List<CompileTuple> toCompile);
+    }
+
+    @ServiceProvider(service=CompileWorkerProvider.class, position=1000)
+    public static class DefaultCompileWorkerProvider implements 
CompileWorkerProvider {
+
+        @Override
+        public CompileWorker[] getWorkers(List<CompileTuple> toCompile) {
+            return new CompileWorker[] {
+                new VanillaCompileWorker()
+            };
+        }
+        
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaIndex.java
----------------------------------------------------------------------
diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaIndex.java 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaIndex.java
index a89c32b..2058f77 100644
--- 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaIndex.java
+++ 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaIndex.java
@@ -60,7 +60,7 @@ public final class JavaIndex {
     public static final String NAME = "java"; //NOI18N
     public static final int VERSION = 15;
     public static final String ATTR_MODULE_NAME = "moduleName"; //NOI18N
-    static final Logger LOG = Logger.getLogger(JavaIndex.class.getName());
+    public static final Logger LOG = 
Logger.getLogger(JavaIndex.class.getName());
     private static final String CLASSES = "classes"; //NOI18N
     private static final String APT_SOURCES = "sources";    //NOI18N
     private static final String ATTR_FILE_NAME = "attributes.properties"; 
//NOI18N

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaParsingContext.java
----------------------------------------------------------------------
diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaParsingContext.java
 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaParsingContext.java
index e56cfc1..d1dbb69 100644
--- 
a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaParsingContext.java
+++ 
b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaParsingContext.java
@@ -65,7 +65,7 @@ import org.openide.util.Pair;
 import org.openide.util.lookup.Lookups;
 
 //@NotThreadSafe
-final class JavaParsingContext {
+public final class JavaParsingContext {
 
     private final Context ctx;
     private final boolean rootNotNeeded;    
@@ -147,7 +147,7 @@ final class JavaParsingContext {
     }
     
     @CheckForNull
-    ClasspathInfo getClasspathInfo() {
+    public ClasspathInfo getClasspathInfo() {
         return cpInfo;
     }
     
@@ -157,13 +157,13 @@ final class JavaParsingContext {
     }
     
     @CheckForNull
-    String getSourceLevel() {
+    public String getSourceLevel() {
         final SourceLevelQuery.Result sl = initSourceLevel();
         return sl == null ? null : sl.getSourceLevel();
     }
 
     @CheckForNull
-    SourceLevelQuery.Profile getProfile() {
+    public SourceLevelQuery.Profile getProfile() {
         final SourceLevelQuery.Result sl = initSourceLevel();
         return sl == null ? null : sl.getProfile();
     }
@@ -195,7 +195,7 @@ final class JavaParsingContext {
     }
     
     @NonNull
-    CheckSums getCheckSums() throws IOException {
+    public CheckSums getCheckSums() throws IOException {
         if (checkSums == null) {
             try {
                 checkSums = CheckSums.forContext(ctx);
@@ -207,7 +207,7 @@ final class JavaParsingContext {
     }
     
     @NonNull
-    FQN2Files getFQNs() throws IOException {
+    public FQN2Files getFQNs() throws IOException {
         if (fqn2Files == null) {
             fqn2Files = FQN2Files.forRoot(ctx.getRootURI());
         }
@@ -223,7 +223,7 @@ final class JavaParsingContext {
     }
 
     @CheckForNull
-    String getModuleName() {
+    public String getModuleName() {
         try {
             return JavaIndex.getAttribute(ctx.getRootURI(), 
JavaIndex.ATTR_MODULE_NAME, null);
         } catch (IOException ioe) {
@@ -231,7 +231,7 @@ final class JavaParsingContext {
         }
     }
 
-    void analyze(
+    public void analyze(
             @NonNull final Iterable<? extends CompilationUnitTree> trees,
             @NonNull final JavacTaskImpl jt,
             @NonNull final CompileTuple active,

Reply via email to