Uploaded image for project: 'Maven Plugin Tools'
  1. Maven Plugin Tools
  2. MPLUGIN-320

JavaJavadocMojoDescriptorExtractor fails with Java 8 lambdas.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.5
    • Fix Version/s: 3.5.1
    • Labels:
      None

      Description

      JavaJavadocMojoDescriptorExtractor fails to parse the following source:

      package com.example.plugin;
      
      import com.amazonaws.AmazonWebServiceClient;
      import com.amazonaws.services.ecr.AmazonECRClient;
      import com.amazonaws.services.ecs.AmazonECSClient;
      
      import java.util.function.Supplier;
      
      public enum AmazonClients {
          ECS(AmazonECSClient::new),
          ECR(AmazonECRClient::new);
      
          private final Supplier<? extends AmazonWebServiceClient> supplier;
      
          <T extends AmazonWebServiceClient> AmazonClients(Supplier<T> supplier) {
              this.supplier = new SingletonSupplier<T>(supplier);
          }
      
          public <T extends AmazonWebServiceClient> T get() {
              return (T) supplier.get();
          }
      
          private static class SingletonSupplier<T> implements Supplier<T> {
              private final Supplier<T> realSupplier;
              private T instance;
      
              private SingletonSupplier(Supplier<T> realSupplier) {
                  this.realSupplier = realSupplier;
              }
      
              @Override
              public synchronized T get() {
                  return instance == null ? instance = realSupplier.get() : instance;
              }
          }
      }
      

      It fails on the lamdas in the constructors, this causes maven-plugin-plugin:helpmojo to fail with the following exception:

      Caused by: com.thoughtworks.qdox.parser.ParseException: syntax error @[10,24] in file:/home/antony/work/example/src/main/java/com/example/plugin/AmazonClients.java
              at com.thoughtworks.qdox.parser.impl.Parser.yyerror(Parser.java:1739)
              at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:1861)
              at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:1720)
              at com.thoughtworks.qdox.library.SourceLibrary.parse(SourceLibrary.java:232)
              at com.thoughtworks.qdox.library.SourceLibrary.parse(SourceLibrary.java:209)
              at com.thoughtworks.qdox.library.SourceLibrary.addSource(SourceLibrary.java:157)
              at com.thoughtworks.qdox.library.SortedClassLibraryBuilder.addSource(SortedClassLibraryBuilder.java:173)
              at com.thoughtworks.qdox.JavaProjectBuilder.addSource(JavaProjectBuilder.java:151)
              at com.thoughtworks.qdox.JavaProjectBuilder$2.visitFile(JavaProjectBuilder.java:223)
              at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:103)
              at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:91)
              at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:91)
              at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:91)
              at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:91)
              at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:91)
              at com.thoughtworks.qdox.directorywalker.DirectoryScanner.scan(DirectoryScanner.java:81)
              at com.thoughtworks.qdox.JavaProjectBuilder.addSourceTree(JavaProjectBuilder.java:217)
              at com.thoughtworks.qdox.JavaProjectBuilder.addSourceTree(JavaProjectBuilder.java:204)
              at org.apache.maven.tools.plugin.extractor.javadoc.JavaJavadocMojoDescriptorExtractor.discoverClasses(JavaJavadocMojoDescriptorExtractor.java:625)
              at org.apache.maven.tools.plugin.extractor.javadoc.JavaJavadocMojoDescriptorExtractor.execute(JavaJavadocMojoDescriptorExtractor.java:573)
              at org.apache.maven.tools.plugin.scanner.DefaultMojoScanner.populatePluginDescriptor(DefaultMojoScanner.java:96)
              at org.apache.maven.plugin.plugin.AbstractGeneratorMojo.execute(AbstractGeneratorMojo.java:283)
              at org.apache.maven.plugin.plugin.HelpGeneratorMojo.execute(HelpGeneratorMojo.java:92)
              at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
              ... 21 more
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gboue Guillaume Boué
                Reporter:
                cybertiger Antony Riley
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: