You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Bruno Marti (Jira)" <ji...@apache.org> on 2019/08/26 10:39:00 UTC

[jira] [Updated] (NETBEANS-1982) Java class marks with error, but Java class don't contains any error

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

Bruno Marti updated NETBEANS-1982:
----------------------------------
    Attachment: MyTable1.java

> Java class marks with error, but Java class don't contains any error
> --------------------------------------------------------------------
>
>                 Key: NETBEANS-1982
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-1982
>             Project: NetBeans
>          Issue Type: Bug
>          Components: cnd - Editor
>    Affects Versions: 10.0
>         Environment: Linux Mint 19, JDK8
>            Reporter: Steffen Ewert
>            Priority: Major
>         Attachments: TestApp.java
>
>
> Following class file (JDK 8):
>  
> {code:java}
> public class TestApp {
>  
>  private JButton btnTest = new JButton("Test");
> public void testMethod() {
>  btnTest.addActionListener((e) -> doSomething(e));
>  btnTest.addActionListener(TestApp::doSomething);
>  }
> private void doSomething(ActionEvent e) {
>  System.out.println("Yeah!");
>  }
> }
> {code}
> Both lines 
>  
> {code:java}
> btnTest.addActionListener((e) -> doSomething(e));
> btnTest.addActionListener(TestApp::doSomething);
> {code}
> are valid Java 8 compatible lines (first line as lambda reference, second line as method reference). The editor pane don't marks one of these lines as an error (which is correct for me). But the Java file (in the project tree and the editor tab) is marked with an error icon. The "Action Items" view will be shown following error message:
> _incompatible types: invalid method reference   unexpected instance method doSomething(java.awt.event.ActionEvent) found in unbound lookup_
> Reason of this error message is the second line with the method reference. I think the error in this place is not not correct. Here I would expect no error.
> +_Workaround_+: Use lambda expressions instead of method refernce
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists