system/src/sc/lang/java/ParamTypedMethod.java
public void updateParamTypes(ParamTypeDeclaration ptd) {
      if (paramTypeDecl == null)
         paramTypeDecl = ptd;
      else if (paramTypeDecl instanceof ParamTypeDeclaration) {
         ParamTypeDeclaration oldType = (ParamTypeDeclaration) paramTypeDecl;
         if (oldType.getFullTypeName().equals(ptd.getFullTypeName())) {
            paramTypeDecl = ptd;
         }
         else {
            ParamTypeDeclaration mergedPT = oldType.cloneForNewTypes();

            int i = 0;
            // For each type parameter in the method's enclosing type - see if we can find a type param in the new type context to supply the right value
            for (Object typeParam:mergedPT.typeParams) {
               Object typeParamType = ModelUtil.getTypeParameterDeclaration(typeParam);
               // Is this parameter defined by a type parameter in the type context in which the method is invoked?
               // If so, find the position of that parameter and update the type context for this method with the
               // type of that parameter.
               Object mappedResParam = ModelUtil.resolveTypeParameter(mergedPT.baseType, ptd.baseType, typeParam);
               if (mappedResParam != null && ModelUtil.isTypeVariable(mappedResParam)) {
                  int j = 0;
                  for (Object tparam:ptd.typeParams) {
                     if (ModelUtil.sameTypeParameters(mappedResParam, tparam)) {
                        mergedPT.setTypeParamIndex(i, ptd.types.get(j));
                        // In case our parameter types change now based on the new type parameters
                        resetParameterTypes();
                     }
                     j++;
                  }
               }
               i++;
            }
            paramTypeDecl = mergedPT;
         }
      }
   }
// context from which that method is invoked into the one we retrieved from the base type.
context from which that method is invoked into the one we retrieved from the base type.
context from which that method is invoked into the one we retrieved from the base type .
public void updateParamTypes(ParamTypeDeclaration ptd) {
      if (paramTypeDecl == null)
         paramTypeDecl = ptd;
      else if (paramTypeDecl instanceof ParamTypeDeclaration) {
         ParamTypeDeclaration oldType = (ParamTypeDeclaration) paramTypeDecl;
         if (oldType.getFullTypeName().equals(ptd.getFullTypeName())) {
            paramTypeDecl = ptd;
         }
         else {
            ParamTypeDeclaration mergedPT = oldType.cloneForNewTypes();
            int i = 0;
            for (Object typeParam:mergedPT.typeParams) {
               Object typeParamType = ModelUtil.getTypeParameterDeclaration(typeParam);
               Object mappedResParam = ModelUtil.resolveTypeParameter(mergedPT.baseType, ptd.baseType, typeParam);
               if (mappedResParam != null && ModelUtil.isTypeVariable(mappedResParam)) {
                  int j = 0;
                  for (Object tparam:ptd.typeParams) {
                     if (ModelUtil.sameTypeParameters(mappedResParam, tparam)) {
                        mergedPT.setTypeParamIndex(i, ptd.types.get(j));
                        resetParameterTypes();
                     }
                     j++;
                  }
               }
               i++;
            }
            paramTypeDecl = mergedPT;
         }
      }
   }
public void updateParamTypes ( ParamTypeDeclaration ptd ) { if ( paramTypeDecl == null ) paramTypeDecl = ptd ; else if ( paramTypeDecl instanceof ParamTypeDeclaration ) { ParamTypeDeclaration oldType = ( ParamTypeDeclaration ) paramTypeDecl ; if ( oldType . getFullTypeName ( ) . equals ( ptd . getFullTypeName ( ) ) ) { paramTypeDecl = ptd ; } else { ParamTypeDeclaration mergedPT = oldType . cloneForNewTypes ( ) ; int i = 0 ; for ( Object typeParam : mergedPT . typeParams ) { Object typeParamType = ModelUtil . getTypeParameterDeclaration ( typeParam ) ; Object mappedResParam = ModelUtil . resolveTypeParameter ( mergedPT . baseType , ptd . baseType , typeParam ) ; if ( mappedResParam != null && ModelUtil . isTypeVariable ( mappedResParam ) ) { int j = 0 ; for ( Object tparam : ptd . typeParams ) { if ( ModelUtil . sameTypeParameters ( mappedResParam , tparam ) ) { mergedPT . setTypeParamIndex ( i , ptd . types . get ( j ) ) ; resetParameterTypes ( ) ; } j ++ ; } } i ++ ; } paramTypeDecl = mergedPT ; } } }
context from which that method is invoked into the one we retrieved from the base type.
context from which that method is invoked into the one we retrieved from the base type .
// For each type parameter in the method's enclosing type - see if we can find a type param in the new type context to supply the right value // Is this parameter defined by a type parameter in the type context in which the method is invoked? // If so, find the position of that parameter and update the type context for this method with the // type of that parameter. // In case our parameter types change now based on the new type parameters