Skip to content

JSONObject#populateMap() calls methods that aren't valid object getters #279

@run2000

Description

@run2000

JSONObject.populateMap() can be a over-enthusiastic in calling methods on an object that aren't valid bean getter methods. For instance:

  • It will call static get methods that otherwise pass all the tests for validity.
  • It will call get methods with a void return type
  • It will call a get method that is a synthetic method -- typically the result of overriding a superclass

My opinion is that populateMap() should be more cautious about calling methods on an unknown object. There may be side-effecty behaviour within the object that's undesirable. Code to avoid doing this is trivial and fast.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions