You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Sylwester Lachiewicz (Jira)" <ji...@apache.org> on 2020/06/28 10:01:00 UTC

[jira] [Closed] (MNG-6930) Cannot use lambda as argument in a method in Mojo

     [ https://issues.apache.org/jira/browse/MNG-6930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylwester Lachiewicz closed MNG-6930.
-------------------------------------
    Resolution: Not A Problem

> Cannot use lambda as argument in a method in Mojo
> -------------------------------------------------
>
>                 Key: MNG-6930
>                 URL: https://issues.apache.org/jira/browse/MNG-6930
>             Project: Maven
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 3.6.0
>            Reporter: Abel Salgado Romero
>            Priority: Major
>
> I have a plugin with uses a component that receives a lambda as argument.
> When passing any lamba, for example the following empty one
>  
> {code:java}
>  
> Optional<File> sourceDir = new SourceDirectoryLocator(sourceDirectory, project.getBasedir(), file -> {})
>  .find();
> {code}
>  
>  `maven-plugin-plugin` fails with the error:
>  
> {code:java}
>  
> [ERROR] Failed to execute goal org.codehaus.plexus:plexus-component-metadata:1.5.5:generate-metadata (default) on project asciidoctor-maven-plugin: Error generating metadata: : Failed to extract descriptors: Index 9578 out of bounds for length 999 -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.plexus:plexus-component-metadata:1.5.5:generate-metadata (default) on project asciidoctor-maven-plugin: Error generating metadata: 
>  at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
>  
> {code}
>  
>  
> Passing `null` or an anonymous class like shown below works however.
>  
> {code:java}
>  
> Optional<File> sourceDir = new SourceDirectoryLocator(sourceDirectory, project.getBasedir(),
>  new Consumer<File>() {
>  @Override
>  public void accept(File file) {
>  getLog().info("sourceDirectory " + file + " does not exist");
>  }
>  })
>  .find();
>  
> {code}
>  
>  
> Also tested with the current SNAPSHOT and the issue still happens
> Here is the code to reprodude: [https://github.com/abelsromero/asciidoctor-maven-plugin/tree/maven-plugin-plugin-lambda-issue] . Just run `mvn clean test-compile` to see the error.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)