Skip to content

[Core] Rename BaseObject to BaseComponent#5934

Open
alxbilger wants to merge 7 commits intosofa-framework:masterfrom
alxbilger:basecomponent2
Open

[Core] Rename BaseObject to BaseComponent#5934
alxbilger wants to merge 7 commits intosofa-framework:masterfrom
alxbilger:basecomponent2

Conversation

@alxbilger
Copy link
Contributor

@alxbilger alxbilger commented Feb 4, 2026

This PR implements a backward-compatible transition of the core object base type from BaseObject to BaseComponent while ensuring existing code continues to compile during migration:

  • Renamed core types: All forward declarations, casts, and visitor APIs operating on objects now use BaseComponent (the new type).
  • Backward compatibility layer:
    • BaseObject is a deprecated alias for BaseComponent (ensures existing code compiles without changes).
    • #include <BaseObject.h> is a deprecated alias for #include <BaseComponent.h> (via header shim).
    • toBaseObject() is a deprecated alias for toBaseComponent() (forwarded internally to avoid breaking core builds).
  • Build configuration: Compatibility headers are exposed to downstream consumers via include directories.
  • ⚠️ Critical migration note:

This deprecation layer does not work for code using its own forward-declared BaseObject. Such code will fail with a redefinition error (e.g., BaseObject already defined). Instead of the forward declaration of BaseObject, we recommand to include <sofa/core/fwd.h>. Then, you can rename BaseObject with BaseComponent, although the deprecation layer should work.

[ci-depends-on https://github.com/sofa-framework/SofaPython3/pull/575]
[ci-depends-on https://github.com/sofa-framework/Sofa.Qt/pull/30]

[ci-build][with-all-tests]


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@alxbilger alxbilger added pr: breaking Change possibly inducing a compilation error pr: status to review To notify reviewers to review this pull-request pr: clean Cleaning the code labels Feb 4, 2026
@fredroy
Copy link
Contributor

fredroy commented Feb 5, 2026

[ci-build][with-all-tests]

@sofabot
Copy link
Collaborator

sofabot commented Feb 5, 2026

[ci-depends-on] detected during build #5.

All dependencies are merged/closed. Congrats! 👍

@sofabot
Copy link
Collaborator

sofabot commented Feb 5, 2026

[ci-depends-on] detected during build #6.

To unlock the merge button, you must

@sofabot
Copy link
Collaborator

sofabot commented Feb 5, 2026

[ci-depends-on] detected during build #7.

To unlock the merge button, you must

@sofabot
Copy link
Collaborator

sofabot commented Feb 6, 2026

[ci-depends-on] detected during build #8.

To unlock the merge button, you must

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

Labels

pr: breaking Change possibly inducing a compilation error pr: clean Cleaning the code pr: status to review To notify reviewers to review this pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants