Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8188248

NullPointerException on generic methods

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b16
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "9"
        Java(TM) SE Runtime Environment (build 9+181)
        Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 10.0.15063]

        A DESCRIPTION OF THE PROBLEM :
        There are an exception on generating javadoc on generic method with generic return value.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1) Compile source code;
        2) Start generating javadoc.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Documentation in html format.
        ACTUAL -
        java.lang.NullPointerException

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        javadoc: error - An exception occurred while building a component: MethodsSummary
        (java.lang.NullPointerException)
        Please file a bug against the javadoc tool via the Java bug reporting page
        (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com)
        for duplicates. Include error messages and the following diagnostic in your report. Thank you.
        java.lang.NullPointerException
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getEnclosingTypeElement(Utils.java:2574)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.CommentHelper.getReferencedClass(CommentHelper.java:371)
        at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.seeTagToContent(HtmlDocletWriter.java:1510)
        at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter$2.visitLink(HtmlDocletWriter.java:1949)
        at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter$2.visitLink(HtmlDocletWriter.java:1797)
        at jdk.compiler/com.sun.tools.javac.tree.DCTree$DCLink.accept(DCTree.java:500)
        at jdk.compiler/com.sun.source.util.SimpleDocTreeVisitor.visit(SimpleDocTreeVisitor.java:79)
        at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.commentTagsToContent(HtmlDocletWriter.java:2017)
        at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addCommentTags(HtmlDocletWriter.java:1719)
        at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addCommentTags(HtmlDocletWriter.java:1700)
        at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter.addSummaryComment(HtmlDocletWriter.java:1670)
        at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.SubWriterHolderWriter.addIndexComment(SubWriterHolderWriter.java:207)
        at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.SubWriterHolderWriter.addSummaryLinkComment(SubWriterHolderWriter.java:243)
        at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.AbstractMemberWriter.addMemberSummary(AbstractMemberWriter.java:533)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder.buildSummary(MemberSummaryBuilder.java:359)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder.addSummary(MemberSummaryBuilder.java:515)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder.buildMethodsSummary(MemberSummaryBuilder.java:309)
        at jdk.internal.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:157)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.AbstractMemberBuilder.build(AbstractMemberBuilder.java:87)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder.buildChildren(AbstractBuilder.java:200)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.buildMemberSummary(ClassBuilder.java:333)
        at jdk.internal.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:157)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder.buildChildren(AbstractBuilder.java:200)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.buildClassDoc(ClassBuilder.java:155)
        at jdk.internal.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder.build(AbstractBuilder.java:157)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.build(ClassBuilder.java:125)
        at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:263)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:273)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:207)
        at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.run(AbstractDoclet.java:117)
        at jdk.javadoc/jdk.javadoc.doclet.StandardDoclet.run(StandardDoclet.java:72)
        at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:574)
        at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:423)
        at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:340)
        at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63)
        at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        package maksim.yarmoshyn.dal.unit_of_work;

        import maksim.yarmoshyn.dal.repository.BaseRepository;
        import maksim.yarmoshyn.dal.repository.interf.Repository;

        import java.util.HashMap;
        import java.util.Map;

        /**
         * Base Unit of Work to get repositories, than don't need special functionality.
         */
        public class UnitOfWork {

            /**
             * Map of repositories.
             */
            private final Map<Class, Object> repositoriesMap = new HashMap<>();

            /**
             * Return repository with basic functionality for TEntity.
             *
             * @param objectClass Class of the repository.
             * @return Repository for TEntity.
             */
            @Override
            public <TEntity> Repository<TEntity> getRepository(
                    final Class<TEntity> objectClass
            ) {
                if (!repositoriesMap.containsKey(objectClass)) {
                    repositoriesMap.put(objectClass, new BaseRepository<TEntity>());
                }
                return (Repository<TEntity>) repositoriesMap.get(objectClass);
            }
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Comment this code or dont generate documentation.

        SUPPORT :
        YES

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                pmuthuswamy Priya Lakshmi Muthuswamy (Inactive)
                Reporter:
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: