Skip to content

Fixed test output, use nullptr/delete, fixed typo in comments#2440

Merged
jwillemsen merged 1 commit into
DOCGroup:masterfrom
jwillemsen:jwi-tests
Jul 29, 2025
Merged

Fixed test output, use nullptr/delete, fixed typo in comments#2440
jwillemsen merged 1 commit into
DOCGroup:masterfrom
jwillemsen:jwi-tests

Conversation

@jwillemsen
Copy link
Copy Markdown
Member

@jwillemsen jwillemsen commented Jul 29, 2025

* ACE/tests/Time_Value_Test.cpp:
* TAO/tao/DynamicAny/DynAnyUtils_T.cpp:
* TAO/tao/DynamicAny/DynAny_i.h:
* TAO/tao/DynamicAny/DynArray_i.h:
* TAO/tao/DynamicAny/DynEnum_i.h:
* TAO/tao/DynamicAny/DynStruct_i.h:
* TAO/tao/DynamicAny/DynUnion_i.h:
* TAO/tao/DynamicAny/DynValueBox_i.h:
* TAO/tao/DynamicAny/DynValueCommon_i.h:
* TAO/tao/DynamicAny/DynValue_i.cpp:
* TAO/tao/DynamicAny/DynValue_i.h:
* TAO/tests/DynValue_Test/Analyzer.h:

Summary by CodeRabbit

  • Bug Fixes

    • Improved the clarity of error messages in tests by correcting the order of expected and actual values.
  • Refactor

    • Updated class declarations to explicitly prevent copying and assignment, enhancing code safety.
    • Modernized pointer initialization and updated related documentation to reflect current best practices.
  • Style

    • Corrected multiple spelling and formatting errors in comments and documentation for better readability.

    * ACE/tests/Time_Value_Test.cpp:
    * TAO/tao/DynamicAny/DynAnyUtils_T.cpp:
    * TAO/tao/DynamicAny/DynAny_i.h:
    * TAO/tao/DynamicAny/DynArray_i.h:
    * TAO/tao/DynamicAny/DynEnum_i.h:
    * TAO/tao/DynamicAny/DynStruct_i.h:
    * TAO/tao/DynamicAny/DynUnion_i.h:
    * TAO/tao/DynamicAny/DynValueBox_i.h:
    * TAO/tao/DynamicAny/DynValueCommon_i.h:
    * TAO/tao/DynamicAny/DynValue_i.cpp:
    * TAO/tao/DynamicAny/DynValue_i.h:
    * TAO/tests/DynValue_Test/Analyzer.h:
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 29, 2025

Walkthrough

This set of changes primarily updates several classes in the TAO DynamicAny module to explicitly delete their copy constructors and assignment operators, enforcing non-copyable semantics at compile time. Additional minor updates include correcting pointer initialization to use nullptr, fixing typographical errors in comments, and improving error message formatting in a test file.

Changes

Cohort / File(s) Change Summary
Explicitly deleted copy/assignment operators
TAO/tao/DynamicAny/DynAny_i.h, TAO/tao/DynamicAny/DynArray_i.h, TAO/tao/DynamicAny/DynEnum_i.h, TAO/tao/DynamicAny/DynStruct_i.h, TAO/tao/DynamicAny/DynUnion_i.h, TAO/tao/DynamicAny/DynValueBox_i.h, TAO/tao/DynamicAny/DynValueCommon_i.h, TAO/tao/DynamicAny/DynValue_i.h
All listed classes now use = delete for copy constructors and assignment operators, making them explicitly non-copyable at compile time. Some constructor signatures were also reformatted for clarity.
Pointer initialization and comment update
TAO/tao/DynamicAny/DynAnyUtils_T.cpp
Replaces raw pointer initialization with nullptr and updates comments to reference std::unique_ptr instead of ACE_Auto_Basic_Ptr.
Typographical and comment corrections
TAO/tao/DynamicAny/DynValue_i.cpp, TAO/tao/DynamicAny/DynValue_i.h, TAO/tests/DynValue_Test/Analyzer.h
Corrects spelling of "hierarchy" and "hierarchical" in comments; no code logic changed.
Test error message formatting
ACE/tests/Time_Value_Test.cpp
Fixes the order of "expected" and "actual" values in error messages within the test_year_month function.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DynAnyClass
    Note over User, DynAnyClass: Attempt to copy or assign a DynAny class instance
    User->>DynAnyClass: Copy or assign (e.g. via copy constructor)
    DynAnyClass-->>User: Compilation error (operation explicitly deleted)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • DOCGroup/ACE_TAO#2435: Introduces the test_year_month function in ACE/tests/Time_Value_Test.cpp, which is directly affected by the error message formatting fix in this PR.

Poem

A hop, a skip, a pointer's leap,
Copying's now a thing to keep
Out of bounds—deleted, gone!
Hierarchies spelled right, code marches on.
Error messages now make sense,
This rabbit’s work is quite immense!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between de56bf3 and bb2d699.

📒 Files selected for processing (12)
  • ACE/tests/Time_Value_Test.cpp (2 hunks)
  • TAO/tao/DynamicAny/DynAnyUtils_T.cpp (4 hunks)
  • TAO/tao/DynamicAny/DynAny_i.h (1 hunks)
  • TAO/tao/DynamicAny/DynArray_i.h (1 hunks)
  • TAO/tao/DynamicAny/DynEnum_i.h (1 hunks)
  • TAO/tao/DynamicAny/DynStruct_i.h (1 hunks)
  • TAO/tao/DynamicAny/DynUnion_i.h (1 hunks)
  • TAO/tao/DynamicAny/DynValueBox_i.h (1 hunks)
  • TAO/tao/DynamicAny/DynValueCommon_i.h (2 hunks)
  • TAO/tao/DynamicAny/DynValue_i.cpp (2 hunks)
  • TAO/tao/DynamicAny/DynValue_i.h (4 hunks)
  • TAO/tests/DynValue_Test/Analyzer.h (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
TAO/tao/DynamicAny/DynStruct_i.h (2)

Learnt from: jwillemsen
PR: #2424
File: TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h:23-29
Timestamp: 2025-07-10T08:08:10.966Z
Learning: In ACE/TAO codebase, ACE_Shared_Object declares virtual init(int argc, ACE_TCHAR *argv[]) and virtual fini() methods. Classes that inherit from ACE_Shared_Object (directly or indirectly through ACE_Service_Object) should use the override specifier when overriding these methods.

Learnt from: jwillemsen
PR: #2424
File: TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h:23-29
Timestamp: 2025-07-10T08:08:10.966Z
Learning: In ACE/TAO codebase, TAO_Object_Loader inherits from ACE_Service_Object, which inherits from ACE_Shared_Object. ACE_Shared_Object declares virtual init(int argc, ACE_TCHAR *argv[]) and virtual fini() methods. Classes that inherit from TAO_Object_Loader should use the override specifier when overriding these methods.

TAO/tao/DynamicAny/DynEnum_i.h (2)

Learnt from: jwillemsen
PR: #2424
File: TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h:23-29
Timestamp: 2025-07-10T08:08:10.966Z
Learning: In ACE/TAO codebase, ACE_Shared_Object declares virtual init(int argc, ACE_TCHAR *argv[]) and virtual fini() methods. Classes that inherit from ACE_Shared_Object (directly or indirectly through ACE_Service_Object) should use the override specifier when overriding these methods.

Learnt from: jwillemsen
PR: #2424
File: TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h:23-29
Timestamp: 2025-07-10T08:08:10.966Z
Learning: In ACE/TAO codebase, TAO_Object_Loader inherits from ACE_Service_Object, which inherits from ACE_Shared_Object. ACE_Shared_Object declares virtual init(int argc, ACE_TCHAR *argv[]) and virtual fini() methods. Classes that inherit from TAO_Object_Loader should use the override specifier when overriding these methods.

TAO/tao/DynamicAny/DynValueCommon_i.h (2)

Learnt from: jwillemsen
PR: #2424
File: TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h:23-29
Timestamp: 2025-07-10T08:08:10.966Z
Learning: In ACE/TAO codebase, ACE_Shared_Object declares virtual init(int argc, ACE_TCHAR *argv[]) and virtual fini() methods. Classes that inherit from ACE_Shared_Object (directly or indirectly through ACE_Service_Object) should use the override specifier when overriding these methods.

Learnt from: jwillemsen
PR: #2424
File: TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h:23-29
Timestamp: 2025-07-10T08:08:10.966Z
Learning: In ACE/TAO codebase, TAO_Object_Loader inherits from ACE_Service_Object, which inherits from ACE_Shared_Object. ACE_Shared_Object declares virtual init(int argc, ACE_TCHAR *argv[]) and virtual fini() methods. Classes that inherit from TAO_Object_Loader should use the override specifier when overriding these methods.

TAO/tao/DynamicAny/DynArray_i.h (2)

Learnt from: jwillemsen
PR: #2424
File: TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h:23-29
Timestamp: 2025-07-10T08:08:10.966Z
Learning: In ACE/TAO codebase, ACE_Shared_Object declares virtual init(int argc, ACE_TCHAR *argv[]) and virtual fini() methods. Classes that inherit from ACE_Shared_Object (directly or indirectly through ACE_Service_Object) should use the override specifier when overriding these methods.

Learnt from: jwillemsen
PR: #2424
File: TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h:23-29
Timestamp: 2025-07-10T08:08:10.966Z
Learning: In ACE/TAO codebase, TAO_Object_Loader inherits from ACE_Service_Object, which inherits from ACE_Shared_Object. ACE_Shared_Object declares virtual init(int argc, ACE_TCHAR *argv[]) and virtual fini() methods. Classes that inherit from TAO_Object_Loader should use the override specifier when overriding these methods.

TAO/tao/DynamicAny/DynAny_i.h (2)

Learnt from: jwillemsen
PR: #2424
File: TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h:23-29
Timestamp: 2025-07-10T08:08:10.966Z
Learning: In ACE/TAO codebase, ACE_Shared_Object declares virtual init(int argc, ACE_TCHAR *argv[]) and virtual fini() methods. Classes that inherit from ACE_Shared_Object (directly or indirectly through ACE_Service_Object) should use the override specifier when overriding these methods.

Learnt from: jwillemsen
PR: #2424
File: TAO/orbsvcs/ImplRepo_Service/Locator_Loader.h:23-29
Timestamp: 2025-07-10T08:08:10.966Z
Learning: In ACE/TAO codebase, TAO_Object_Loader inherits from ACE_Service_Object, which inherits from ACE_Shared_Object. ACE_Shared_Object declares virtual init(int argc, ACE_TCHAR *argv[]) and virtual fini() methods. Classes that inherit from TAO_Object_Loader should use the override specifier when overriding these methods.

🧬 Code Graph Analysis (5)
TAO/tao/DynamicAny/DynStruct_i.h (1)
TAO/tao/DynamicAny/DynStruct_i.cpp (3)
  • TAO_DynStruct_i (12-17)
  • TAO_DynStruct_i (14-15)
  • TAO_DynStruct_i (19-21)
TAO/tao/DynamicAny/DynValue_i.h (1)
TAO/tao/DynamicAny/DynValue_i.cpp (6)
  • TAO_DynValue_i (17-17)
  • TAO_DynValue_i (24-26)
  • get_correct_base_type (148-185)
  • get_correct_base_type (149-151)
  • get_member_type (187-195)
  • get_member_type (188-190)
TAO/tao/DynamicAny/DynValueBox_i.h (1)
TAO/tao/DynamicAny/DynValueBox_i.cpp (2)
  • TAO_DynValueBox_i (14-14)
  • TAO_DynValueBox_i (21-23)
TAO/tao/DynamicAny/DynArray_i.h (1)
TAO/tao/DynamicAny/DynArray_i.cpp (3)
  • TAO_DynArray_i (12-17)
  • TAO_DynArray_i (14-15)
  • TAO_DynArray_i (19-21)
TAO/tao/DynamicAny/DynAny_i.h (1)
TAO/tao/DynamicAny/DynAny_i.cpp (3)
  • TAO_DynAny_i (16-21)
  • TAO_DynAny_i (18-19)
  • TAO_DynAny_i (23-25)
🔇 Additional comments (16)
ACE/tests/Time_Value_Test.cpp (1)

65-65: LGTM! Fixed error message argument order.

The changes correctly swap the argument order in error messages to display "expected vs actual" instead of "actual vs expected", making the error output more intuitive and consistent with standard testing conventions.

Also applies to: 76-76

TAO/tests/DynValue_Test/Analyzer.h (1)

51-51: LGTM! Fixed typo in comment.

Corrected the spelling from "hiarchical" to "hierarchical" in the documentation comment.

TAO/tao/DynamicAny/DynValue_i.cpp (1)

94-94: LGTM! Fixed typos in comments.

Corrected the spelling from "hiarchy" to "hierarchy" in two comment lines describing the derived-to-base type hierarchy.

Also applies to: 1041-1041

TAO/tao/DynamicAny/DynAnyUtils_T.cpp (2)

116-116: LGTM! Modernized pointer initialization.

Updated pointer initialization to use nullptr instead of 0, following modern C++11+ best practices.

Also applies to: 145-145


131-131: LGTM! Updated comments to reflect current implementation.

Corrected comments to reference std::unique_ptr instead of the outdated ACE_Auto_Basic_Ptr, accurately reflecting the actual implementation.

Also applies to: 160-160

TAO/tao/DynamicAny/DynEnum_i.h (1)

86-87: LGTM! Explicitly deleted copy operations.

The copy constructor and copy assignment operator are now explicitly deleted using = delete, which is a modern C++11+ best practice. This makes the non-copyable intent clear and provides better compiler error messages compared to the previous approach of private undefined declarations.

TAO/tao/DynamicAny/DynArray_i.h (1)

92-93: Excellent modernization to explicitly deleted copy operations.

Converting from the old C++03 idiom of private unimplemented copy constructor and assignment operator to the modern C++11 = delete approach improves code clarity and provides better compiler diagnostics when copying is attempted.

TAO/tao/DynamicAny/DynUnion_i.h (1)

102-103: LGTM! Modern C++ non-copyable implementation.

The explicit deletion of copy constructor and assignment operator using = delete is the preferred modern C++ approach and provides clearer intent than the previous private declaration pattern.

TAO/tao/DynamicAny/DynStruct_i.h (1)

97-98: Perfect application of modern C++ non-copyable pattern.

The explicit deletion syntax clearly communicates that TAO_DynStruct_i instances should not be copied, replacing the old private declaration idiom with the more explicit and diagnostic-friendly C++11 approach.

TAO/tao/DynamicAny/DynValueBox_i.h (1)

85-86: Consistent modernization with explicit deletion.

The change to explicitly delete copy operations aligns with modern C++ best practices and maintains consistency across the DynamicAny implementation classes.

TAO/tao/DynamicAny/DynAny_i.h (1)

80-81: Systematic modernization completed successfully.

The explicit deletion of copy operations concludes the consistent modernization pattern applied across all DynamicAny implementation classes in this PR. This improves code clarity and follows C++11+ best practices for non-copyable types.

TAO/tao/DynamicAny/DynValueCommon_i.h (2)

39-39: LGTM: Minor formatting improvement.

The spacing around the default parameter assignment improves readability.


59-60: Excellent modernization: Explicitly deleted copy operations.

Converting from private undefined copy constructor/assignment operator to explicitly deleted functions using = delete is a best practice in modern C++. This provides clearer intent and better compiler error messages when someone attempts to copy instances of this class.

TAO/tao/DynamicAny/DynValue_i.h (3)

39-39: LGTM: Minor formatting improvement.

The spacing around the default parameter assignment improves readability, consistent with the same change in DynValueCommon_i.h.


92-94: Excellent: Fixed spelling errors in comments.

All instances of "hiarchical" and "hiarchy" have been correctly changed to "hierarchical" and "hierarchy". These spelling corrections improve the documentation quality and professionalism of the codebase.

Also applies to: 103-103, 110-110, 116-116, 147-147


140-141: Excellent modernization: Explicitly deleted copy operations.

Converting from private undefined copy constructor/assignment operator to explicitly deleted functions using = delete is a best practice in modern C++. This provides clearer intent and better compiler error messages when someone attempts to copy instances of this class, consistent with the same improvement in DynValueCommon_i.h.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jwillemsen jwillemsen changed the title Fixed test output, use nullptr, fixed typo in comments Fixed test output, use nullptr/delete, fixed typo in comments Jul 29, 2025
@jwillemsen jwillemsen merged commit 57d909c into DOCGroup:master Jul 29, 2025
36 checks passed
@jwillemsen jwillemsen deleted the jwi-tests branch July 29, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant