Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayList sublcass serialization issue #6455

Closed
pveentjer opened this issue Oct 14, 2015 · 3 comments · Fixed by #6735
Closed

ArrayList sublcass serialization issue #6455

pveentjer opened this issue Oct 14, 2015 · 3 comments · Fixed by #6735
Assignees
Labels
Source: Internal PR or issue was opened by an employee Team: Client Type: Defect
Milestone

Comments

@pveentjer
Copy link
Contributor

The following example shows the problem:

public class Main  {

    public static void main(String[] args){
        HazelcastInstance hz = Hazelcast.newHazelcastInstance();
        IMap<String,Employees> map = hz.getMap("foo");
        map.put("1", new Employees());

        Employees employees = map.get("1");
        System.out.println(employees);
    }

    static class Employees extends ArrayList {

    }
}

The following exception is thrown:

Exception in thread "main" java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.hazelcast.Main$Employees
    at com.hazelcast.Main.main(Main.java:19)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

For more information see:
http://stackoverflow.com/questions/33103491/need-for-custom-serializers-while-using-derivatives-of-arraylist-as-value-in-haz

@pveentjer pveentjer added this to the 3.6 milestone Oct 14, 2015
@sancar
Copy link
Contributor

sancar commented Oct 14, 2015

@asimarslan Did we solved this problem with your last changes ? I remember some related parts.

Note: @pveentjer Serialization is in client team responsibility, I have added CLIENT label to issue.

@asimarslan
Copy link
Contributor

This is a more extended problem about class serializer search. I'll add a section in design doc in the latest serializer improvement

@pveentjer
Copy link
Contributor Author

@asimarslan is there an update or should we move this to 3.7 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Source: Internal PR or issue was opened by an employee Team: Client Type: Defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants