Closed JamesHR3 closed 5 years ago
Hi James - is this predominantly a special case unique to the sample? Or a sign that this change may break a nontrivial number of apps out there in the wild? (I think I saw some discussion on Slack but asking here for posterity)
We don't believe it is a special case, @shamsasari had to make several changes to the samples in Corda to make them compile after the change, I suspect while not an API break in the 'traditional' sense, it will confuse our users, if we can mitigate it (relatively simply) within Corda then that might be a better solution.
It's not a special case in the sense that it's something an app developer might reasonably want to do - allow someone to decide whether they want to be anonymous, and to use either AnonymousParty
or Party
accordingly. I think what makes this tricky is that whether an app developer hits the problem depends entirely on how the app developer structures their code. It's plausible therefore that someone could hit this in the wild.
ok - thanks... sounds like we need to fix the feature then if we're breaking legitimate apps :(
Closing as this as fix to be done in Corda
Re-opening following the conversation on CORDA-3082.
A change introduced by https://r3-cev.atlassian.net/browse/CID-878 has exposed a type inference limitation in the compiler that is unfortunately hit by one of our samples. CID-878 introduces a
Destination
interface that is implemented by bothAnonymousParty
andParty
. Both of these subclassAbstractParty
. The sample in question uses a variable that is conditionally one ofAnonymousParty
orParty
, depending on whether a flag is set. This variable is only used as anAbstractParty
. Without the extraDestination
interface, the compiler can infer this with no further annotation, however the addition of this interface confuses the compiler and causes it to treat the variable asAny
- which then breaks when an attempt is made to use it as anAbstractParty
.This fix adds just enough type annotations to convince the compiler that the variable is in fact an
AbstractParty
.