On Thu, Jul 29, 2010 at 11:57 AM, kelvin goodson
<[email protected]> wrote:
> Can anyone help me understand this bit of code please?  In particular
> I need to understand what if any are the preconditions for this method
> that imply that -- "The interface is not assignable from the interface
> contract" -- is not an exceptional condition.
>
> On Fri, Oct 5, 2007 at 5:19 PM,  <[email protected]> wrote:
>> Author: rfeng
>> Date: Fri Oct  5 09:19:11 2007
>> New Revision: 582334
>>
>> URL: http://svn.apache.org/viewvc?rev=582334&view=rev
>> Log:
>> Create JavaInterfaceContract instead of clone which will mix the 
>> WSDLInterfaceContract and JavaInterface
>>
>> Modified:
>>    
>> incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
>>
>> Modified: 
>> incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
>> URL: 
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java?rev=582334&r1=582333&r2=582334&view=diff
>> ==============================================================================
>> --- 
>> incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
>>  (original)
>> +++ 
>> incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
>>  Fri Oct  5 09:19:11 2007
>> @@ -317,8 +317,13 @@
>>         }
>>         if (!compatible) {
>>             // The interface is not assignable from the interface contract
>> -            interfaceContract = 
>> (InterfaceContract)interfaceContract.clone();
>> -            
>> interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
>> +            interfaceContract = 
>> javaInterfaceFactory.createJavaInterfaceContract();
>> +            JavaInterface callInterface = 
>> javaInterfaceFactory.createJavaInterface(businessInterface);
>> +            interfaceContract.setInterface(callInterface);
>> +            if (callInterface.getCallbackClass() != null) {
>> +                
>> interfaceContract.setCallbackInterface(javaInterfaceFactory.createJavaInterface(callInterface
>> +                    .getCallbackClass()));
>> +            }
>>         }
>>
>>         return interfaceContract;
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>

As you point out it's an old bit of code. It's not clear to me
precisely why it doesn't raise an error when reference interface can't
be assigned to the business interface. A way into this could be to add
some new code that throws an exception when they aren't compatible and
see what fails in the build. This should highlight those situations in
our test cases where they can be incompatible.

Simon

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Reply via email to