Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

SupportNonPublicField不支持parse基类的private成员 #1494

Closed
dwing4g opened this issue Sep 25, 2017 · 5 comments
Closed

SupportNonPublicField不支持parse基类的private成员 #1494

dwing4g opened this issue Sep 25, 2017 · 5 comments
Labels
Milestone

Comments

@dwing4g
Copy link

dwing4g commented Sep 25, 2017

加SupportNonPublicField特性parse到类中普通的private成员没有问题,
但这个类如果有基类, 那么基类的private成员应该也能支持parse吧?
目前的1.2.38版貌似不支持.

@neil4dong
Copy link
Contributor

这个属于java语言的特性哈。 父类的private 的属性, 在子类是不可见的

@dwing4g
Copy link
Author

dwing4g commented Sep 25, 2017

parser赋值private成员就已经破坏语言特性了吧, 肯定用反射机制去赋值的,
既然用了反射, 基类也应该可以反射赋值的.

@wenshao wenshao added the bug label Sep 25, 2017
@wenshao wenshao added this to the 1.2.39 milestone Sep 25, 2017
@vipcxj
Copy link

vipcxj commented Sep 27, 2017

我觉得基类private字段不一定要支持,protect肯定要支持的,package看情况

wenshao added a commit that referenced this issue Oct 1, 2017
@wenshao
Copy link
Member

wenshao commented Oct 1, 2017

https://github.com/alibaba/fastjson/releases/tag/1.2.39
问题已经修复,请用新版本

@wenshao wenshao closed this as completed Oct 1, 2017
@vipcxj
Copy link

vipcxj commented Oct 2, 2017

如果不加判断直接支持父类的private字段,很容易引发新问题吧,毕竟父类的private字段对子类是完全不可见的,比如子类同样可以声明同名的父类的private字段

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants