From: <jhs...@us...> - 2009-04-11 17:13:14
|
Revision: 146 http://flexotask.svn.sourceforge.net/flexotask/?rev=146&view=rev Author: jhspring Date: 2009-04-11 17:13:05 +0000 (Sat, 11 Apr 2009) Log Message: ----------- See 2750827 Modified Paths: -------------- trunk/flexotask/src/com/ibm/realtime/flexotask/validation/CommonCodeValidator.java Modified: trunk/flexotask/src/com/ibm/realtime/flexotask/validation/CommonCodeValidator.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/validation/CommonCodeValidator.java 2009-03-10 14:00:34 UTC (rev 145) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/validation/CommonCodeValidator.java 2009-04-11 17:13:05 UTC (rev 146) @@ -42,6 +42,9 @@ import com.ibm.realtime.flexotask.FlexotaskOutputPort; import com.ibm.realtime.flexotask.system.FlexotaskSystemSupport; import com.ibm.realtime.flexotask.system.TransactionalOperations; +import com.ibm.realtime.flexotask.template.FlexotaskConnectionMode; +import com.ibm.realtime.flexotask.template.FlexotaskConnectionTemplate; +import com.ibm.realtime.flexotask.template.FlexotaskPortTemplate; import com.ibm.realtime.flexotask.template.FlexotaskStableMode; import com.ibm.realtime.flexotask.template.FlexotaskTaskTemplate; import com.ibm.realtime.flexotask.template.FlexotaskTemplate; @@ -313,6 +316,29 @@ } } } + /* Check port semantics */ + for (Iterator iter = template.getConnections().iterator(); iter.hasNext();) { + FlexotaskConnectionTemplate element = (FlexotaskConnectionTemplate) iter.next(); + /* we do not check BYREF connections as we do not know the allocation + * context of the objects being written to the output port, which is + * what we're interested in for BYREF connections. Thus, this check is + * performed during runtime in the output port implementation. */ + + /* for DEEPCLONE we need to check that the type of the objects being + * written to the output port is stable. */ + if (element.getConnectionMode() != FlexotaskConnectionMode.BYREF) { + FlexotaskPortTemplate inputPort = element.getInput().getOutputPort(element.getInputPortToWrite()); + + try { + Class clazz = Class.forName(inputPort.getPortType(), false, context.getClassLoader()); + if (!isStable(clazz)) + addTypeRuleViolation(Severity.ERROR, "The class '" + inputPort.getPortType() + "' used by a task port for 'deep clone' or 'hybrid' semantics is not declared Stable as required."); + } + catch (ClassNotFoundException e) { + addTypeRuleViolation(Severity.ERROR, "The class '" + inputPort.getPortType() + "' used by a task port in the Flexotask template could not be loaded."); + } + } + } mayNotAllocate = !template.isAllocating(); mayNotSynchronize = !template.isSynchronizing(); if (mayNotAllocate) { @@ -334,7 +360,12 @@ publicHeapFields = (defaultGetStaticChecking == CHECK_REF_IMMUTABLE) ? refImmutableFields : immutableFields; effectivelyFinalFields.addAll(publicHeapFields); } + + protected final void checkPortSemantics(FlexotaskTemplate template) { + + } + /** * Returns the set of type rule violations found during the validation of * the code. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |