Skip to content

Change the structure of object reference for the json logger #5

Description

@LeoDefossez

The issue is with how object references are currently logged, meaning StringReference, ArrayReference, and ClassReference

For example, for an array reference, the current JSON structure looks like this:

"reference": {
            "type": "java.lang.String[]",
            "uniqueId": 72,
            "refered": {
              "elements": []
            }
}
  • reference being an object reference
  • refered can be :
    • the fields of a class reference
    • elements of an array reference
    • value of the String reference
      This design makes it hard to quickly understand what kind of object we’re dealing with.

Proposal 1: Flatten the structure
Instead of having a generic "reference" object with a "refered" field, we can directly log the specific type of reference.
Example for an array:

"ArrayReference":{
             "type": "java.lang.String[]",
            "uniqueId": 72,
            "elements": []
}

This way, there’s no extra “wrapper” for all ObjectReference types.

Proposal 2: Keep a wrapper but be explicit
If we still want a generic ObjectReference container, we can make the type explicit inside it:

"ObjectReference":{ 
    "type": "java.lang.String[]",
    "uniqueId": 72,
    "ArrayReference":{
            "elements": []
      }
}

This option could be helpfull for the importer for FamixCallStack, but is less space efficient for the outputted file

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions