@Override public OverloadedFunction cloneInto(Environment env) { List<AbstractFunction> newCandidates = new ArrayList<>(); for (AbstractFunction f : primaryCandidates) { newCandidates.add((AbstractFunction) f.cloneInto(env)); } List<AbstractFunction> newDefaultCandidates = new ArrayList<>(); for (AbstractFunction f : defaultCandidates) { newDefaultCandidates.add((AbstractFunction) f.cloneInto(env)); } OverloadedFunction of = new OverloadedFunction(name, getType(), newCandidates, newDefaultCandidates, isStatic, ctx); of.setPublic(isPublic()); return of; }