Skip to content

fix: don't compare strings with != in JSON codec#686

Merged
anthony-swirldslabs merged 1 commit intomainfrom
307-stringEquals
Nov 17, 2025
Merged

fix: don't compare strings with != in JSON codec#686
anthony-swirldslabs merged 1 commit intomainfrom
307-stringEquals

Conversation

@anthony-swirldslabs
Copy link
Copy Markdown
Contributor

Description:
Implementing correct string handling in JSON codec toJSON() method to avoid using != for string comparison.

Related issue(s):

Fixes #307

Notes for reviewer:
I manually inspected the generated JSON codecs for MessageWithString and Everything, and they look fine now.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
@anthony-swirldslabs anthony-swirldslabs self-assigned this Nov 17, 2025
@anthony-swirldslabs anthony-swirldslabs requested review from a team as code owners November 17, 2025 22:34
@github-actions
Copy link
Copy Markdown

JUnit Test Report

   78 files  ±0     78 suites  ±0   3m 59s ⏱️ ±0s
1 347 tests ±0  1 343 ✅ ±0   4 💤 ±0  0 ❌ ±0 
7 224 runs  ±0  7 204 ✅ ±0  20 💤 ±0  0 ❌ ±0 

Results for commit ae81d31. ± Comparison against base commit 14bc7cd.

This pull request removes 2 and adds 1 tests. Note that renamed tests count towards both.
, 1
com.hedera.pbj.runtime.Utf8ToolsTest ‑ [4] 
com.hedera.pbj.runtime.Utf8ToolsTest ‑ [4] 
, 1

@github-actions
Copy link
Copy Markdown

Integration Test Report

    409 files  ±0      409 suites  ±0   16m 10s ⏱️ + 1m 50s
114 853 tests ±0  114 853 ✅ ±0  0 💤 ±0  0 ❌ ±0 
115 094 runs  ±0  115 094 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit ae81d31. ± Comparison against base commit 14bc7cd.

This pull request removes 3 and adds 3 tests. Note that renamed tests count towards both.
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [1] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x00007f5927bea6e0@5bb58db8
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [2] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x00007f5927bea910@7c41e50d
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [3] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x00007f5927beab40@5eeab201
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [1] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x00007f92b0bc4000@59621804
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [2] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x00007f92b0bc4230@589f936c
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [3] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x00007f92b0bc4460@3d657ebd

@anthony-swirldslabs anthony-swirldslabs merged commit c2f6bdf into main Nov 17, 2025
12 checks passed
@anthony-swirldslabs anthony-swirldslabs deleted the 307-stringEquals branch November 17, 2025 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SpotBugs: generated com.hedera*Codec.toJSON() methods compares string as Objects not as their values. Must use isEmpty()

2 participants