Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Eclipse compiler doesn't like method references with overloaded varargs method
Eclipse compiler doesn't like method references with overloaded varargs method [message #1403888] Mon, 28 July 2014 13:07 Go to next message
Tas Frangoullides is currently offline Tas FrangoullidesFriend
Messages: 16
Registered: July 2009
Junior Member
I have some code which comiles using Java 8's javac but not eclipse.

Here is an example:

@FunctionalInterface
public interface Accumalator<E> {
  void acum(Container<E> container, E data);
}

public interface Container<E> {
  public void add(E data);

  @SuppressWarnings("unchecked")
  public void add(E...data);
}

public class Binding<E> {
  private final Accumalator<E> function;
  
  public Binding() {
    function = Container::add;
  }
}


The compiler compains about the method reference "Container:add" with the message "Cannot make a static reference to the non-static method add(Object[]) from the type Container".

Removing the overloaded method "public void add(E...data)" on Container resolves the compiler error which is why I beleive it's the cause. Anyhow, when I use javac I am able to compile the code (with the overloaded varargs method) without a problem.


[Updated on: Mon, 28 July 2014 13:11]

Report message to a moderator

Re: Eclipse compiler doesn't like method references with overloaded varargs method [message #1404050 is a reply to message #1403888] Tue, 29 July 2014 10:48 Go to previous messageGo to next message
Nikolay Metchev is currently offline Nikolay MetchevFriend
Messages: 15
Registered: July 2009
Junior Member
Looks like nobody is paying attention to you Tas. I would just stick it in bugzilla.
Re: Eclipse compiler doesn't like method references with overloaded varargs method [message #1404072 is a reply to message #1404050] Tue, 29 July 2014 12:38 Go to previous message
Tas Frangoullides is currently offline Tas FrangoullidesFriend
Messages: 16
Registered: July 2009
Junior Member
Done.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=440643

Wink
Previous Topic:Best approach to Eclipse for shared projects?
Next Topic:Reference for Eclipse as-you-type compiler (or feature)
Goto Forum:
  


Current Time: Fri Nov 27 03:27:57 GMT 2020

Powered by FUDForum. Page generated in 0.01533 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top