diff -Nru netbeans-10.0/debian/changelog netbeans-10.0/debian/changelog --- netbeans-10.0/debian/changelog 2019-04-10 01:45:08.000000000 +0000 +++ netbeans-10.0/debian/changelog 2019-05-21 20:23:51.000000000 +0000 @@ -1,3 +1,18 @@ +netbeans (10.0-3ubuntu2~18.04.1) bionic-security; urgency=medium + + * Backport from Eoan to bring java11-sdk dependency and javadoc fixes in. + + -- Tiago Stürmer Daitx Tue, 21 May 2019 20:23:51 +0000 + +netbeans (10.0-3ubuntu2) eoan; urgency=medium + + * Backport upstream patch to remove old javadoc api and implementation usage + to make it work with OpenJDK 11 and later. (Closes: #925509, LP: #1828427) + * Depend on java11-sdk instead of java8-sdk as Netbeans is now configured to + run with openjdk-11. (LP: #1825604) + + -- Tiago Stürmer Daitx Tue, 21 May 2019 20:22:04 +0000 + netbeans (10.0-3~18.04.1ubuntu1) bionic; urgency=medium [ Matthias Klose ] diff -Nru netbeans-10.0/debian/control netbeans-10.0/debian/control --- netbeans-10.0/debian/control 2019-04-10 01:45:08.000000000 +0000 +++ netbeans-10.0/debian/control 2019-05-21 20:23:51.000000000 +0000 @@ -180,7 +180,7 @@ Package: netbeans Architecture: all Depends: - default-jdk | java8-sdk, + default-jdk | java11-sdk, libnb-apisupport3-java (= ${binary:Version}), libnb-ide14-java (= ${binary:Version}), libnb-java5-java (= ${binary:Version}), diff -Nru netbeans-10.0/debian/patches/nb-remove-javadoc-api.patch netbeans-10.0/debian/patches/nb-remove-javadoc-api.patch --- netbeans-10.0/debian/patches/nb-remove-javadoc-api.patch 1970-01-01 00:00:00.000000000 +0000 +++ netbeans-10.0/debian/patches/nb-remove-javadoc-api.patch 2019-05-21 20:23:51.000000000 +0000 @@ -0,0 +1,1907 @@ +Description: Remove old javadoc API and implementation + Upstream has applied a patch to Netbeans master to remove all usage + of the old javadoc API and implementation in order to make netbeans + work with OpenJDK 11 and later. + This patch backports the upstream changes to apply them over + Netbeans 10. +Author: Tiago Stürmer Daitx +Origin: upstream, https://github.com/apache/netbeans/commit/5f675e88a3ae3fee652332f9faf2f1985508c272 +Bug-Debian: https://bugs.debian.org/925509 +Bug-Ubuntu: https://launchpad.net/bugs/1828427 +Forwarded: not-needed +Applied-Upstream: https://github.com/apache/netbeans/commit/5f675e88a3ae3fee652332f9faf2f1985508c272 +Last-Update: 2019-05-16 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ + +From 5f675e88a3ae3fee652332f9faf2f1985508c272 Mon Sep 17 00:00:00 2001 +From: Jan Lahoda +Date: Tue, 9 Apr 2019 21:48:57 +0200 +Subject: [PATCH] Eliminating remaining usages of old javadoc API and + implementation + +Includes patch by arusinha to update nb-javac in libs.javacapi/libs.javacimpl to nb-javac without the old javadoc API. +--- + .../nbproject/project.properties | 2 - + .../web.jsf/nbproject/project.properties | 1 - + .../websvc/design/javamodel/JavadocModel.java | 33 -- + .../websvc/design/javamodel/Utils.java | 37 +- + .../api/java/source/ElementUtilities.java | 42 -- + .../modules/java/source/JavadocEnv.java | 438 ------------------ + .../source/indexing/VanillaCompileWorker.java | 16 +- + .../java/source/parsing/JavacParser.java | 21 +- + .../nbjavac/parsing/ContextEnhancerImpl.java | 5 +- + .../modules/javadoc/hints/Analyzer.java | 92 ++-- + .../javadoc/hints/JavadocUtilities.java | 23 +- + .../modules/javadoc/hints/Analyzer2Test.java | 19 +- + .../lib/nbjavac/services/NBClassWriter.java | 2 - + .../services/NBJavadocClassFinder.java | 59 --- + .../lib/nbjavac/services/NBJavadocEnter.java | 94 ---- + .../services/NBJavadocMemberEnter.java | 102 ---- + .../services/{NBMessager.java => NBLog.java} | 36 +- + .../lib/nbjavac/services/NBMemberEnter.java | 18 +- + .../lib/nbjavac/services/NBAttrTest.java | 2 +- + .../nbjavac/services/NBClassWriterTest.java | 4 +- + .../lib/nbjavac/services/Utilities.java | 5 +- + java/libs.javacapi/external/binaries-list | 2 +- + java/libs.javacapi/nbproject/project.xml | 1 - + java/libs.javacimpl/external/binaries-list | 2 +- + .../IntroduceLocalExtensionTransformer.java | 14 +- + .../java/plugins/MoveMembersTransformer.java | 36 +- + .../java/ui/ChangeParametersPanel.java | 6 +- + .../java/ui/IntroduceParameterPanel.java | 6 +- + .../modules/java/hints/spiimpl/Utilities.java | 21 +- + .../spi/java/hints/JavaFixUtilities.java | 15 +- + nbbuild/build.xml | 5 +- + nbbuild/templates/projectized.xml | 3 + + 32 files changed, 205 insertions(+), 957 deletions(-) + delete mode 100644 java/java.source.base/src/org/netbeans/modules/java/source/JavadocEnv.java + delete mode 100644 java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocClassFinder.java + delete mode 100644 java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocEnter.java + delete mode 100644 java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocMemberEnter.java + rename java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/{NBMessager.java => NBLog.java} (76%) + +diff --git a/enterprise/j2ee.ejbverification/nbproject/project.properties b/enterprise/j2ee.ejbverification/nbproject/project.properties +index 2804a56f76..4afe2d4c0d 100644 +--- a/enterprise/j2ee.ejbverification/nbproject/project.properties ++++ b/enterprise/j2ee.ejbverification/nbproject/project.properties +@@ -19,7 +19,5 @@ javac.source=1.7 + + # requires nb.javac for compiling of tests on Mac + requires.nb.javac=true +-# 183728: hack to make java.hints compilable even though javac impl is on the bootclasspath: +-bootclasspath.prepend=${nb_all}/libs.javacapi/external/nb-javac-api.jar${path.separator}${nb_all}/libs.javacimpl/external/nb-javac-impl.jar + # JavaEE API classes + test.unit.cp.extra=${nb_all}/enterprise/javaee7.api/external/javaee-api-7.0.jar +diff --git a/enterprise/web.jsf/nbproject/project.properties b/enterprise/web.jsf/nbproject/project.properties +index 74718b96c8..ce2b934a04 100644 +--- a/enterprise/web.jsf/nbproject/project.properties ++++ b/enterprise/web.jsf/nbproject/project.properties +@@ -33,4 +33,3 @@ test.config.stableBTD.excludes=\ + **/SyncUpdateTest.class + + requires.nb.javac=true +-bootclasspath.prepend=${nb_all}/libs.javacapi/external/nb-javac-api.jar${path.separator}${nb_all}/libs.javacimpl/external/nb-javac-impl.jar +diff --git a/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/javamodel/JavadocModel.java b/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/javamodel/JavadocModel.java +index 08c4183e5c..cc6260b1e8 100644 +--- a/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/javamodel/JavadocModel.java ++++ b/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/javamodel/JavadocModel.java +@@ -50,39 +50,6 @@ void setText(String text) { + this.text=text; + } + +- public List getInlineJavadoc() { +- return inlineJavadoc; +- } +- +- void setInlineJavadoc(List inlineJavadoc) { +- this.inlineJavadoc = inlineJavadoc; +- } +- +- public List getParamJavadoc() { +- return paramJavadoc; +- } +- +- void setParamJavadoc(List paramJavadoc) { +- this.paramJavadoc = paramJavadoc; +- } +- +- public List getThrowsJavadoc() { +- return throwsJavadoc; +- } +- +- void setThrowsJavadoc(List throwsJavadoc) { +- this.throwsJavadoc = throwsJavadoc; +- } +- +- public String getReturnJavadoc() { +- return returnJavadoc; +- } +- +- void setReturnJavadoc(String returnJavadoc) { +- this.returnJavadoc = returnJavadoc; +- } +- +- + public boolean isEqualTo(JavadocModel model) { + if (!Utils.isEqualTo(text,model.text)) return false; + return true; +diff --git a/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/javamodel/Utils.java b/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/javamodel/Utils.java +index ff6e6944fa..5367157ba1 100644 +--- a/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/javamodel/Utils.java ++++ b/enterprise/websvc.design/src/org/netbeans/modules/websvc/design/javamodel/Utils.java +@@ -94,8 +94,7 @@ + import org.openide.util.MutexException; + import org.openide.util.NbBundle; + +-import com.sun.javadoc.Doc; +-import com.sun.javadoc.Tag; ++import com.sun.source.doctree.DocCommentTree; + import com.sun.source.tree.ClassTree; + import com.sun.source.tree.MethodTree; + import com.sun.source.tree.Tree; +@@ -505,38 +504,10 @@ private static void initJavaDoc( CompilationController controller, + ExecutableElement methodEl, MethodModel methodModel ) + { + // populate javadoc +- Doc javadoc = controller.getElementUtilities().javaDocFor(methodEl); ++ DocCommentTree javadoc = controller.getDocTrees().getDocCommentTree(methodEl); + if (javadoc!=null) { + //methodModel.setJavadoc(javadoc.getRawCommentText()); +- JavadocModel javadocModel = new JavadocModel(javadoc.getRawCommentText()); +- // @param part +- Tag[] paramTags = javadoc.tags("@param"); //NOI18N +- List paramJavadoc = new ArrayList(); +- for (Tag paramTag:paramTags) { +- paramJavadoc.add(paramTag.text()); +- } +- javadocModel.setParamJavadoc(paramJavadoc); +- +- // @return part +- Tag[] returnTags = javadoc.tags("@return"); //NOI18N +- if (returnTags.length>0) { +- javadocModel.setReturnJavadoc(returnTags[0].text()); +- } +- // @throws part +- Tag[] throwsTags = javadoc.tags("@throws"); //NOI18N +- List throwsJavadoc = new ArrayList(); +- for (Tag throwsTag:throwsTags) { +- throwsJavadoc.add(throwsTag.text()); +- } +- javadocModel.setThrowsJavadoc(throwsJavadoc); +- +- // rest part +- Tag[] inlineTags = javadoc.inlineTags(); //NOI18N +- List inlineJavadoc = new ArrayList(); +- for (Tag inlineTag:inlineTags) { +- throwsJavadoc.add(inlineTag.text()); +- } +- javadocModel.setInlineJavadoc(inlineJavadoc); ++ JavadocModel javadocModel = new JavadocModel(javadoc.toString()); + methodModel.setJavadoc(javadocModel); + } + } +@@ -801,7 +772,7 @@ else if (method.getName().contentEquals(methodModel.getOperationName())) { + return; + } + +- Doc javadoc = workingCopy.getElementUtilities().javaDocFor(method); ++ DocCommentTree javadoc = workingCopy.getDocTrees().getDocCommentTree(method); + if ( javadoc != null ){ + make.removeComment(newMethod, 0, true); + } +diff --git a/java/java.source.base/src/org/netbeans/api/java/source/ElementUtilities.java b/java/java.source.base/src/org/netbeans/api/java/source/ElementUtilities.java +index 665c0e7c2e..0c1737da40 100644 +--- a/java/java.source.base/src/org/netbeans/api/java/source/ElementUtilities.java ++++ b/java/java.source.base/src/org/netbeans/api/java/source/ElementUtilities.java +@@ -18,7 +18,6 @@ + */ + package org.netbeans.api.java.source; + +-import com.sun.javadoc.Doc; + import com.sun.source.tree.CompilationUnitTree; + import com.sun.source.tree.Scope; + import com.sun.source.util.DocTrees; +@@ -47,7 +46,6 @@ + import com.sun.tools.javac.model.JavacTypes; + import com.sun.tools.javac.util.Context; + import com.sun.tools.javac.util.Names; +-import com.sun.tools.javadoc.main.DocEnv; + import java.util.ArrayDeque; + + import java.util.ArrayList; +@@ -88,7 +86,6 @@ + import org.netbeans.api.annotations.common.NonNull; + import org.netbeans.api.annotations.common.NullAllowed; + import org.netbeans.modules.java.source.builder.ElementsService; +-import org.netbeans.modules.java.source.JavadocEnv; + import org.netbeans.modules.java.source.base.SourceLevelUtils; + import org.openide.util.Parameters; + +@@ -208,45 +205,6 @@ public static String getBinaryName (TypeElement element) throws IllegalArgumentE + } + } + +- /**Get javadoc for given element. +- * @deprecated The new DocTree API should be used to traverse Javadoc comments. +- * Use {@link DocTrees#getDocCommentTree(javax.lang.model.element.Element)} instead. +- */ +- @Deprecated +- public Doc javaDocFor(Element element) { +- if (element != null) { +- DocEnv env = DocEnv.instance(ctx); +- switch (element.getKind()) { +- case ANNOTATION_TYPE: +- case CLASS: +- case ENUM: +- case INTERFACE: +- return env.getClassDoc((ClassSymbol)element); +- case ENUM_CONSTANT: +- case FIELD: +- return env.getFieldDoc((VarSymbol)element); +- case METHOD: +- if (((MethodSymbol)element).enclClass().getKind() == ElementKind.ANNOTATION_TYPE) +- return env.getAnnotationTypeElementDoc((MethodSymbol)element); +- return env.getMethodDoc((MethodSymbol)element); +- case CONSTRUCTOR: +- return env.getConstructorDoc((MethodSymbol)element); +- case PACKAGE: +- return env.getPackageDoc((PackageSymbol)element); +- } +- } +- return null; +- } +- +- /**Find a {@link Element} corresponding to a given {@link Doc}. +- * @deprecated The new DocTree API should be used to traverse Javadoc comments. +- * Use {@link DocTrees#getElement(com.sun.source.util.DocTreePath)} instead. +- */ +- @Deprecated +- public Element elementFor(Doc doc) { +- return (doc instanceof JavadocEnv.ElementHolder) ? ((JavadocEnv.ElementHolder)doc).getElement() : null; +- } +- + /** + * Returns all members of a type, whether inherited or + * declared directly. For a class the result also includes its +diff --git a/java/java.source.base/src/org/netbeans/modules/java/source/JavadocEnv.java b/java/java.source.base/src/org/netbeans/modules/java/source/JavadocEnv.java +deleted file mode 100644 +index 1de5a759b4..0000000000 +--- a/java/java.source.base/src/org/netbeans/modules/java/source/JavadocEnv.java ++++ /dev/null +@@ -1,438 +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.javadoc.ClassDoc; +-import com.sun.source.util.TreePath; +-import com.sun.tools.javac.code.Flags; +-import com.sun.tools.javac.code.Kinds; +-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.PackageSymbol; +-import com.sun.tools.javac.code.Symbol.TypeSymbol; +-import com.sun.tools.javac.code.Symbol.VarSymbol; +-import com.sun.tools.javac.code.TypeTag; +-import com.sun.tools.javac.tree.JCTree.JCClassDecl; +-import com.sun.tools.javac.util.Context; +-import com.sun.tools.javac.util.Name; +-import com.sun.tools.javac.util.Names; +-import com.sun.tools.javadoc.main.AnnotationTypeDocImpl; +-import com.sun.tools.javadoc.main.AnnotationTypeElementDocImpl; +-import com.sun.tools.javadoc.main.ClassDocImpl; +-import com.sun.tools.javadoc.main.ConstructorDocImpl; +-import com.sun.tools.javadoc.main.DocEnv; +-import com.sun.tools.javadoc.main.ExecutableMemberDocImpl; +-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; +-import org.netbeans.api.java.source.CompilationController; +-import org.netbeans.api.java.source.ElementHandle; +-import org.netbeans.api.java.source.JavaSource; +-import org.netbeans.api.java.source.JavaSource.Phase; +-import org.netbeans.api.java.source.SourceUtils; +-import org.openide.filesystems.FileObject; +-import org.openide.util.Exceptions; +- +-/** +- * +- * @author Dusan Balek +- */ +-public class JavadocEnv extends DocEnv { +- +- public static void preRegister(final Context context, final ClasspathInfo cpInfo) { +- context.put(docEnvKey, new Context.Factory() { +- public DocEnv make(Context c) { +- return new JavadocEnv(c, cpInfo); +- } +- }); +- } +- +- private ClasspathInfo cpInfo; +- private Context ctx; +- +- private JavadocEnv(Context context, ClasspathInfo cpInfo) { +- super(context); +- this.ctx = context; +- this.cpInfo = cpInfo; +- this.showAccess = new ModifierFilter(ModifierFilter.ALL_ACCESS); +- this.legacyDoclet = false; +- } +- +- @Override +- public ClassDocImpl getClassDoc(ClassSymbol clazz) { +- if (clazz.type.hasTag(TypeTag.UNKNOWN)) { +- return null; +- } +- ClassDocImpl result = classMap.get(clazz); +- if (result != null) return result; +- if (isAnnotationType(clazz)) { +- result = new JavadocAnnotation(this, clazz); +- } else { +- result = new JavadocClass(this, clazz); +- } +- classMap.put(clazz, result); +- return result; +- } +- +- @Override +- protected void makeClassDoc(ClassSymbol clazz, TreePath treePath) { +- if (clazz.type.hasTag(TypeTag.UNKNOWN)) { +- return; +- } +- ClassDocImpl result = classMap.get(clazz); +- if (result != null) { +- if (treePath != null) setTreePath(result, treePath); +- return; +- } +- if (isAnnotationType((JCClassDecl)treePath.getLeaf())) { // flags of clazz may not yet be set +- result = new JavadocAnnotation(this, clazz, treePath); +- } else { +- result = new JavadocClass(this, clazz, treePath); +- } +- classMap.put(clazz, result); +- } +- +- @Override +- public FieldDocImpl getFieldDoc(VarSymbol var) { +- FieldDocImpl result = fieldMap.get(var); +- if (result != null) return result; +- result = new JavadocField(this, var); +- fieldMap.put(var, result); +- return result; +- } +- +- @Override +- protected void makeFieldDoc(VarSymbol var, TreePath treePath) { +- FieldDocImpl result = fieldMap.get(var); +- if (result != null) { +- if (treePath != null) setTreePath(result, treePath); +- } else { +- result = new JavadocField(this, var, treePath); +- fieldMap.put(var, result); +- } +- } +- +- @Override +- public MethodDocImpl getMethodDoc(MethodSymbol meth) { +- ExecutableMemberDocImpl docImpl = methodMap.get(meth); +- if (docImpl != null && !docImpl.isMethod()) +- return null; +- MethodDocImpl result = (MethodDocImpl)docImpl; +- if (result != null) return result; +- result = new JavadocMethod(this, meth); +- methodMap.put(meth, result); +- return result; +- } +- +- @Override +- protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) { +- MethodDocImpl result = (MethodDocImpl)methodMap.get(meth); +- if (result != null) { +- if (treePath != null) setTreePath(result, treePath); +- } else { +- result = new JavadocMethod(this, meth, treePath); +- methodMap.put(meth, result); +- } +- } +- +- @Override +- public ConstructorDocImpl getConstructorDoc(MethodSymbol meth) { +- ExecutableMemberDocImpl docImpl = methodMap.get(meth); +- if (docImpl != null && !docImpl.isConstructor()) +- return null; +- ConstructorDocImpl result = (ConstructorDocImpl)docImpl; +- if (result != null) return result; +- result = new JavadocConstructor(this, meth); +- methodMap.put(meth, result); +- return result; +- } +- +- @Override +- protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) { +- ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); +- if (result != null) { +- if (treePath != null) setTreePath(result, treePath); +- } else { +- result = new JavadocConstructor(this, meth, treePath); +- methodMap.put(meth, result); +- } +- } +- +- @Override +- public AnnotationTypeElementDocImpl getAnnotationTypeElementDoc(MethodSymbol meth) { +- ExecutableMemberDocImpl docImpl = methodMap.get(meth); +- if (docImpl != null && !docImpl.isAnnotationTypeElement()) +- return null; +- AnnotationTypeElementDocImpl result = (AnnotationTypeElementDocImpl)docImpl; +- if (result != null) return result; +- result = new JavadocAnnotationTypeElement(this, meth); +- methodMap.put(meth, result); +- return result; +- } +- +- @Override +- protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath treePath) { +- AnnotationTypeElementDocImpl result = (AnnotationTypeElementDocImpl)methodMap.get(meth); +- if (result != null) { +- 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. +- * Should be called only on symbols representing annotation type elements. +- */ +- @Override +- public PackageDocImpl getPackageDoc(PackageSymbol pack) { +- PackageDocImpl result = packageMap.get(pack); +- if (result != null) return result; +- result = new JavaDocPackage(this, pack, ctx); +- packageMap.put(pack, result); +- return result; +- } +- +- @Override +- public ClassDocImpl lookupClass(String name) { +- ClassDocImpl cls = super.lookupClass(name); +- if (cls == null && name != null && !name.isEmpty()) +- cls = loadClass(name); +- return cls; +- } +- +- public interface ElementHolder { +- Element getElement(); +- } +- +- private String getRawCommentFor(Element element) { +- try { +- FileObject fo = SourceUtils.getFile(element, cpInfo); +- if (fo != null) { +- JavaSource js = JavaSource.forFileObject(fo); +- if (js != null) { +- final String[] ret = new String[1]; +- final ElementHandle handle = ElementHandle.create(element); +- js.runUserActionTask(new Task() { +- public void run(CompilationController controller) throws Exception { +- controller.toPhase(Phase.ELEMENTS_RESOLVED); +- Element e = handle.resolve(controller); +- if (e != null) +- ret[0] = controller.getElements().getDocComment(e); +- } +- },true); +- return ret[0] != null ? ret[0] : ""; //NOI18N +- } +- } +- } catch (IOException ex) { +- Exceptions.printStackTrace(ex); +- } +- return ""; //NOI18N +- } +- +- private class JavadocClass extends ClassDocImpl implements ElementHolder { +- +- private JavadocClass(DocEnv env, ClassSymbol sym) { +- super(env, sym); +- } +- +- private JavadocClass(DocEnv env, ClassSymbol sym, TreePath treePath) { +- super(env, sym, treePath); +- } +- +- @Override +- protected String documentation() { +- if (documentation == null) { +- setRawCommentText(getRawCommentFor(getElement())); +- } +- return documentation; +- } +- +- public Element getElement() { +- return tsym; +- } +- } +- +- private class JavadocAnnotation extends AnnotationTypeDocImpl implements ElementHolder { +- +- private JavadocAnnotation(DocEnv env, ClassSymbol sym) { +- super(env, sym); +- } +- +- private JavadocAnnotation(DocEnv env, ClassSymbol sym, TreePath treePath) { +- super(env, sym, treePath); +- } +- +- @Override +- protected String documentation() { +- if (documentation == null) { +- setRawCommentText(getRawCommentFor(getElement())); +- } +- return documentation; +- } +- +- public Element getElement() { +- return tsym; +- } +- } +- +- private class JavadocField extends FieldDocImpl implements ElementHolder { +- +- private JavadocField(DocEnv env, VarSymbol sym) { +- super(env, sym); +- } +- +- private JavadocField(DocEnv env, VarSymbol sym, TreePath treePath) { +- super(env, sym, treePath); +- } +- +- @Override +- protected String documentation() { +- if (documentation == null) { +- setRawCommentText(getRawCommentFor(getElement())); +- } +- return documentation; +- } +- +- public Element getElement() { +- return sym; +- } +- } +- +- private class JavadocMethod extends MethodDocImpl implements ElementHolder { +- +- private JavadocMethod(DocEnv env, MethodSymbol sym) { +- super(env, sym); +- } +- +- private JavadocMethod(DocEnv env, MethodSymbol sym, TreePath treePath) { +- super(env, sym, treePath); +- } +- +- @Override +- protected String documentation() { +- if (documentation == null) { +- setRawCommentText(getRawCommentFor(getElement())); +- } +- return documentation; +- } +- +- public Element getElement() { +- return sym; +- } +- } +- +- private class JavadocConstructor extends ConstructorDocImpl implements ElementHolder { +- +- private JavadocConstructor(DocEnv env, MethodSymbol sym) { +- super(env, sym); +- } +- +- private JavadocConstructor(DocEnv env, MethodSymbol sym, TreePath treePath) { +- super(env, sym, treePath); +- } +- +- @Override +- protected String documentation() { +- if (documentation == null) { +- setRawCommentText(getRawCommentFor(getElement())); +- } +- return documentation; +- } +- +- public Element getElement() { +- return sym; +- } +- } +- +- private class JavadocAnnotationTypeElement extends AnnotationTypeElementDocImpl implements ElementHolder { +- +- private JavadocAnnotationTypeElement(DocEnv env, MethodSymbol sym) { +- super(env, sym); +- } +- +- private JavadocAnnotationTypeElement(DocEnv env, MethodSymbol sym, TreePath treePath) { +- super(env, sym, treePath); +- } +- +- @Override +- protected String documentation() { +- if (documentation == null) { +- setRawCommentText(getRawCommentFor(getElement())); +- } +- return documentation; +- } +- +- public Element getElement() { +- return sym; +- } +- } +- +- private class JavaDocPackage extends PackageDocImpl implements ElementHolder { +- +- private JavaDocPackage(DocEnv env, PackageSymbol sym, Context ctx) { +- super(env, sym); +- } +- +- public ClassDoc findClass(String className) { +- Names nameTable = Names.instance(ctx); +- StringTokenizer st = new StringTokenizer(className, "."); //NOI18N +- TypeSymbol s = sym; +- while(s != null && st.hasMoreTokens()) { +- Name clsName = nameTable.fromString(st.nextToken()); +- TypeSymbol ts = null; +- for (Symbol symbol : s.members().getSymbolsByName(clsName)) { +- if (symbol.kind == Kinds.Kind.TYP && (symbol.flags_field & Flags.SYNTHETIC) == 0) { +- ts = (TypeSymbol)symbol; +- break; +- } +- } +- s = ts; +- } +- return s instanceof ClassSymbol ? env.getClassDoc((ClassSymbol)s) : null; +- } +- +- public Element getElement() { +- return sym; +- } +- } +-} +diff --git a/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java b/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java +index fcf16a238d..a7f4cb0164 100644 +--- a/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java ++++ b/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java +@@ -66,6 +66,7 @@ + import java.io.IOException; + import java.io.InputStream; + import java.io.OutputStream; ++import java.lang.reflect.Field; + import java.net.URL; + import java.util.*; + import java.util.Map.Entry; +@@ -598,8 +599,19 @@ private Type error2Object(Type t) { + Type.WildcardType wt = ((Type.WildcardType) t); + wt.type = error2Object(wt.type); + TypeVar tv = wt.bound; +- tv.bound = error2Object(tv.bound); +- tv.lower = error2Object(tv.lower); ++ if (tv != null) { ++ String[] boundNames = {"bound", "_bound"}; ++ for (String boundName : boundNames) { ++ try { ++ Field bound = tv.getClass().getDeclaredField(boundName); ++ bound.setAccessible(true); ++ bound.set(tv, error2Object((Type) bound.get(tv))); ++ } catch (IllegalAccessException | NoSuchFieldException | SecurityException ex) { ++ JavaIndex.LOG.log(Level.FINEST, null, ex); ++ } ++ } ++ tv.lower = error2Object(tv.lower); ++ } + break; + } + } +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 b6e8017f57..10dba1d334 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 +@@ -88,7 +88,6 @@ + import org.netbeans.modules.java.preprocessorbridge.spi.JavaFileFilterImplementation; + import org.netbeans.modules.java.source.JavaFileFilterQuery; + import org.netbeans.modules.java.source.JavaSourceAccessor; +-import org.netbeans.modules.java.source.JavadocEnv; + import org.netbeans.modules.java.source.PostFlowAnalysis; + import org.netbeans.modules.java.source.indexing.APTUtils; + import org.netbeans.modules.java.source.indexing.FQN2Files; +@@ -97,14 +96,11 @@ + import org.netbeans.lib.nbjavac.services.NBClassReader; + import org.netbeans.lib.nbjavac.services.NBEnter; + import org.netbeans.lib.nbjavac.services.NBJavaCompiler; +-import org.netbeans.lib.nbjavac.services.NBJavadocEnter; +-import org.netbeans.lib.nbjavac.services.NBJavadocMemberEnter; + import org.netbeans.lib.nbjavac.services.NBMemberEnter; + import org.netbeans.lib.nbjavac.services.NBParserFactory; + import org.netbeans.lib.nbjavac.services.NBClassWriter; + import org.netbeans.lib.nbjavac.services.NBJavacTrees; +-import org.netbeans.lib.nbjavac.services.NBJavadocClassFinder; +-import org.netbeans.lib.nbjavac.services.NBMessager; ++import org.netbeans.lib.nbjavac.services.NBLog; + import org.netbeans.lib.nbjavac.services.NBResolve; + import org.netbeans.lib.nbjavac.services.NBTreeMaker; + import org.netbeans.modules.java.source.base.SourceLevelUtils; +@@ -893,7 +889,7 @@ private static JavacTaskImpl createJavacTask( + + Context context = new Context(); + //need to preregister the Messages here, because the getTask below requires Log instance: +- NBMessager.preRegister(context, null, DEV_NULL, DEV_NULL, DEV_NULL); ++ NBLog.preRegister(context, DEV_NULL, DEV_NULL, DEV_NULL); + JavacTaskImpl task = (JavacTaskImpl)JavacTool.create().getTask(null, + ClasspathInfoAccessor.getINSTANCE().createFileManager(cpInfo, validatedSourceLevel.name), + diagnosticListener, options, files.iterator().hasNext() ? null : Arrays.asList("java.lang.Object"), files, +@@ -921,14 +917,10 @@ private static JavacTaskImpl createJavacTask( + NBJavacTrees.preRegister(context); + if (!backgroundCompilation) { + JavacFlowListener.preRegister(context, task); +- NBJavadocEnter.preRegister(context); +- NBJavadocMemberEnter.preRegister(context); +- JavadocEnv.preRegister(context, cpInfo); + NBResolve.preRegister(context); +- } else { +- NBEnter.preRegister(context); +- NBMemberEnter.preRegister(context); + } ++ NBEnter.preRegister(context); ++ NBMemberEnter.preRegister(context, backgroundCompilation); + TIME_LOGGER.log(Level.FINE, "JavaC", context); + return task; + } +@@ -1345,10 +1337,7 @@ public void setProcessors(Collection processors) { + public static class VanillaJavacContextEnhancer implements ContextEnhancer { + @Override + public void enhance(Context context, boolean backgroundCompilation) { +- if (!backgroundCompilation) +- NBJavadocClassFinder.preRegister(context); +- else +- NBClassFinder.preRegister(context); ++ NBClassFinder.preRegister(context); + NBJavaCompiler.preRegister(context); + } + } +diff --git a/java/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/parsing/ContextEnhancerImpl.java b/java/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/parsing/ContextEnhancerImpl.java +index e596ccb33b..fbe410857d 100644 +--- a/java/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/parsing/ContextEnhancerImpl.java ++++ b/java/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/parsing/ContextEnhancerImpl.java +@@ -19,7 +19,7 @@ + package org.netbeans.modules.java.source.nbjavac.parsing; + + import com.sun.tools.javac.util.Context; +-import com.sun.tools.javadoc.main.JavadocClassFinder; ++import org.netbeans.lib.nbjavac.services.NBClassFinder; + import org.netbeans.modules.java.source.parsing.JavacParser.ContextEnhancer; + import org.openide.util.lookup.ServiceProvider; + +@@ -32,8 +32,7 @@ + + @Override + public void enhance(Context context, boolean backgroundCompilation) { +- if (!backgroundCompilation) +- JavadocClassFinder.preRegister(context); ++ NBClassFinder.preRegister(context); + } + + } +diff --git a/java/javadoc/src/org/netbeans/modules/javadoc/hints/Analyzer.java b/java/javadoc/src/org/netbeans/modules/javadoc/hints/Analyzer.java +index ab8f293a55..9ef27aa2f1 100644 +--- a/java/javadoc/src/org/netbeans/modules/javadoc/hints/Analyzer.java ++++ b/java/javadoc/src/org/netbeans/modules/javadoc/hints/Analyzer.java +@@ -19,10 +19,6 @@ + + package org.netbeans.modules.javadoc.hints; + +-import com.sun.javadoc.MethodDoc; +-import com.sun.javadoc.ParamTag; +-import com.sun.javadoc.ThrowsTag; +-import com.sun.javadoc.Type; + import com.sun.source.doctree.AttributeTree; + import com.sun.source.doctree.AuthorTree; + import com.sun.source.doctree.CommentTree; +@@ -55,12 +51,14 @@ + import com.sun.source.tree.ClassTree; + import com.sun.source.tree.ExpressionTree; + import com.sun.source.tree.MethodTree; ++import com.sun.source.tree.ThrowTree; + import com.sun.source.tree.Tree; + import com.sun.source.util.DocSourcePositions; + import com.sun.source.util.DocTreePath; + import com.sun.source.util.DocTreePathScanner; + import com.sun.source.util.TreePath; + import com.sun.tools.doclint.HtmlTag; ++import java.io.IOException; + import java.util.ArrayList; + import java.util.Collections; + import java.util.Deque; +@@ -75,6 +73,7 @@ + import javax.lang.model.element.ElementKind; + import javax.lang.model.element.ExecutableElement; + import javax.lang.model.element.Name; ++import javax.lang.model.element.QualifiedNameable; + import javax.lang.model.element.TypeElement; + import javax.lang.model.type.TypeKind; + import javax.lang.model.type.TypeMirror; +@@ -82,7 +81,11 @@ + import javax.lang.model.util.Types; + import org.netbeans.api.java.source.CompilationInfo; + import org.netbeans.api.java.source.DocTreePathHandle; ++import org.netbeans.api.java.source.ElementHandle; + import org.netbeans.api.java.source.ElementUtilities; ++import org.netbeans.api.java.source.JavaSource; ++import org.netbeans.api.java.source.JavaSource.Phase; ++import org.netbeans.api.java.source.SourceUtils; + import static org.netbeans.modules.javadoc.hints.Bundle.*; + import static org.netbeans.modules.javadoc.hints.JavadocUtilities.resolveSourceVersion; + import org.netbeans.spi.editor.hints.ErrorDescription; +@@ -172,19 +175,6 @@ + case METHOD: { + ExecutableElement method = (ExecutableElement) currentElement; + ElementUtilities elUtils = javac.getElementUtilities(); +- ExecutableElement overridden = method; +- do { +- MethodDoc methodDoc = (MethodDoc) elUtils.javaDocFor(overridden); +- if(methodDoc != null) { +- for (ParamTag paramTag : methodDoc.paramTags()) { +- inheritedParams.add(paramTag.parameterName()); +- } +- for (ParamTag paramTag : methodDoc.typeParamTags()) { +- inheritedTypeParams.add(paramTag.parameterName()); +- } +- } +- +- } while((overridden = elUtils.getOverriddenMethod(overridden)) != null); + if(ctx.isCanceled()) { break; } + TypeElement typeElement = elUtils.enclosingTypeElement(currentElement); + findInheritedParams(method, typeElement, inheritedParams, inheritedTypeParams, inheritedThrows); +@@ -751,31 +741,57 @@ public Void scan(DocTree tree, List p) { + private void findInheritedParams(ExecutableElement method, TypeElement typeElement, Set inheritedParams, Set inheritedTypeParams, Set inheritedThrows) { + if(typeElement == null) return; + +- for (TypeMirror typeMirror : typeElement.getInterfaces()) { +- for (Element el : javac.getElementUtilities().getMembers(typeMirror, new ElementUtilities.ElementAcceptor() { ++ List superTypes = new ArrayList<>(); + +- @Override +- public boolean accept(Element e, TypeMirror type) { +- return e.getKind() == ElementKind.METHOD; +- } +- })) { ++ superTypes.add(typeElement.getSuperclass()); ++ superTypes.addAll(typeElement.getInterfaces()); ++ ++ for (TypeMirror typeMirror : superTypes) { ++ for (Element el : javac.getElementUtilities().getMembers(typeMirror, (e, type) -> e.getKind() == ElementKind.METHOD)) { + if(ctx.isCanceled()) { return; } + if(javac.getElements().overrides(method, (ExecutableElement) el, typeElement)) { +- MethodDoc methodDoc = (MethodDoc) javac.getElementUtilities().javaDocFor(el); +- if(methodDoc != null) { +- for (ParamTag paramTag : methodDoc.paramTags()) { +- inheritedParams.add(paramTag.parameterName()); +- } +- for (ParamTag paramTag : methodDoc.typeParamTags()) { +- inheritedTypeParams.add(paramTag.parameterName()); +- } +- for (ThrowsTag throwsTag : methodDoc.throwsTags()) { +- Type exceptionType = throwsTag.exceptionType(); +- if(exceptionType != null) { +- inheritedThrows.add(exceptionType.qualifiedTypeName()); ++ ElementHandle overriddenMethod = ElementHandle.create((ExecutableElement) el); ++ FileObject source = SourceUtils.getFile(overriddenMethod, ctx.getInfo().getClasspathInfo()); ++ if (source == null) { ++ continue; ++ } ++ try { ++ JavaSource.forFileObject(source).runUserActionTask(cc -> { ++ cc.toPhase(Phase.ELEMENTS_RESOLVED); ++ if (ctx.isCanceled()) { ++ return ; //cancel + } +- } +- returnTypeFound |= methodDoc.tags("return").length > 0; ++ ExecutableElement m = overriddenMethod.resolve(cc); ++ TreePath tp = m != null ? cc.getTrees().getPath(m) : null; ++ if (tp == null) { ++ return ; //TODO: log??? ++ } ++ DocCommentTree methodDoc = cc.getDocTrees().getDocCommentTree(tp); ++ if(methodDoc != null) { ++ for (DocTree tag : methodDoc.getBlockTags()) { ++ switch (tag.getKind()) { ++ case PARAM: ++ String name = ((ParamTree) tag).getName().getName().toString(); ++ if (((ParamTree) tag).isTypeParameter()) { ++ inheritedTypeParams.add(name); ++ } else { ++ inheritedParams.add(name); ++ } ++ break; ++ case THROWS: ++ Element thrownType = cc.getDocTrees().getElement(new DocTreePath(new DocTreePath(new DocTreePath(tp, methodDoc), tag), ((ThrowsTree) tag).getExceptionName())); ++ if (thrownType != null && thrownType.getKind().isClass()) { ++ inheritedThrows.add(((TypeElement) thrownType).getQualifiedName().toString()); ++ } ++ break; ++ case RETURN: ++ returnTypeFound |= true; ++ } ++ } ++ } ++ }, true); ++ } catch (IOException ex) { ++ LOG.log(Level.FINE, null, ex); + } + } + } +diff --git a/java/javadoc/src/org/netbeans/modules/javadoc/hints/JavadocUtilities.java b/java/javadoc/src/org/netbeans/modules/javadoc/hints/JavadocUtilities.java +index 9502d679cc..9b17ba74b8 100644 +--- a/java/javadoc/src/org/netbeans/modules/javadoc/hints/JavadocUtilities.java ++++ b/java/javadoc/src/org/netbeans/modules/javadoc/hints/JavadocUtilities.java +@@ -19,8 +19,7 @@ + + package org.netbeans.modules.javadoc.hints; + +-import com.sun.javadoc.Doc; +-import com.sun.javadoc.MethodDoc; ++import com.sun.source.doctree.DocCommentTree; + import com.sun.source.tree.ClassTree; + import com.sun.source.tree.CompilationUnitTree; + import com.sun.source.tree.ExpressionTree; +@@ -103,7 +102,7 @@ public static boolean hasInheritedDoc(CompilationInfo javac, Element elm) { + return findInheritedDoc(javac, elm) != null; + } + +- public static MethodDoc findInheritedDoc(CompilationInfo javac, Element elm) { ++ public static DocCommentTree findInheritedDoc(CompilationInfo javac, Element elm) { + if (elm.getKind() == ElementKind.METHOD) { + TypeElement clazz = (TypeElement) elm.getEnclosingElement(); + return searchInInterfaces(javac, clazz, clazz, +@@ -119,7 +118,7 @@ public static MethodDoc findInheritedDoc(CompilationInfo javac, Element elm) { + *

Do not use MethodDoc.overriddenMethod() instead since it fails for + * interfaces! + */ +- private static MethodDoc searchInInterfaces( ++ private static DocCommentTree searchInInterfaces( + CompilationInfo javac, TypeElement class2query, TypeElement overriderClass, + ExecutableElement overrider, Set exclude) { + +@@ -131,7 +130,7 @@ private static MethodDoc searchInInterfaces( + continue; + } + // check methods +- MethodDoc jdoc = searchInMethods(javac, ifceEl, overriderClass, overrider); ++ DocCommentTree jdoc = searchInMethods(javac, ifceEl, overriderClass, overrider); + if (jdoc != null) { + return jdoc; + } +@@ -142,7 +141,7 @@ private static MethodDoc searchInInterfaces( + for (TypeMirror ifceMirror : class2query.getInterfaces()) { + if (ifceMirror.getKind() == TypeKind.DECLARED) { + TypeElement ifceEl = (TypeElement) ((DeclaredType) ifceMirror).asElement(); +- MethodDoc jdoc = searchInInterfaces(javac, ifceEl, overriderClass, overrider, exclude); ++ DocCommentTree jdoc = searchInInterfaces(javac, ifceEl, overriderClass, overrider, exclude); + if (jdoc != null) { + return jdoc; + } +@@ -152,7 +151,7 @@ private static MethodDoc searchInInterfaces( + return searchInSuperclass(javac, class2query, overriderClass, overrider, exclude); + } + +- private static MethodDoc searchInSuperclass( ++ private static DocCommentTree searchInSuperclass( + CompilationInfo javac, TypeElement class2query, TypeElement overriderClass, + ExecutableElement overrider, Set exclude) { + +@@ -163,7 +162,7 @@ private static MethodDoc searchInSuperclass( + } + TypeElement superclass = (TypeElement) ((DeclaredType) superclassMirror).asElement(); + // check methods +- MethodDoc jdoc = searchInMethods(javac, superclass, overriderClass, overrider); ++ DocCommentTree jdoc = searchInMethods(javac, superclass, overriderClass, overrider); + if (jdoc != null) { + return jdoc; + } +@@ -172,16 +171,16 @@ private static MethodDoc searchInSuperclass( + return searchInInterfaces(javac, superclass, overriderClass, overrider, exclude); + } + +- private static MethodDoc searchInMethods( ++ private static DocCommentTree searchInMethods( + CompilationInfo javac, TypeElement class2query, + TypeElement overriderClass, ExecutableElement overrider) { + + for (Element elm : class2query.getEnclosedElements()) { + if (elm.getKind() == ElementKind.METHOD && + javac.getElements().overrides(overrider, (ExecutableElement) elm, overriderClass)) { +- Doc jdoc = javac.getElementUtilities().javaDocFor(elm); +- return (jdoc != null && jdoc.getRawCommentText().length() > 0)? +- (MethodDoc) jdoc: null; ++ DocCommentTree jdoc = javac.getDocTrees().getDocCommentTree(elm); ++ return (jdoc != null && !jdoc.getFullBody().isEmpty())? ++ jdoc: null; + } + } + return null; +diff --git a/java/javadoc/test/unit/src/org/netbeans/modules/javadoc/hints/Analyzer2Test.java b/java/javadoc/test/unit/src/org/netbeans/modules/javadoc/hints/Analyzer2Test.java +index c981ee3b2c..d5a5d03a43 100644 +--- a/java/javadoc/test/unit/src/org/netbeans/modules/javadoc/hints/Analyzer2Test.java ++++ b/java/javadoc/test/unit/src/org/netbeans/modules/javadoc/hints/Analyzer2Test.java +@@ -186,7 +186,13 @@ public void testInheritanceAnalyzer() throws Exception { + HintTest.create() + .input( + "package test;\n" + +- "class ZimaImpl implements Zima {\n" + ++ "class ZimaImpl extends Intermediate implements Zima {\n" + ++ " /**\n" + ++ " * \n" + ++ " */\n" + ++ " public String base(T prvniho) throws Exception {\n" + ++ " return \"\";\n" + ++ " }\n" + + " /**\n" + + " * \n" + + " */\n" + +@@ -194,6 +200,17 @@ public void testInheritanceAnalyzer() throws Exception { + " return \"\";\n" + + " }\n" + + "}\n" + ++ "abstract class Intermediate extends Base {}\n" + ++ "abstract class Base {\n" + ++ " /**\n" + ++ " * \n" + ++ " * @param prvniho \n" + ++ " * @param \n" + ++ " * @return \n" + ++ " * @throws Exception \n" + ++ " */\n" + ++ " abstract String base(T prvniho) throws Exception;\n" + ++ "}\n" + + "interface Zima {\n" + + " /**\n" + + " * \n" + +diff --git a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBClassWriter.java b/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBClassWriter.java +index 984cabccb0..9a16f9e6ad 100644 +--- a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBClassWriter.java ++++ b/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBClassWriter.java +@@ -48,13 +48,11 @@ public ClassWriter make(Context c) { + } + + private final NBNames nbNames; +- private final NBMessager nbMessager; + private final Types types; + + protected NBClassWriter(Context context) { + super(context); + nbNames = NBNames.instance(context); +- nbMessager = NBMessager.instance(context); + types = Types.instance(context); + } + +diff --git a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocClassFinder.java b/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocClassFinder.java +deleted file mode 100644 +index ad08163668..0000000000 +--- a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocClassFinder.java ++++ /dev/null +@@ -1,59 +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.lib.nbjavac.services; +- +-import com.sun.tools.javac.code.ClassFinder; +-import com.sun.tools.javac.util.Context; +-import com.sun.tools.javadoc.main.JavadocClassFinder; +-import javax.tools.JavaFileObject; +- +-/** +- * +- * @author lahvac +- */ +-public class NBJavadocClassFinder extends JavadocClassFinder { +- +- public static void preRegister(Context context) { +- context.put(classFinderKey, new Context.Factory() { +- public ClassFinder make(Context c) { +- return new NBJavadocClassFinder(c); +- } +- }); +- } +- +- public NBJavadocClassFinder(Context context) { +- super(context); +- } +- +- @Override +- protected JavaFileObject preferredFileObject(JavaFileObject a, JavaFileObject b) { +- if (b.getName().toLowerCase().endsWith(".sig")) { +- //do not prefer sources over sig files (unless sources are newer): +- boolean prevPreferSource = preferSource; +- try { +- preferSource = false; +- return super.preferredFileObject(a, b); +- } finally { +- preferSource = prevPreferSource; +- } +- } +- return super.preferredFileObject(a, b); +- } +- +-} +diff --git a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocEnter.java b/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocEnter.java +deleted file mode 100644 +index 0f98e47bba..0000000000 +--- a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocEnter.java ++++ /dev/null +@@ -1,94 +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.lib.nbjavac.services; +- +-import com.sun.tools.javac.code.Symbol.ClassSymbol; +-import com.sun.tools.javac.code.Symtab; +-import com.sun.tools.javac.comp.Enter; +-import com.sun.tools.javac.tree.JCTree; +-import com.sun.tools.javac.tree.JCTree.JCClassDecl; +-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; +-import com.sun.tools.javac.tree.TreeInfo; +-import com.sun.tools.javac.util.Context; +-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; +-import com.sun.tools.javac.util.JCDiagnostic.Error; +-import com.sun.tools.javadoc.main.JavadocEnter; +-import com.sun.tools.javadoc.main.Messager; +-import org.netbeans.lib.nbjavac.services.NBTreeMaker.IndexedClassDecl; +- +-/** +- * JavadocEnter which doesn't ignore class duplicates unlike the base JavadocEnter +- * Enter - does't ignore duplicates +- * JavadocEnter - ignors duplicates +- * NBJavadocEnter - does't ignore duplicates +- * @author Tomas Zezula +- */ +-public class NBJavadocEnter extends JavadocEnter { +- +- public static void preRegister(final Context context) { +- context.put(enterKey, new Context.Factory() { +- public Enter make(Context c) { +- return new NBJavadocEnter(c); +- } +- }); +- } +- +- private final Messager messager; +- private final CancelService cancelService; +- private final Symtab syms; +- +- protected NBJavadocEnter(Context context) { +- super(context); +- messager = Messager.instance0(context); +- cancelService = CancelService.instance(context); +- syms = Symtab.instance(context); +- } +- +- public @Override void main(com.sun.tools.javac.util.List trees) { +- //Todo: Check everytime after the java update that JavaDocEnter.main or Enter.main +- //are not changed. +- this.complete(trees, null); +- } +- +- @Override +- protected void duplicateClass(DiagnosticPosition pos, ClassSymbol c) { +- messager.error(pos, new Error("compiler", "duplicate.class", c.fullname)); +- } +- +- @Override +- public void visitClassDef(JCClassDecl tree) { +- cancelService.abortIfCanceled(); +- super.visitClassDef(tree); +- } +- +- @Override +- public void visitTopLevel(JCTree.JCCompilationUnit tree) { +- if (TreeInfo.isModuleInfo(tree) && tree.modle == syms.noModule) { +- //workaround: when source level is == 8, then visitTopLevel crashes for module-info.java +- return ; +- } +- super.visitTopLevel(tree); +- } +- +- //no @Override to ensure compatibility with ordinary javac: +- protected int getIndex(JCClassDecl clazz) { +- return clazz instanceof IndexedClassDecl ? ((IndexedClassDecl) clazz).index : -1; +- } +-} +diff --git a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocMemberEnter.java b/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocMemberEnter.java +deleted file mode 100644 +index 258059c19d..0000000000 +--- a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBJavadocMemberEnter.java ++++ /dev/null +@@ -1,102 +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.lib.nbjavac.services; +- +-import com.sun.source.util.TreePath; +-import com.sun.tools.javac.api.JavacTrees; +-import com.sun.tools.javac.code.Flags; +-import com.sun.tools.javac.comp.MemberEnter; +-import com.sun.tools.javac.tree.JCTree.JCBlock; +-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; +-import com.sun.tools.javac.tree.JCTree.JCExpression; +-import com.sun.tools.javac.tree.JCTree.JCImport; +-import com.sun.tools.javac.tree.JCTree.JCMethodDecl; +-import com.sun.tools.javac.tree.JCTree.JCVariableDecl; +-import com.sun.tools.javac.util.Context; +-import com.sun.tools.javadoc.main.JavadocMemberEnter; +- +-/** +- * +- * @author lahvac +- */ +-public class NBJavadocMemberEnter extends JavadocMemberEnter { +- +- public static void preRegister(Context context) { +- context.put(memberEnterKey, new Context.Factory() { +- public MemberEnter make(Context c) { +- return new NBJavadocMemberEnter(c); +- } +- }); +- } +- +- private final CancelService cancelService; +- private final JavacTrees trees; +- +- public NBJavadocMemberEnter(Context context) { +- super(context); +- cancelService = CancelService.instance(context); +- trees = NBJavacTrees.instance(context); +- } +- +- @Override +- public void visitTopLevel(JCCompilationUnit tree) { +- cancelService.abortIfCanceled(); +- super.visitTopLevel(tree); +- } +- +- @Override +- public void visitImport(JCImport tree) { +- cancelService.abortIfCanceled(); +- super.visitImport(tree); +- } +- +- @Override +- public void visitMethodDef(JCMethodDecl tree) { +- cancelService.abortIfCanceled(); +- JCBlock body = tree.body; +- try { +- super.visitMethodDef(tree); +- } finally { +- //reinstall body: +- tree.body = body; +- } +- if (trees instanceof NBJavacTrees && !env.enclClass.defs.contains(tree)) { +- TreePath path = trees.getPath(env.toplevel, env.enclClass); +- if (path != null) { +- ((NBJavacTrees)trees).addPathForElement(tree.sym, new TreePath(path, tree)); +- } +- } +- } +- +- @Override +- public void visitVarDef(JCVariableDecl tree) { +- cancelService.abortIfCanceled(); +- JCExpression init = tree.init; +- try { +- super.visitVarDef(tree); +- } finally { +- //reinstall init: +- tree.init = init; +- if (init != null) { +- tree.sym.flags_field |= Flags.HASINIT; //XXX: hack +- } +- } +- } +- +-} +diff --git a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBMessager.java b/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBLog.java +similarity index 76% +rename from java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBMessager.java +rename to java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBLog.java +index 3b5241f0af..e268ad7fe0 100644 +--- a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBMessager.java ++++ b/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBLog.java +@@ -18,58 +18,55 @@ + */ + package org.netbeans.lib.nbjavac.services; + +-import com.sun.javadoc.SourcePosition; + import com.sun.tools.javac.code.Symbol; + import com.sun.tools.javac.util.Context; ++import com.sun.tools.javac.util.JCDiagnostic; + import com.sun.tools.javac.util.Log; +-import com.sun.tools.javadoc.main.Messager; + import java.io.PrintWriter; + import java.net.URI; + import java.util.ArrayList; + import java.util.Collection; + import java.util.HashMap; + import java.util.Map; ++import javax.tools.Diagnostic; + import javax.tools.JavaFileObject; + + /** + * + * @author Tomas Zezula + */ +-public final class NBMessager extends Messager { ++public final class NBLog extends Log { + + private static final String ERR_NOT_IN_PROFILE = "not.in.profile"; //NOI18N + + private final Map> notInProfiles = + new HashMap<>(); + +- private NBMessager( ++ private NBLog( + final Context context, +- final String programName, + final PrintWriter errWriter, + final PrintWriter warnWriter, + final PrintWriter noticeWriter) { +- super(context, programName, errWriter, warnWriter, noticeWriter); ++ super(context, errWriter, warnWriter, noticeWriter); + } + +- public static NBMessager instance(Context context) { ++ public static NBLog instance(Context context) { + final Log log = Log.instance(context); +- if (!(log instanceof NBMessager)) { +- throw new InternalError("No NBMessager instance!"); //NOI18N ++ if (!(log instanceof NBLog)) { ++ throw new InternalError("No NBLog instance!"); //NOI18N + } +- return (NBMessager) log; ++ return (NBLog) log; + } + + public static void preRegister(Context context, +- final String programName, + final PrintWriter errWriter, + final PrintWriter warnWriter, + final PrintWriter noticeWriter) { + context.put(logKey, new Context.Factory() { + @Override + public Log make(Context c) { +- return new NBMessager( ++ return new NBLog( + c, +- programName, + errWriter, + warnWriter, + noticeWriter); +@@ -78,15 +75,14 @@ public Log make(Context c) { + } + + @Override +- public void error( +- final SourcePosition pos, +- final String key, +- final Object ... args) { +- if (ERR_NOT_IN_PROFILE.equals(key)) { ++ public void report(JCDiagnostic diagnostic) { ++ //XXX: needs testing! ++ if (diagnostic.getKind() == Diagnostic.Kind.ERROR && ++ ERR_NOT_IN_PROFILE.equals(diagnostic.getCode())) { + final JavaFileObject currentFile = currentSourceFile(); + if (currentFile != null) { + final URI uri = currentFile.toUri(); +- Symbol.ClassSymbol type = (Symbol.ClassSymbol) args[0]; ++ Symbol.ClassSymbol type = (Symbol.ClassSymbol) diagnostic.getArgs()[0]; + Collection types = notInProfiles.get(uri); + if (types == null) { + types = new ArrayList<>(); +@@ -95,7 +91,7 @@ public void error( + types.add(type); + } + } +- super.error(pos, key, args); ++ super.report(diagnostic); + } + + Collection removeNotInProfile(final URI uri) { +diff --git a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBMemberEnter.java b/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBMemberEnter.java +index 107a4ec6b5..134e342f07 100644 +--- a/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBMemberEnter.java ++++ b/java/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBMemberEnter.java +@@ -18,6 +18,8 @@ + */ + package org.netbeans.lib.nbjavac.services; + ++import com.sun.source.util.TreePath; ++import com.sun.tools.javac.api.JavacTrees; + import com.sun.tools.javac.comp.MemberEnter; + import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; + import com.sun.tools.javac.tree.JCTree.JCImport; +@@ -31,19 +33,23 @@ + */ + public class NBMemberEnter extends MemberEnter { + +- public static void preRegister(Context context) { ++ public static void preRegister(Context context, boolean backgroundScan) { + context.put(MemberEnter.class, new Context.Factory() { + public MemberEnter make(Context c) { +- return new NBMemberEnter(c); ++ return new NBMemberEnter(c, backgroundScan); + } + }); + } + + private final CancelService cancelService; ++ private final JavacTrees trees; ++ private final boolean backgroundScan; + +- public NBMemberEnter(Context context) { ++ public NBMemberEnter(Context context, boolean backgroundScan) { + super(context); + cancelService = CancelService.instance(context); ++ trees = NBJavacTrees.instance(context); ++ this.backgroundScan = backgroundScan; + } + + @Override +@@ -62,6 +68,12 @@ public void visitImport(JCImport tree) { + public void visitMethodDef(JCMethodDecl tree) { + cancelService.abortIfCanceled(); + super.visitMethodDef(tree); ++ if (!backgroundScan && trees instanceof NBJavacTrees && !env.enclClass.defs.contains(tree)) { ++ TreePath path = trees.getPath(env.toplevel, env.enclClass); ++ if (path != null) { ++ ((NBJavacTrees)trees).addPathForElement(tree.sym, new TreePath(path, tree)); ++ } ++ } + } + + @Override +diff --git a/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBAttrTest.java b/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBAttrTest.java +index 683613abf4..5891631cf6 100644 +--- a/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBAttrTest.java ++++ b/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBAttrTest.java +@@ -130,7 +130,7 @@ protected void setUp() throws Exception { + std.setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(workingDir)); + + Context context = new Context(); +- NBMessager.preRegister(context, null, DEV_NULL, DEV_NULL, DEV_NULL); ++ NBLog.preRegister(context, DEV_NULL, DEV_NULL, DEV_NULL); + NBAttr.preRegister(context); + final JavacTaskImpl ct = (JavacTaskImpl) ((JavacTool)tool).getTask(null, std, null, Arrays.asList("-source", "1.6", "-target", "1.6"), null, Arrays.asList(new MyFileObject(code)), context); + +diff --git a/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBClassWriterTest.java b/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBClassWriterTest.java +index 70357752cb..c987a2be25 100644 +--- a/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBClassWriterTest.java ++++ b/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/NBClassWriterTest.java +@@ -89,7 +89,7 @@ private void compile(String code) throws Exception { + std.setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(workingDir)); + + Context context = new Context(); +- NBMessager.preRegister(context, null, DEV_NULL, DEV_NULL, DEV_NULL); ++ NBLog.preRegister(context, DEV_NULL, DEV_NULL, DEV_NULL); + final JavacTaskImpl ct = (JavacTaskImpl) ((JavacTool)tool).getTask(null, std, null, Arrays.asList("-bootclasspath", bootPath, "-source", "1.6", "-target", "1.6"), null, Arrays.asList(new MyFileObject(code)), context); + + NBClassReader.preRegister(ct.getContext()); +@@ -109,7 +109,7 @@ private void testEnclosedByPackage(String packageName, String... expectedClassNa + std.setLocation(StandardLocation.CLASS_PATH, Collections.singleton(workingDir)); + + Context context = new Context(); +- NBMessager.preRegister(context, null, DEV_NULL, DEV_NULL, DEV_NULL); ++ NBLog.preRegister(context, DEV_NULL, DEV_NULL, DEV_NULL); + JavacTaskImpl ct = (JavacTaskImpl)((JavacTool)tool).getTask(null, std, null, Arrays.asList("-bootclasspath", bootPath, "-source", "1.8", "-target", "1.8"), null, Arrays.asList(), context); + + NBClassReader.preRegister(ct.getContext()); +diff --git a/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/Utilities.java b/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/Utilities.java +index ca52d7fc2a..cc1d1dfc3f 100644 +--- a/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/Utilities.java ++++ b/java/lib.nbjavac/test/unit/src/org/netbeans/lib/nbjavac/services/Utilities.java +@@ -21,8 +21,7 @@ + import com.sun.tools.javac.api.JavacTaskImpl; + import com.sun.tools.javac.api.JavacTool; + import com.sun.tools.javac.util.Context; +-import com.sun.tools.javadoc.main.JavadocClassFinder; +-import com.sun.tools.javadoc.main.Messager; ++import com.sun.tools.javac.util.Log; + import java.io.IOException; + import java.io.PrintWriter; + import java.io.Writer; +@@ -50,7 +49,7 @@ public static JavacTaskImpl createJavac(JavaFileManager fm, JavaFileObject... so + assert tool != null; + Context context = new Context(); + //need to preregister the Messages here, because the getTask below requires Log instance: +- Messager.preRegister(context, null, DEV_NULL, DEV_NULL, DEV_NULL); ++ Log.preRegister(context, DEV_NULL); + JavacTaskImpl task = (JavacTaskImpl)JavacTool.create().getTask(null, + fm, + null, Arrays.asList("-bootclasspath", bootPath, "-source", version, "-target", version, "-Xjcov", "-XDshouldStopPolicy=GENERATE"), null, Arrays.asList(sources), +diff --git a/java/libs.javacapi/nbproject/project.xml b/java/libs.javacapi/nbproject/project.xml +index 390c9853d3..741e1eb6a9 100644 +--- a/java/libs.javacapi/nbproject/project.xml ++++ b/java/libs.javacapi/nbproject/project.xml +@@ -28,7 +28,6 @@ + + + org.netbeans.libs.javacapi +- com.sun.javadoc + com.sun.source.doctree + com.sun.source.tree + com.sun.source.util +diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/IntroduceLocalExtensionTransformer.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/IntroduceLocalExtensionTransformer.java +index ee9e58a4ae..a53c3bc386 100644 +--- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/IntroduceLocalExtensionTransformer.java ++++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/IntroduceLocalExtensionTransformer.java +@@ -18,7 +18,7 @@ + */ + package org.netbeans.modules.refactoring.java.plugins; + +-import com.sun.javadoc.Doc; ++import com.sun.source.doctree.DocCommentTree; + import com.sun.source.tree.*; + import com.sun.source.util.SourcePositions; + import com.sun.source.util.TreePath; +@@ -516,9 +516,9 @@ private void addMember(TypeElement source, ExecutableElement member, GeneratorUt + + MethodTree newMethod = make.Method(modifiers, member.getSimpleName(), methodReturnType, newTypeParams, newParameters, newThrownTypes, make.Block(Collections.singletonList(statement), false), null, member.isVarArgs()); + newMethod = genUtils.importFQNs(newMethod); +- Doc javadoc = workingCopy.getElementUtilities().javaDocFor(member); +- if (!javadoc.getRawCommentText().isEmpty()) { +- Comment comment = Comment.create(Comment.Style.JAVADOC, javadoc.getRawCommentText()); ++ DocCommentTree javadoc = workingCopy.getDocTrees().getDocCommentTree(member); ++ if (javadoc != null && !javadoc.getFullBody().isEmpty()) { ++ Comment comment = Comment.create(Comment.Style.JAVADOC, javadoc.toString()); + make.addComment(newMethod, comment, true); + } + members.add(newMethod); +@@ -671,9 +671,9 @@ private void addConstructors(final TypeElement origClass, List members, Mo + newThrownTypes, block, null); + + newConstr = genUtils.importFQNs(newConstr); +- Doc javadoc = workingCopy.getElementUtilities().javaDocFor(constr); +- if (!javadoc.getRawCommentText().isEmpty()) { +- Comment comment = Comment.create(Comment.Style.JAVADOC, javadoc.getRawCommentText()); ++ DocCommentTree javadoc = workingCopy.getDocTrees().getDocCommentTree(constr); ++ if (javadoc != null && !javadoc.getFullBody().isEmpty()) { ++ Comment comment = Comment.create(Comment.Style.JAVADOC, javadoc.toString()); + make.addComment(newConstr, comment, true); + } + members.add(newConstr); +diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveMembersTransformer.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveMembersTransformer.java +index 9be3927e09..e9ba1d9535 100644 +--- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveMembersTransformer.java ++++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveMembersTransformer.java +@@ -18,8 +18,8 @@ + */ + package org.netbeans.modules.refactoring.java.plugins; + +-import com.sun.javadoc.Doc; +-import com.sun.javadoc.Tag; ++import com.sun.source.doctree.DocCommentTree; ++import com.sun.source.doctree.DocTree; + import com.sun.source.tree.*; + import com.sun.source.util.SourcePositions; + import com.sun.source.util.TreePath; +@@ -29,6 +29,7 @@ + import java.util.*; + import java.util.logging.Level; + import java.util.logging.Logger; ++import java.util.stream.Collectors; + import javax.lang.model.element.*; + import javax.lang.model.type.DeclaredType; + import javax.lang.model.type.TypeKind; +@@ -853,18 +854,23 @@ private boolean removeIfMatch(TreePath currentPath, Element target) throws Illeg + } + + private Comment updateJavadoc(Element method, Element targetElement, boolean addDeprecated) { +- Doc javadoc = workingCopy.getElementUtilities().javaDocFor(method); ++ DocCommentTree javadoc = workingCopy.getDocTrees().getDocCommentTree(method); + +- List otherTags = new LinkedList(Arrays.asList(javadoc.tags())); +- List returnTags = new LinkedList(Arrays.asList(javadoc.tags("@return"))); // NOI18N +- List throwsTags = new LinkedList(Arrays.asList(javadoc.tags("@throws"))); // NOI18N +- List paramTags = new LinkedList(Arrays.asList(javadoc.tags("@param"))); // NOI18N +- +- otherTags.removeAll(returnTags); +- otherTags.removeAll(throwsTags); +- otherTags.removeAll(paramTags); ++ List otherTags = new LinkedList<>(); ++ List returnTags = new LinkedList<>(); ++ List throwsTags = new LinkedList<>(); ++ List paramTags = new LinkedList<>(); ++ ++ for (DocTree tag : javadoc.getBlockTags()) { ++ switch (tag.getKind()) { ++ case RETURN: returnTags.add(tag); break; ++ case THROWS: throwsTags.add(tag); break; ++ case PARAM: paramTags.add(tag); break; ++ default: otherTags.add(tag); ++ } ++ } + +- StringBuilder text = new StringBuilder(javadoc.commentText()).append("\n\n"); // NOI18N ++ StringBuilder text = new StringBuilder(javadoc.getBody().stream().map(t -> t.toString()).collect(Collectors.joining(""))).append("\n\n"); // NOI18N + text.append(tagsToString(paramTags)); + text.append(tagsToString(returnTags)); + text.append(tagsToString(throwsTags)); +@@ -877,10 +883,10 @@ private Comment updateJavadoc(Element method, Element targetElement, boolean add + return comment; + } + +- private String tagsToString(List tags) { ++ private String tagsToString(List tags) { + StringBuilder sb = new StringBuilder(); +- for (Tag tag : tags) { +- sb.append(tag.name()).append(" ").append(tag.text()).append("\n"); // NOI18N ++ for (DocTree tag : tags) { ++ sb.append(tag.toString()).append("\n"); // NOI18N + } + return sb.toString(); + } +diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ChangeParametersPanel.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ChangeParametersPanel.java +index a864a035f8..6f7064045c 100644 +--- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ChangeParametersPanel.java ++++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/ChangeParametersPanel.java +@@ -18,7 +18,7 @@ + */ + package org.netbeans.modules.refactoring.java.ui; + +-import com.sun.javadoc.Doc; ++import com.sun.source.doctree.DocCommentTree; + import com.sun.source.tree.MethodTree; + import com.sun.source.tree.Tree; + import com.sun.source.tree.VariableTree; +@@ -201,8 +201,8 @@ public void run(org.netbeans.api.java.source.CompilationController info) { + Document.StreamDescriptionProperty, + dob); + } +- Doc javadocDoc = info.getElementUtilities().javaDocFor(e); +- if(javadocDoc.commentText() == null || javadocDoc.getRawCommentText().equals("")) { ++ DocCommentTree javadocDoc = info.getDocTrees().getDocCommentTree(e); ++ if(javadocDoc != null && !javadocDoc.getFullBody().isEmpty()) { + chkGenJavadoc.setEnabled(true); + chkGenJavadoc.setVisible(true); + chkUpdateJavadoc.setVisible(false); +diff --git a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/IntroduceParameterPanel.java b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/IntroduceParameterPanel.java +index 0ac8b25e09..5c77c57ea7 100644 +--- a/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/IntroduceParameterPanel.java ++++ b/java/refactoring.java/src/org/netbeans/modules/refactoring/java/ui/IntroduceParameterPanel.java +@@ -18,7 +18,7 @@ + */ + package org.netbeans.modules.refactoring.java.ui; + +-import com.sun.javadoc.Doc; ++import com.sun.source.doctree.DocCommentTree; + import com.sun.source.tree.MethodTree; + import com.sun.source.tree.Scope; + import com.sun.source.tree.Tree; +@@ -140,8 +140,8 @@ public void run(org.netbeans.api.java.source.CompilationController info) { + final String tm = typeMirror == null ? "Object" : typeMirror.toString(); + + Element methodElement = info.getTrees().getElement(methodPath); +- Doc javadocDoc = info.getElementUtilities().javaDocFor(methodElement); +- if(javadocDoc != null && javadocDoc.commentText() == null || javadocDoc.getRawCommentText().equals("")) { ++ DocCommentTree javadocDoc = info.getDocTrees().getDocCommentTree(methodElement); ++ if(javadocDoc != null && !javadocDoc.getFullBody().isEmpty()) { + chkGenJavadoc.setEnabled(true); + chkGenJavadoc.setVisible(true); + chkUpdateJavadoc.setVisible(false); +diff --git a/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java b/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java +index 8f5d9db786..75ff3727f3 100644 +--- a/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java ++++ b/java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java +@@ -51,6 +51,7 @@ + import com.sun.tools.javac.api.JavacTaskImpl; + import com.sun.tools.javac.api.JavacTrees; + import com.sun.tools.javac.code.Flags; ++import com.sun.tools.javac.code.Symbol.ClassSymbol; + import com.sun.tools.javac.code.Symtab; + import com.sun.tools.javac.code.Type; + import com.sun.tools.javac.comp.Annotate; +@@ -87,7 +88,6 @@ + import com.sun.tools.javac.util.ListBuffer; + import com.sun.tools.javac.util.Log; + import com.sun.tools.javac.util.Names; +-import com.sun.tools.javadoc.main.Messager; + import java.beans.PropertyChangeEvent; + import java.beans.PropertyChangeListener; + import java.io.File; +@@ -729,7 +729,9 @@ public static Scope constructScope(CompilationInfo info, Map + + long count = inc++; + +- clazz.append("public class $" + count + "{"); ++ String classname = "$$scopeclass$constraints$" + count; ++ ++ clazz.append("public class " + classname + "{"); + + for (Entry e : constraints.entrySet()) { + if (e.getValue() != null) { +@@ -752,9 +754,11 @@ public static Scope constructScope(CompilationInfo info, Map + Log log = Log.instance(context); + NBResolve resolve = NBResolve.instance(context); + Annotate annotate = Annotate.instance(context); ++ Names names = Names.instance(context); ++ Symtab syms = Symtab.instance(context); + Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(compiler.log); + +- JavaFileObject jfo = FileObjects.memoryFileObject("$", "$", new File("/tmp/$" + count + ".java").toURI(), System.currentTimeMillis(), clazz.toString()); ++ JavaFileObject jfo = FileObjects.memoryFileObject("$", "$", new File("/tmp/$$scopeclass$constraints$" + count + ".java").toURI(), System.currentTimeMillis(), clazz.toString()); + + try { + resolve.disableAccessibilityChecks(); +@@ -772,7 +776,8 @@ public static Scope constructScope(CompilationInfo info, Map + } + + JCCompilationUnit cut = compiler.parse(jfo); +- modules.enter(com.sun.tools.javac.util.List.of(cut), null); ++ ClassSymbol enteredClass = syms.enterClass(modules.getDefaultModule(), names.fromString("$$." + classname)); ++ modules.enter(com.sun.tools.javac.util.List.of(cut), enteredClass); + compiler.enterTrees(com.sun.tools.javac.util.List.of(cut)); + + Todo todo = compiler.todo; +@@ -1274,14 +1279,8 @@ public static boolean containsMultistatementTrees(List statement + return false; + } + +- public static boolean isJavadocSupported(CompilationInfo info) { +- Context c = JavaSourceAccessor.getINSTANCE().getJavacTask(info).getContext(); +- +- try { +- return c.get(Log.logKey) instanceof Messager; +- } catch (NoClassDefFoundError e) { +- return false; +- } ++ public static boolean isJavadocSupported(CompilationInfo info) { //TODO: unnecessary? ++ return true; + } + + private static class JackpotJavacParser extends NBJavacParser { +diff --git a/java/spi.java.hints/src/org/netbeans/spi/java/hints/JavaFixUtilities.java b/java/spi.java.hints/src/org/netbeans/spi/java/hints/JavaFixUtilities.java +index bcaee1740f..25dae5e4cd 100644 +--- a/java/spi.java.hints/src/org/netbeans/spi/java/hints/JavaFixUtilities.java ++++ b/java/spi.java.hints/src/org/netbeans/spi/java/hints/JavaFixUtilities.java +@@ -18,8 +18,9 @@ + */ + package org.netbeans.spi.java.hints; + +-import com.sun.javadoc.Doc; +-import com.sun.javadoc.Tag; ++import com.sun.source.doctree.DocCommentTree; ++import com.sun.source.doctree.DocTree; ++import com.sun.source.doctree.SinceTree; + import com.sun.source.tree.AnnotationTree; + import com.sun.source.tree.AssignmentTree; + import com.sun.source.tree.BinaryTree; +@@ -304,12 +305,16 @@ private static void checkDependency(CompilationInfo copy, Element e, boolean can + static SpecificationVersion computeSpecVersion(CompilationInfo info, Element el) { + if (!Utilities.isJavadocSupported(info)) return null; + +- Doc javaDoc = info.getElementUtilities().javaDocFor(el); ++ DocCommentTree javaDoc = info.getDocTrees().getDocCommentTree(el); + + if (javaDoc == null) return null; + +- for (Tag since : javaDoc.tags("@since")) { +- String text = since.text(); ++ for (DocTree tag : javaDoc.getBlockTags()) { ++ if (tag.getKind() != DocTree.Kind.SINCE) { ++ continue; ++ } ++ ++ String text = ((SinceTree) tag).getBody().toString(); + + Matcher m = SPEC_VERSION.matcher(text); + +diff --git a/nbbuild/templates/projectized.xml b/nbbuild/templates/projectized.xml +index 36b280a4b3..d6bba53b7f 100644 +--- a/nbbuild/templates/projectized.xml ++++ b/nbbuild/templates/projectized.xml +@@ -112,6 +112,9 @@ If you are sure you want to build with JDK 9+ anyway, use: -Dpermit.jdk9.builds= + compilecp="test.qa-functional.compile.cp" + compiledep="test.qa-functional.testdep"/> + ++ ++ ++ + + + diff -Nru netbeans-10.0/debian/patches/series netbeans-10.0/debian/patches/series --- netbeans-10.0/debian/patches/series 2019-04-10 01:33:59.000000000 +0000 +++ netbeans-10.0/debian/patches/series 2019-05-21 20:23:51.000000000 +0000 @@ -35,3 +35,4 @@ Unsafe.patch nb-javac.patch revert-netbeans-clusters +nb-remove-javadoc-api.patch