Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Instantiation of dependent expressions may not work

Hi,

I'm currently in the process of developing an 'Encapsulate Field'
refactoring for the CDT, and I've run into a bit of a problem that I
don't quite understand:

In order to generate getters and setters that actually compile, I have
to find out whether the field I'm encapsulating is copyable
(forwarding/move setters might need to be generated instead of a
"regular" setter). In order to achieve this, I have written the
following class:
https://github.com/sonOfRa/cdt/blob/encapsulate_field/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/encapsulatefield/CopyabilityResolver.java

This class seems to operate correctly, however for some template types
inside the standard library, like std::unique_ptr<T>, an Exception with
the following message is logged: "Unsafe method call. Instantiation of
dependent expressions may not work.", from
org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPClassSpecialization.getConstructors(PDOMCPPClassSpecialization.java:276).

It then proceeds to invoke getConstructors() with point = null. The
documentation on when this can be "unsafe" is quite sparse (or I haven't
found the right piece of documentation yet). What exactly are the
implications of calling getConstructors() (or similar methods) with a
starting point that is null, and why is this method call unsafe? The
interface does not state any thrown Exceptions, which is why I'm
wondering how this case should be correctly handled.

Best regards,
Simon Levermann



Attachment: signature.asc
Description: OpenPGP digital signature


Back to the top