private List<IRType> getBoundedParameterTypeDescriptors(IConstructorInfo mi) {
    if (mi.getParameters().length == 0) {
      return Collections.emptyList();
    }

    if (mi instanceof IJavaConstructorInfo) {
      return IRTypeResolver.getDescriptors(
          ((IJavaConstructorInfo) mi).getJavaConstructor().getParameterTypes());
    } else if (mi instanceof IGosuConstructorInfo) {
      IReducedDynamicFunctionSymbol dfs = ((IGosuConstructorInfo) mi).getDfs();
      while (dfs instanceof ReducedParameterizedDynamicFunctionSymbol) {
        ReducedParameterizedDynamicFunctionSymbol pdfs =
            (ReducedParameterizedDynamicFunctionSymbol) dfs;
        dfs = pdfs.getBackingDfs();
      }

      List<IRType> boundedTypes = new ArrayList<IRType>(dfs.getArgs().size());
      if (IGosuClass.ProxyUtil.isProxy(dfs.getGosuClass())) {
        return getBoundedParamTypesFromProxiedClass(dfs);
      }

      for (int i = 0; i < dfs.getArgs().size(); i++) {
        boundedTypes.add(
            IRTypeResolver.getDescriptor(
                TypeLord.getDefaultParameterizedTypeWithTypeVars(dfs.getArgs().get(i).getType())));
      }
      return boundedTypes;
    } else {
      return getTypeDescriptors(mi.getParameters());
    }
  }
 @Override
 public List<IType> getFullArgTypes() {
   ArrayList<IType> lst = new ArrayList<IType>();
   if (_boundValues == null) {
     for (IParameterInfo pi : _ci.getParameters()) {
       lst.add(pi.getFeatureType());
     }
   }
   return lst;
 }
 @Override
 protected Object evaluate(Iterator args) {
   Object[] argArray = new Object[_ci.getParameters().length];
   if (_boundValues != null) {
     args = Arrays.asList(_boundValues).iterator();
   }
   for (int i = 0; i < argArray.length; i++) {
     argArray[i] = args.next();
   }
   return _ci.getConstructor().newInstance(argArray);
 }
Example #4
0
 private IParameterInfo[] getGenericParameters(IConstructorInfo ci) {
   return (ci instanceof JavaConstructorInfo)
       ? ((JavaConstructorInfo) ci).getGenericParameters()
       : ci.getParameters();
 }