Exemplo n.º 1
0
 @Check
 public void checkSpecializeReference(final Ecosystem ecosystem) {
   final JvmParameterizedTypeReference superTypeRef = ecosystem.getSpecializes();
   boolean _tripleNotEquals = (superTypeRef != null);
   if (_tripleNotEquals) {
     JvmType _type = superTypeRef.getType();
     final Ecosystem superType = this._speADLUtils.associatedEcosystem(_type);
     boolean _tripleEquals = (superType == null);
     if (_tripleEquals) {
       JvmParameterizedTypeReference _specializes = ecosystem.getSpecializes();
       String _simpleName = _specializes.getSimpleName();
       String _plus = (_simpleName + " cannot be resolved");
       JvmParameterizedTypeReference _specializes_1 = ecosystem.getSpecializes();
       this.error(
           _plus, _specializes_1, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE);
     } else {
       EList<Part> _parts = superType.getParts();
       boolean _isEmpty = _parts.isEmpty();
       boolean _not = (!_isEmpty);
       if (_not) {
         this.error(
             "Can only implements components without subcomponents",
             SpeadlPackage.Literals.ABSTRACT_COMPONENT__SPECIALIZES);
       }
       boolean _hasCycleInHierarchy = this._speADLUtils.hasCycleInHierarchy(superType);
       if (_hasCycleInHierarchy) {
         String _name = ecosystem.getName();
         String _plus_1 = ("The inheritance hierarchy of " + _name);
         String _plus_2 = (_plus_1 + " contains cycles");
         this.error(_plus_2, SpeadlPackage.Literals.ABSTRACT_COMPONENT__NAME);
       }
       boolean _isInvalidWildcard = this.isInvalidWildcard(superTypeRef);
       if (_isInvalidWildcard) {
         String _name_1 = ecosystem.getName();
         String _plus_3 = ("The type " + _name_1);
         String _plus_4 = (_plus_3 + " cannot extend or implement ");
         String _identifier = superTypeRef.getIdentifier();
         String _plus_5 = (_plus_4 + _identifier);
         String _plus_6 = (_plus_5 + ". A supertype may not specify any wildcard");
         this.error(_plus_6, SpeadlPackage.Literals.ABSTRACT_COMPONENT__SPECIALIZES);
       }
       EList<RequiredPort> _requires = ecosystem.getRequires();
       final Procedure2<RequiredPort, Integer> _function =
           new Procedure2<RequiredPort, Integer>() {
             public void apply(final RequiredPort p, final Integer index) {
               SpeADLValidator.this.error(
                   "Requires can\'t be declared in a specialising component",
                   SpeadlPackage.Literals.ABSTRACT_COMPONENT__REQUIRES,
                   (index).intValue());
             }
           };
       IterableExtensions.<RequiredPort>forEach(_requires, _function);
     }
   }
 }
Exemplo n.º 2
0
 @Check
 public void checkComponentReference(final ComponentPart p) {
   JvmParameterizedTypeReference _componentReference = p.getComponentReference();
   JvmType _type = _componentReference.getType();
   final Ecosystem eco = this._speADLUtils.associatedEcosystem(_type);
   boolean _tripleEquals = (eco == null);
   if (_tripleEquals) {
     JvmParameterizedTypeReference _componentReference_1 = p.getComponentReference();
     String _simpleName = _componentReference_1.getSimpleName();
     String _plus = (_simpleName + " cannot be resolved");
     JvmParameterizedTypeReference _componentReference_2 = p.getComponentReference();
     this.error(
         _plus,
         _componentReference_2,
         TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE);
   }
 }