Morgan M created NETBEANS-326:
---------------------------------

             Summary: Autocomplete does not work inside a lambda expression
                 Key: NETBEANS-326
                 URL: https://issues.apache.org/jira/browse/NETBEANS-326
             Project: NetBeans
          Issue Type: Bug
          Components: cnd - Code Completion
    Affects Versions: 8.2
         Environment: Windows 10 Enterprise
            Reporter: Morgan M
            Assignee: Morgan M
             Fix For: 8.2
         Attachments: RLtLF.png, t51Jz.png

When declaring an object with a lambda expression, autocomplete for variables 
inside the lambda does not seem to work, and instead I see global variables, 
suggestions for keywords amongst other things as shown below.
{code:java}
public class SOInner {

    private ActionListener listenerExampleLambda = e -> {
        //autocomplete DOES NOT work for these vars
        int testVarInner = 2;
        int testVarInner2 = 4;

    };

    private ActionListener listenerExampleClass = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            //autocomplete works for these vars
            int testVarInner = 2;
            int testVarInner2 = 4;
        }
    };

    private Comparable<SOInner> comparableExampleLambda = o -> {
        //autocomplete DOES NOT work for these vars        
        String testString = "Hello";
        String testString2 = "Hi";        
        return 0;
    };

    private Comparable<SOInner> comparableExampleClass = new 
Comparable<SOInner>() {
        @Override
        public int compareTo(SOInner o) {
            //autocomplete works for these vars
            String testString = "Hello";
            String testString2 = "Hi";
            return 0;
        }
    };
}
{code}
 You can reproduce the bug by placing your cursor inside the lambda expression 
under the String variables and pressing Ctrl+Space. You will notice that 
testString and testString2 do not appear. They do appear if these steps are 
reproduced from within an anonymous inner class.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to