-
Notifications
You must be signed in to change notification settings - Fork 0
Class instrumentation fixes #19
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
WalkthroughThis PR adds type-reporting methods to Elemental node classes, enhances instrumentation logging with SLF4J, removes version-based gating from instrumentation routing, modifies result conversion logic to handle JsonNode instances, and removes default type handling from unsupported value implementations. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
src/main/java/com/flowingcode/vaadin/jsonmigration/ClassInstrumentationUtil.java (5)
45-46: Prefer a static logger field for this utility
ClassInstrumentationUtilis effectively stateless and instantiated per version; you can avoid per-instance loggers and follow common SLF4J practice by using a static field, e.g.private static final Logger LOGGER = LoggerFactory.getLogger(ClassInstrumentationUtil.class);, and then usingLOGGERthroughout.Also applies to: 62-62
121-123: Consider lowering “no instrumentation needed” log to DEBUG
instrumentClassmay be called frequently; logging every non‑instrumented class at INFO can clutter logs in larger apps. Consider DEBUG (or TRACE) for this message, possibly with class name instead of theClassobject if you want a more compact output.
256-257: Marking generated subclasses asfinalmay be a behavioral changeAdding
Opcodes.ACC_FINALmeans callers can no longer subclass the instrumented class. If any code previously extended these instrumented types (even if uncommon), this becomes a breaking change. Please confirm that instrumented classes are intended to be terminal implementation types; otherwise, consider droppingACC_FINALor documenting this constraint.
370-371: Per-method override logging at INFO could be noisy
logger.info("Override {}", method);will emit one INFO log per instrumented method. Since this runs during bytecode generation, it may be fine, but for applications with many callables it could get chatty. Consider DEBUG/TRACE here, or gating behind a dedicated flag, while maybe keeping a single INFO summary per class if needed.
377-379: Access mask now includesACC_PRIVATE– confirm private callables use caseIncluding
Opcodes.ACC_PRIVATEin the access mask means the generated method in the subclass will also be private when the original method is private, and your MethodHandle path will be used to reach the original implementation. This seems intended to support private@ClientCallable/@LegacyClientCallablemethods, but it does slightly change visibility compared to a purely public/protected override strategy. Please double‑check this matches Vaadin’s expectations for callable discovery and doesn’t conflict with any upstream behavior you intend to mirror.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
src/main/java/com/flowingcode/vaadin/jsonmigration/ClassInstrumentationUtil.java(5 hunks)src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalArrayNode.java(2 hunks)src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalBooleanNode.java(2 hunks)src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalNullNode.java(2 hunks)src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalNumberNode.java(2 hunks)src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalObjectNode.java(2 hunks)src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalStringNode.java(2 hunks)src/main/java/com/flowingcode/vaadin/jsonmigration/InstrumentationViewInitializer.java(1 hunks)src/main/java/com/flowingcode/vaadin/jsonmigration/JsonMigrationHelper25.java(1 hunks)src/main/java/com/flowingcode/vaadin/jsonmigration/UnsupportedJsonValueImpl.java(0 hunks)
💤 Files with no reviewable changes (1)
- src/main/java/com/flowingcode/vaadin/jsonmigration/UnsupportedJsonValueImpl.java
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-25T16:35:42.544Z
Learnt from: javier-godoy
Repo: FlowingCode/JsonMigrationHelper PR: 11
File: src/main/java/com/flowingcode/vaadin/jsonmigration/JsonSerializer.java:281-301
Timestamp: 2025-11-25T16:35:42.544Z
Learning: In the JsonMigrationHelper project, code copied from the Vaadin codebase should be kept consistent with the original source unless there's a specific reason to deviate.
Applied to files:
src/main/java/com/flowingcode/vaadin/jsonmigration/JsonMigrationHelper25.javasrc/main/java/com/flowingcode/vaadin/jsonmigration/ElementalBooleanNode.javasrc/main/java/com/flowingcode/vaadin/jsonmigration/ElementalNumberNode.javasrc/main/java/com/flowingcode/vaadin/jsonmigration/ElementalNullNode.javasrc/main/java/com/flowingcode/vaadin/jsonmigration/ElementalArrayNode.javasrc/main/java/com/flowingcode/vaadin/jsonmigration/ElementalStringNode.javasrc/main/java/com/flowingcode/vaadin/jsonmigration/InstrumentationViewInitializer.javasrc/main/java/com/flowingcode/vaadin/jsonmigration/ClassInstrumentationUtil.javasrc/main/java/com/flowingcode/vaadin/jsonmigration/ElementalObjectNode.java
🧬 Code graph analysis (1)
src/main/java/com/flowingcode/vaadin/jsonmigration/InstrumentationViewInitializer.java (1)
src/main/java/com/flowingcode/vaadin/jsonmigration/JsonMigration.java (1)
JsonMigration(44-208)
🔇 Additional comments (8)
src/main/java/com/flowingcode/vaadin/jsonmigration/JsonMigrationHelper25.java (1)
69-70: LGTM! JsonNode passthrough logic is correct.The addition of
instanceof JsonNodecheck allows ElementalNode instances (which extend Jackson JsonNode classes) to be returned directly, avoiding unnecessary conversion. This aligns well with the newgetType()methods added to all ElementalNode classes in this PR.src/main/java/com/flowingcode/vaadin/jsonmigration/InstrumentationViewInitializer.java (1)
56-56: LGTM! Good simplification by delegating version handling.Removing the version check here is appropriate since
JsonMigration.instrumentClass()already handles version detection internally, returning the original class for Vaadin 24 and earlier or an instrumented class for Vaadin 25+.src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalObjectNode.java (1)
55-58: LGTM! Type reporting implementation is correct.The
getType()override correctly returnsJsonType.OBJECT, consistent with the pattern applied across all Elemental*Node classes in this PR.src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalStringNode.java (1)
32-35: LGTM! Type reporting implementation is correct.The
getType()override correctly returnsJsonType.STRING, consistent with the pattern applied across all Elemental*Node classes.src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalNullNode.java (1)
37-40: LGTM! Type reporting implementation is correct.The
getType()override correctly returnsJsonType.NULL, consistent with the pattern applied across all Elemental*Node classes.src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalNumberNode.java (1)
42-45: LGTM! Type reporting implementation is correct.The
getType()override correctly returnsJsonType.NUMBER, consistent with the pattern applied across all Elemental*Node classes.src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalBooleanNode.java (1)
32-35: LGTM! Type reporting implementation is correct.The
getType()override correctly returnsJsonType.BOOLEAN, consistent with the pattern applied across all Elemental*Node classes.src/main/java/com/flowingcode/vaadin/jsonmigration/ElementalArrayNode.java (1)
53-56: LGTM! Type reporting implementation is correct.The
getType()override correctly returnsJsonType.ARRAY, consistent with the pattern applied across all Elemental*Node classes.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.