I have a list of student, List<Student>
and I am using javassist-3.9.0.GA jar.
when i am writing list.stream().collect(Collectos.grouping(Student::getCode))
it is giving Caused by: java.io.IOException: invalid constant type: 18
exception. When I change above statement as list.stream().collect(Collectos.grouping(p->p.getCode()))
it works.
Byte code manupulation of p->p.getCode()
and Student::getCode
are not same?
how above two statement is working differently while same javassist is being used?
Summary: I have a class Like:
class Student{
private String code;
private String name;
public String getCode(){
return code;
}
public void setCode(){
this.code=code;
}
public String getName(){
return name;
}
public void setName(String name){
this.name=name;
}
}
List<Student> studentList=getStudentList();
Now below statement is working fine on javassist-3.9.0.GA jar
Map<String,List<TripDetail>> tripMap=studentList.stream().collect(Collectors.groupingBy(p -> p.getCode()));
but with the same Jar below statement is giving invalid constant type: 18
exception
Map<String,List<TripDetail>> tripMap=studentList.stream().collect(Collectors.groupingBy(Student::getCode));
So as per my knowledge p -> p.getCode()
and Student::getCode
both are same,so either both should give that exception or both should be working.