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

Fix anno deserialization when class field is not first #2501

Merged
merged 1 commit into from
Mar 25, 2022

Conversation

fabianschuiki
Copy link
Contributor

Update findTypeHints to allow for the "class" field in JSON objects to appear anywhere in the object. This used to rely on the field being the very first in the object, which is easily violated when reading JSON data generated externally, since an object's order of fields is unspecified and can be arbitrarily scrambled.

Fixes #2497.

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you update the FIRRTL spec to include every new feature/behavior?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you state the API impact?
  • Did you specify the code generation impact?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

Bug fix

API Impact

None

Backend Code Generation Impact

None

Desired Merge Strategy

Squash

Release Notes

Allow for annotation deserialization class hints to appear anywhere in a JSON object, not just the first field.

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels?
  • Did you mark the proper milestone (1.2.x, 1.3.0, 1.4.0) ?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you mark as Please Merge?

Update `findTypeHints` to allow for the "class" field in JSON objects to
appear anywhere in the object. This used to rely on the field being the
very first in the object, which is easily violated when reading JSON
data generated externally, since an object's order of fields is
unspecified and can be arbitrarily scrambled.

Fixes chipsalliance#2497.
Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@seldridge seldridge added this to the 1.4.x milestone Mar 25, 2022
@seldridge seldridge added the Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. label Mar 25, 2022
@mergify mergify bot merged commit a2d48a5 into chipsalliance:master Mar 25, 2022
mergify bot pushed a commit that referenced this pull request Mar 25, 2022
Update `findTypeHints` to allow for the "class" field in JSON objects to
appear anywhere in the object. This used to rely on the field being the
very first in the object, which is easily violated when reading JSON
data generated externally, since an object's order of fields is
unspecified and can be arbitrarily scrambled.

Fixes #2497.

(cherry picked from commit a2d48a5)

# Conflicts:
#	src/main/scala/firrtl/annotations/JsonProtocol.scala
mergify bot pushed a commit that referenced this pull request Mar 25, 2022
Update `findTypeHints` to allow for the "class" field in JSON objects to
appear anywhere in the object. This used to rely on the field being the
very first in the object, which is easily violated when reading JSON
data generated externally, since an object's order of fields is
unspecified and can be arbitrarily scrambled.

Fixes #2497.

(cherry picked from commit a2d48a5)
@mergify mergify bot added the Backported This PR has been backported to marked stable branch label Mar 25, 2022
mergify bot added a commit that referenced this pull request Mar 25, 2022
Update `findTypeHints` to allow for the "class" field in JSON objects to
appear anywhere in the object. This used to rely on the field being the
very first in the object, which is easily violated when reading JSON
data generated externally, since an object's order of fields is
unspecified and can be arbitrarily scrambled.

Fixes #2497.

(cherry picked from commit a2d48a5)

Co-authored-by: Fabian Schuiki <[email protected]>
mergify bot added a commit that referenced this pull request Mar 25, 2022
… (#2502)

* Fix anno deserialization when class field is not first (#2501)

Update `findTypeHints` to allow for the "class" field in JSON objects to
appear anywhere in the object. This used to rely on the field being the
very first in the object, which is easily violated when reading JSON
data generated externally, since an object's order of fields is
unspecified and can be arbitrarily scrambled.

Fixes #2497.

(cherry picked from commit a2d48a5)

# Conflicts:
#	src/main/scala/firrtl/annotations/JsonProtocol.scala

* fixup! Fix anno deserialization when class field is not first (#2501)

Co-authored-by: Fabian Schuiki <[email protected]>
Co-authored-by: Schuyler Eldridge <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Backported This PR has been backported to marked stable branch Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Annotation deserialization should not rely on "class" coming first
2 participants