@ExtensionMethod just fails in Eclipse #777

lombokissues opened this Issue Jul 14, 2015 · 5 comments


None yet

1 participant


Migrated from Google Code (issue 742)


👤 bb010g   🕗 Oct 09, 2014 at 01:58 UTC

What steps will reproduce the problem?

  1. Make a new Java Project "Project" in Eclipse.
  2. Set up Lombok in the project.
  3. Make the file "Buggy.java" (listing below).
  4. Compile.

What is the expected output? What do you see instead?
I expect the class to compile.
Instead I receive an error:
Description "The method method(int, java.lang.String) in the type Buggy.Extensions is not applicable for the arguments (int, java.lang.String)", resource "Buggy.java", path "/Project/Source", location "line 10", type "Java Problem".

What version of the product are you using? On what operating system?
Lombok v1.14.8 "Branching Cobra"
Eclipse Luna Release (4.4.0)
OpenJDK 1.8.0_40

Please provide any additional information below.

method seems to work with a String argument. If you use Object for either argument of method, it works. Moving Extensions out of Buggy (either within the file or into "Extensions.java") doesn't change anything.


import lombok.experimental.ExtensionMethod;

@ ExtensionMethod({Buggy.Extensions.class})
public class Buggy {
static class Extensions {
public static void method(int that, String foo) {}

public void bug() {



👤 fabianohler   🕗 Jan 13, 2015 at 10:41 UTC

Hi, I have a problem with @ ExtensionMethod, too. It compiles fine with javac, but Eclipse complains in different ways.
I modified the ExtensionMethod example java class and get two different errors:
The first one (using the extension method Arrays.stream) directly pops up and Eclipse can't seem to infer the type of the stream thus complaining that String::toUpperCase is not applicable for Object.
If you instead directly use Arrays.stream, eclipse gives a red marker at the beginning of the file and a dialog pops up with the following information:

at org.eclipse.jdt.internal.compiler.ast.ReferenceExpression.shouldGenerateImplicitLambda(ReferenceExpression.java:183)
at org.eclipse.jdt.internal.compiler.ast.ReferenceExpression.generateCode(ReferenceExpression.java:194)
at org.eclipse.jdt.internal.compiler.ast.Statement.generateArguments(Statement.java:287)
at org.eclipse.jdt.internal.compiler.ast.MessageSend.generateCode(MessageSend.java:425)
at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.generateCode(LocalDeclaration.java:151)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:325)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:270)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:566)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:635)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:368)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1210)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:689)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1183)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:809)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:544)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:537)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:480)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:470)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:470)
at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:128)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:170)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup$3.run(SelectionListenerWithASTManager.java:155)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


import java.util.Arrays;
import java.util.function.IntFunction;
import java.util.stream.Stream;

import lombok.experimental.ExtensionMethod;

@ ExtensionMethod({ java.util.Arrays.class, Extensions.class})
public class ExtensionMethodExample {
public String test() {
final String[] strings = { "Hell", "o", " Wor", "ld!" };
final String[] streamedComplainsAboutStringToUpperCase =
final String[] streamedComplainsAboutWholeFileWithErrorDialog =
return null;

class Extensions {
public static T[] safeToArray(final Stream stream,
final IntFunction<T[]> gen) {
return stream.toArray(gen);

Tested on
Lombok v1.14.8
Eclipse Luna (4.4.1)
java version "1.8.0_40-ea"
Java(TM) SE Runtime Environment (build 1.8.0_40-ea-b19)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b23, mixed mode)


👤 r.spilker   🕗 Jan 21, 2015 at 01:12 UTC

Will be in the next release.


👤 fabianohler   🕗 Feb 11, 2015 at 10:40 UTC

just tested my example again with 1.16.2 and one of the errors disappeared, but I can't get rid of the
The method safeToArray(Stream, IntFunction<T[]>) in the type Extensions is not applicable for the arguments (Stream)

error message (still compiles fine with javac)

Tested on
Lombok v1.16.2
Eclipse Luna (4.4.1)
java version "1.8.0_40-ea"
Java(TM) SE Runtime Environment (build 1.8.0_40-ea-b21)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b24, mixed mode)


End of migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment