hg: lambda/lambda/langtools: Bug fixes:

Howard Lovatt howard.lovatt at gmail.com
Wed Sep 1 19:32:12 PDT 2010


Hi Maurizio,

Sorry for not replying sooner - too busy at work!

With your example I get the same error. I investigated further and it
depends on the MLVM version used. The error occurs with:

howard-lovatts-computer-3:lambdas lov080$
jdk=/System/Library/Frameworks/JavaVM.framework/Versions/1.7.0_2010_08_18/Home/bin
howard-lovatts-computer-3:lambdas lov080$ $jdk/java -version
openjdk version "1.7.0-internal-fastdebug"
OpenJDK Runtime Environment (build
1.7.0-internal-fastdebug-stephen_2010_08_18_15_10-b00)
OpenJDK 64-Bit Server VM (build 19.0-b03-fastdebug, mixed mode)

However with an older version:

howard-lovatts-computer-3:lambdas lov080$
jdk=/System/Library/Frameworks/JavaVM.framework/Versions/1.7.0_2010_07_30/Home/bin
howard-lovatts-computer-3:lambdas lov080$ $jdk/java -version
openjdk version "1.7.0-internal-fastdebug"
OpenJDK Runtime Environment (build
1.7.0-internal-fastdebug-stephen_2010_07_30_11_56-b00)
OpenJDK Server VM (build 19.0-b03-fastdebug, mixed mode)

It works, so I guess its the latest build of the MLVM that is causing a problem.

Cheers,

 -- Howard.

On 30 August 2010 20:50, Maurizio Cimadamore
<maurizio.cimadamore at oracle.com> wrote:
>
>>> The latest push has a regression:
>>>
>>> 88:    // Method References, syntax like Javadoc
>>> 89:    final ActionListener al4 = Main#print( ActionEvent );
>>> 90:    b1.addActionListener( al4 );
>>> 91:    b1.doClick();
>>>
>>> This compiles, but when run I get:
>>>
>>> Exception in thread "main" java.dyn.WrongMethodTypeException:
>>> (Ljava/dyn/MethodHandle;Ljava/awt/event/ActionEvent;)V cannot be
>>> called as
>>> (Ljava/dyn/MethodHandle;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
>>>        at sun.dyn.FromGeneric$A2.invoke_I2(FromGeneric.java:533)
>>>        at java.dyn.MethodHandle.invokeVarargs(MethodHandle.java:332)
>>>        at com.sun.runtime.ProxyHelper$1.invoke(ProxyHelper.java:61)
>>>        at $Proxy0.actionPerformed(Unknown Source)
>>>        at
>>> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2015)
>>>        at
>>> javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2338)
>>>        at
>>> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
>>>        at
>>> javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
>>>        at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
>>>        at javax.swing.AbstractButton.doClick(AbstractButton.java:356)
>>>        at lambdas.Main.lambdas(Main.java:91)
>>>        at lambdas.Main.main(Main.java:22)
>>>
>>>
>>
> The following works for me (no exception):
>
> import java.awt.event.*;
> import javax.swing.JButton;
>
> class Test {
>
>   public static void print(ActionEvent e) { System.out.println("Hello!"); }
>
>   public static void main(String[] args) {
>      final ActionListener al4 = Test#print( ActionEvent );
>      JButton b = new JButton();
>     b.addActionListener(al4);
>     b.doClick();
>     b.removeActionListener(al4);
>  }
> }
>
> Is it close enough to your test case?
>
> Maurizio
>
>



-- 
  -- Howard.


More information about the lambda-dev mailing list