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

Michael Bien closed NETBEANS-4680.
----------------------------------
    Fix Version/s: 12.4
       Resolution: Fixed

> No code completion in Stream#map() function's lambda expression body unless 
> there is a return statement already
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: NETBEANS-4680
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-4680
>             Project: NetBeans
>          Issue Type: Bug
>          Components: java - Hints
>            Reporter: KoKo
>            Priority: Major
>             Fix For: 12.4
>
>
> For the given code:
> {code:java}
> import java.util.Arrays;
> import java.util.List;
> import java.util.stream.Collectors;
> public class Test {
>     static class Student {
>         private Integer id;
>         private Integer age;
>         private String gender;
>         private String firstName;
>         private String lastName;
>         public Integer getId() {
>             return id;
>         }
>         public void setId(Integer id) {
>             this.id = id;
>         }
>         public Integer getAge() {
>             return age;
>         }
>         public void setAge(Integer age) {
>             this.age = age;
>         }
>         public String getGender() {
>             return gender;
>         }
>         public void setGender(String gender) {
>             this.gender = gender;
>         }
>         public String getFirstName() {
>             return firstName;
>         }
>         public void setFirstName(String firstName) {
>             this.firstName = firstName;
>         }
>         public String getLastName() {
>             return lastName;
>         }
>         public void setLastName(String lastName) {
>             this.lastName = lastName;
>         }
>         public Student(Integer id, Integer age, String gender, String 
> firstName, String lastName) {
>             this.id = id;
>             this.age = age;
>             this.gender = gender;
>             this.firstName = firstName;
>             this.lastName = lastName;
>         }
>     }
>     public static void main(String[] args) {
>         Student e1 = new Student(1, 23, "M", "Rick", "Beethoven");
>         Student e2 = new Student(2, 13, "F", "Martina", "Hengis");
>         Student e3 = new Student(3, 43, "M", "Ricky", "Martin");
>         Student e4 = new Student(4, 26, "M", "Jon", "Lowman");
>         Student e5 = new Student(5, 19, "F", "Cristine", "Maria");
>         List<Student> students = Arrays.asList(e1, e2, e3, e4, e5);
>         students.stream()
>                 .map(s -> {
>                     s.setAge(s.getAge() + 1);
>                     return s;                                                 
>             
>                 })
>                 .collect(Collectors.toList());
>     }
> }
> {code}
> if I comment the the *return statement* in Stream#map() function, there will 
> be no code completion in map function and after map function.
> {code:java}
> students.stream()
>       .map(s -> {
>           s.setAge(s.getAge() + 1); // no code completion for getter and 
> setter here
>           // return s;                                                        
>      
>       })
>       .collect(Collectors.toList()); // no code completion here
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
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