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

Javadoc crashes when method name ends with "Property"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u20, 9
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b39
    • CPU:
      x86_64
    • OS:
      windows_7
    • Verification:
      Verified

      Backports

        Description

        FULL PRODUCT VERSION :


        ADDITIONAL OS VERSION INFORMATION :
        Windows 7, Ubuntu, probably all

        A DESCRIPTION OF THE PROBLEM :
        When generating javadoc if there is method that ends with "Property" java doc fails.
         

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Generate javadoc for the following class

        public class Utils {
            /**
             * Create a new SimpleListProperty with an empty ObservableList instantiated.
             *
             * @param <T> The type.
             * @return The property.
             */
            public static <T> SimpleListProperty<T> newSimpleListProperty() {
                return new SimpleListProperty<>(FXCollections.<T>observableArrayList());
            }
        }

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        To generate javadoc.
        ACTUAL -
        It fails with error message: Exit code: 1 - javadoc: error - com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: java.lang.ClassCastException: com.sun.tools.doclets.formats.html.PropertyWriterImpl cannot be cast to com.sun.tools.doclets.formats.html.AbstractExecutableMemberWriter

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        MavenReportException: Error while creating archive:
        Exit code: 1 - javadoc: error - com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: java.lang.ClassCastException: com.sun.tools.doclets.formats.html.PropertyWriterImpl cannot be cast to com.sun.tools.doclets.formats.html.AbstractExecutableMemberWriter

        Command line was: "C:\Program Files\Java\jdk1.8.0_20\jre\..\bin\javadoc.exe" @options @packages

        Refer to the generated Javadoc files in 'C:\Users\goran\Documents\NetBeansProjects\anahata-jfx\target\apidocs' dir.

        org.apache.maven.reporting.MavenReportException:
        Exit code: 1 - javadoc: error - com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: java.lang.ClassCastException: com.sun.tools.doclets.formats.html.PropertyWriterImpl cannot be cast to com.sun.tools.doclets.formats.html.AbstractExecutableMemberWriter

        Command line was: "C:\Program Files\Java\jdk1.8.0_20\jre\..\bin\javadoc.exe" @options @packages

        Refer to the generated Javadoc files in 'C:\Users\goran\Documents\NetBeansProjects\anahata-jfx\target\apidocs' dir.

        at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeJavadocCommandLine(AbstractJavadocMojo.java:5074)
        at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:1999)
        at org.apache.maven.plugin.javadoc.JavadocJar.execute(JavadocJar.java:181)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleThreadedBuilder$1.call(LifecycleThreadedBuilder.java:167)
        at org.apache.maven.lifecycle.internal.LifecycleThreadedBuilder$1.call(LifecycleThreadedBuilder.java:163)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        public class Utils {
            /**
             * Create a new SimpleListProperty with an empty ObservableList instantiated.
             *
             * @param <T> The type.
             * @return The property.
             */
            public static <T> SimpleListProperty<T> newSimpleListProperty() {
                return new SimpleListProperty<>(FXCollections.<T>observableArrayList());
            }
        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Change method name so it does not end with "Property"

        For example:
         public static <T> SimpleListProperty<T> newListPropertySimple() {
                return new SimpleListProperty<>(FXCollections.<T>observableArrayList());
            }

          Issue Links

            Activity

            Hide
            igerasim Ivan Gerasimov added a comment -
            The simplest reproducer is

            public class Test {
                public <T> Object fProperty() { return null; }
            }

            The issue is reproduced with the latest 9, 8 and 7.
            javadoc form 6 and 5 processes this code fine.
            Show
            igerasim Ivan Gerasimov added a comment - The simplest reproducer is public class Test {     public <T> Object fProperty() { return null; } } The issue is reproduced with the latest 9, 8 and 7. javadoc form 6 and 5 processes this code fine.
            Hide
            pardesha Pardeep Sharma added a comment -
            Tested with 8u20 on windows 7.
            Show
            pardesha Pardeep Sharma added a comment - Tested with 8u20 on windows 7.
            Hide
            ksrini Kumar Srinivasan added a comment - - edited
            A potential fix.

            diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java
            --- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java
            +++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java
            @@ -656,7 +656,7 @@
                     // properties aren't named setA* or getA*
                     private final Pattern pattern = Pattern.compile("[sg]et\\p{Upper}.*");
                     private boolean isPropertyMethod(MethodDoc method) {
            - if (!method.name().endsWith("Property")) {
            + if (!(method.name().endsWith("Property") && configuration.javafx)) {
                             return false;
                         }

            Show
            ksrini Kumar Srinivasan added a comment - - edited A potential fix. diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java --- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java +++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java @@ -656,7 +656,7 @@          // properties aren't named setA* or getA*          private final Pattern pattern = Pattern.compile("[sg]et\\p{Upper}.*");          private boolean isPropertyMethod(MethodDoc method) { - if (!method.name().endsWith("Property")) { + if (!(method.name().endsWith("Property") && configuration.javafx)) {                  return false;              }
            Hide
            jjg Jonathan Gibbons added a comment - - edited
            @Kumar, you are not asking the correct question. This is not a property getter/setter returning a parameterized type. It is declaring (but not using) a type argument. The return type is plain old java.jang.Object. The <T> between "public" and "Object" declares type arguments for the method in the same way that <T> in "class MyClass<T> {...}" declares a generic type.

            So, @Kevin,
            Can a property getter/setter in JavaFX ever be a generic method? I'd be surprised if the answer is not "no", but we did want to double check with you.
            Show
            jjg Jonathan Gibbons added a comment - - edited @Kumar, you are not asking the correct question. This is not a property getter/setter returning a parameterized type. It is declaring (but not using) a type argument. The return type is plain old java.jang.Object. The <T> between "public" and "Object" declares type arguments for the method in the same way that <T> in "class MyClass<T> {...}" declares a generic type. So, @Kevin, Can a property getter/setter in JavaFX ever be a generic method? I'd be surprised if the answer is not "no", but we did want to double check with you.
            Hide
            ksrini Kumar Srinivasan added a comment -
            ILW -> HLL -> P4
            Show
            ksrini Kumar Srinivasan added a comment - ILW -> HLL -> P4
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/dev/langtools/rev/9fd9a50e7994
            User: ksrini
            Date: 2014-10-31 13:57:34 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/langtools/rev/9fd9a50e7994 User: ksrini Date: 2014-10-31 13:57:34 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/langtools/rev/9fd9a50e7994
            User: lana
            Date: 2014-11-12 17:57:04 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/langtools/rev/9fd9a50e7994 User: lana Date: 2014-11-12 17:57:04 +0000

              People

              • Assignee:
                ksrini Kumar Srinivasan
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: