-
Notifications
You must be signed in to change notification settings - Fork 900
Implement support for serializing POJOs to JSON #12
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
Conversation
I took the modifications in Without these changes, the JS on reddit fails because it tries to JSONify an array of The conflicts in this PR are trivial. They are modifying build.xml and .gitignore. And those modifications don't seem to be essential for this PR. Would be great if @pfn can chip in. I can make a fresh PR without the conflicts, if required. |
Just a followup: I analysed the minified JS from reddit. It is calling JSON.stringify on the stack trace because it captures exceptions and sends them to the server. All that is working fine with the changes in this PR (modulo the changes in build.xml). |
Thanks for revisiting this -- I'm honestly not sure about this whole PR (the original one) because I'm not sure what exact problem it's trying to solve and as you pointed out, it changes a bit of code. I am concerned if Reddit has some JS that fails when trying to print the stack trace, especially since we just changed that code in 1.7.6. Can you point to the code? Perhaps we need to tweak the stack trace changes a bit. |
The Reddit code is humongous. But here is a one liner:
Sample output:
|
I've checked 1_7R5 release and it seems that there's the same issue: NativeError cannot be I'll look more closely on this tomorrow. |
Yep, I see that... I think it's something that we have to fix. I think we should move this out of this particular PR, however, and make it a separate issue. |
This PR generically allows all java objects to be serializable to JSON; the side-effect is that what @hrj wants now works. And yeah, I'm not interested in updating it since I'm not using rhino anymore. |
@gbrail Thanks for creating the issue #182 for this. @sainaen et al, I am trying to summarize this PR and the issue, based on my understanding, which may be way off. Please correct me if I have it wrong. During a call to However, this PR gets the properties of a Java object by looking at its bean properties. However, this is very likely not desired. It is the wrapper object that should decide what properties to expose to JS land. So, the
If I am atleast somewhere close to understanding this, I can try to create a new PR. |
I believe this patch (or something similar to it) is being used in production by the folks at NetSuite, as their Rhino environment happily stringifies Java objects and arrays. It would be great to see something like that land in upstream Rhino. |
?is this fixed in the latest release in 2018? |
Am closing this PR because:
|
No description provided.