We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@see http://pastebin.com/RuXFsxD1 (Base class TestBean2.java) @see http://pastebin.com/Yb2Hd1Zu (Derived class DerivedBean.java) @see http://pastebin.com/EKuHNiTi (Unit test)
Unit test doesn't pass, because fields from TestBean2 base class are null. JDBM File doesn't contains inherited field definitions.
The text was updated successfully, but these errors were encountered:
I have fixed this issue.
ObjectStreamClass streamClass = ObjectStreamClass.lookup(clazz); ObjectStreamField[] fields = streamClass.getFields()
This lookup grab information for clazz, but fields doesn't contains fields from superclass. Here is a code to use instead.
private ObjectStreamField[] getFields(Class clazz) { ObjectStreamClass streamClass = ObjectStreamClass.lookup(clazz); FastArrayList<ObjectStreamField> fieldsList = new FastArrayList<ObjectStreamField>(); while (streamClass != null) { for (ObjectStreamField f : streamClass.getFields()) { fieldsList.add(f); } clazz = clazz.getSuperclass(); streamClass = ObjectStreamClass.lookup(clazz); } ObjectStreamField[] fields = new ObjectStreamField[fieldsList.size()]; for (int i = 0; i < fields.length; i++) { fields[i] = fieldsList.get(i); } return fields; }
This method should be called by SerialClassInfo class, in registerClass(Class) and writeObject(DataOutput, Object, FastArrayList) methods.
Then the unit test pass properly.
Sorry, something went wrong.
I used your fix, thanks
No branches or pull requests
@see http://pastebin.com/RuXFsxD1 (Base class TestBean2.java)
@see http://pastebin.com/Yb2Hd1Zu (Derived class DerivedBean.java)
@see http://pastebin.com/EKuHNiTi (Unit test)
Unit test doesn't pass, because fields from TestBean2 base class are null. JDBM File doesn't contains inherited field definitions.
The text was updated successfully, but these errors were encountered: