Skip to content

GaudiHandle reporting wrong type for existing component

It seems our (service) handles are reporting the wrong component type for the case when one retrieves an existing service by name only:

ServiceHandle<IMyService> h1("ServiceA/Service", "test");
BOOST_CHECK_EQUAL( h1.type(), "ServiceA" );  // OK

ServiceHandle<IMyService> h2("Service", "test");
BOOST_CHECK_EQUAL( h2.type(), "ServiceA" );  // FAILS because h2.type()=="Service"

See full test at: https://gitlab.cern.ch/fwinkl/Gaudi/-/blob/handle_type/GaudiKernel/tests/src/test_GaudiHandle.cpp

The type is constructed from [type]/name but type=name in case there is no type, which clearly is not a good assumption for the above use-case.

Do people agree this is a bug rather than a feature?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information