Get rid of "jet" in comments, assertions, READMEs, etc.

Replace with "kotlin"

 #KT-2896 Fixed
This commit is contained in:
Alexander Udalov
2014-02-19 19:22:18 +04:00
parent 410b7985e1
commit ac71911720
18 changed files with 76 additions and 80 deletions
+1 -1
View File
@@ -96,7 +96,7 @@ Currently only committers can assign issues to themselves so just add a comment
A nice gentle way to contribute would be to review the [API docs](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/index.html) and find classes or functions which are not documented very well and submit a patch.
In particular it'd be great if all functions included a nice example of how to use it such as for the <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#filter(jet.Function1)">filter()</a> function on Collection. This is implemented using the <a href="https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/src/kotlin/IterablesLazy.kt#L17">@includeFunctionBody</a> macro to include code from a test function. This serves as a double win; the API gets better documented with nice examples to help new users and the code gets more test coverage.
In particular it'd be great if all functions included a nice example of how to use it such as for the <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#filter(kotlin.Function1)">filter()</a> function on Collection. This is implemented using the <a href="https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/src/kotlin/IterablesLazy.kt#L17">@includeFunctionBody</a> macro to include code from a test function. This serves as a double win; the API gets better documented with nice examples to help new users and the code gets more test coverage.
Also the [JavaScript translation](https://github.com/JetBrains/kotlin/blob/master/js/ReadMe.md) could really use your help. See the [JavaScript contribution section](https://github.com/JetBrains/kotlin/blob/master/js/ReadMe.md) for more details.
@@ -40,7 +40,6 @@ import org.jetbrains.jet.lang.resolve.calls.util.ExpressionAsFunctionDescriptor;
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassDescriptor;
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassStaticsPackageFragmentDescriptor;
import org.jetbrains.jet.lang.resolve.java.mapping.KotlinToJavaTypesMap;
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
@@ -75,15 +74,15 @@ public class JetTypeMapper extends BindingTraceAware {
*/
IMPL,
/**
* jet.Int is mapped to I
* kotlin.Int is mapped to I
*/
VALUE,
/**
* jet.Int is mapped to Ljava/lang/Integer;
* kotlin.Int is mapped to Ljava/lang/Integer;
*/
TYPE_PARAMETER,
/**
* jet.Int is mapped to Ljava/lang/Integer;
* kotlin.Int is mapped to Ljava/lang/Integer;
* No projections allowed in immediate arguments
*/
SUPER_TYPE
@@ -25,7 +25,6 @@ import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
import org.jetbrains.jet.lang.resolve.java.JvmPrimitiveType;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.jet.lang.types.lang.PrimitiveType;
@@ -84,10 +83,10 @@ public class KotlinToJavaTypesMap extends JavaToKotlinClassMapBuilder {
/**
* E.g.
* jet.Throwable -> java.lang.Throwable
* jet.Deprecated -> java.lang.annotation.Deprecated
* jet.Int -> java.lang.Integer
* jet.IntArray -> null
* kotlin.Throwable -> java.lang.Throwable
* kotlin.deprecated -> java.lang.annotation.Deprecated
* kotlin.Int -> java.lang.Integer
* kotlin.IntArray -> null
*/
@Nullable
public FqName getKotlinToJavaFqName(@NotNull FqName fqName) {
@@ -38,11 +38,11 @@ public class CastDiagnosticsUtil {
/**
* Two types are related, roughly, when one is a subtype or supertype of the other.
* <p/>
* Note that some types have platform-specific counterparts, i.e. jet.String is mapped to java.lang.String,
* Note that some types have platform-specific counterparts, i.e. kotlin.String is mapped to java.lang.String,
* such types (and all their sub- and supertypes) are related too.
* <p/>
* Due to limitations in PlatformToKotlinClassMap, we only consider mapping of platform classes to Kotlin classed
* (i.e. java.lang.String -> jet.String) and ignore mappings that go the other way.
* (i.e. java.lang.String -> kotlin.String) and ignore mappings that go the other way.
*/
private static boolean isRelated(@NotNull JetType a, @NotNull JetType b, @NotNull PlatformToKotlinClassMap platformToKotlinClassMap) {
List<JetType> aTypes = mapToPlatformIndependentTypes(a, platformToKotlinClassMap);
@@ -41,8 +41,8 @@ import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
import org.jetbrains.jet.lang.resolve.java.jetAsJava.KotlinLightMethod;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.jet.utils.UtilsPackage;
import org.jetbrains.jet.utils.KotlinVfsUtil;
import org.jetbrains.jet.utils.UtilsPackage;
import java.io.File;
import java.net.MalformedURLException;
@@ -56,7 +56,7 @@ public class LightClassUtil {
/**
* Checks whether the given file is loaded from the location where Kotlin's built-in classes are defined.
* As of today, this is core/builtins/native/jet directory and files such as Any.kt, Nothing.kt etc.
* As of today, this is core/builtins/native/kotlin directory and files such as Any.kt, Nothing.kt etc.
*
* Used to skip JetLightClass creation for built-ins, because built-in classes have no Java counterparts
*/
@@ -39,48 +39,48 @@ public class FqNameTest {
@Test
public void pathLevel1() {
List<FqName> path = new FqName("com").path();
List<FqName> path = new FqName("org").path();
Assert.assertEquals(2, path.size());
Assert.assertEquals("", path.get(0).asString());
Assert.assertEquals("com", path.get(1).asString());
Assert.assertEquals("com", path.get(1).shortName().asString());
Assert.assertEquals("org", path.get(1).asString());
Assert.assertEquals("org", path.get(1).shortName().asString());
Assert.assertEquals("", path.get(1).parent().asString());
}
@Test
public void pathLevel2() {
List<FqName> path = new FqName("com.jetbrains").path();
List<FqName> path = new FqName("org.jetbrains").path();
Assert.assertEquals(3, path.size());
Assert.assertEquals("", path.get(0).asString());
Assert.assertEquals("com", path.get(1).asString());
Assert.assertEquals("com", path.get(1).shortName().asString());
Assert.assertEquals("org", path.get(1).asString());
Assert.assertEquals("org", path.get(1).shortName().asString());
Assert.assertEquals("", path.get(1).parent().asString());
Assert.assertEquals("com.jetbrains", path.get(2).asString());
Assert.assertEquals("org.jetbrains", path.get(2).asString());
Assert.assertEquals("jetbrains", path.get(2).shortName().asString());
Assert.assertEquals("com", path.get(2).parent().asString());
Assert.assertEquals("org", path.get(2).parent().asString());
}
@Test
public void pathLevel3() {
List<FqName> path = new FqName("com.jetbrains.jet").path();
List<FqName> path = new FqName("org.jetbrains.kotlin").path();
Assert.assertEquals(4, path.size());
Assert.assertEquals("", path.get(0).asString());
Assert.assertEquals("com", path.get(1).asString());
Assert.assertEquals("com", path.get(1).shortName().asString());
Assert.assertEquals("org", path.get(1).asString());
Assert.assertEquals("org", path.get(1).shortName().asString());
Assert.assertEquals("", path.get(1).parent().asString());
Assert.assertEquals("com.jetbrains", path.get(2).asString());
Assert.assertEquals("org.jetbrains", path.get(2).asString());
Assert.assertEquals("jetbrains", path.get(2).shortName().asString());
Assert.assertEquals("com", path.get(2).parent().asString());
Assert.assertEquals("com.jetbrains.jet", path.get(3).asString());
Assert.assertEquals("jet", path.get(3).shortName().asString());
Assert.assertEquals("com.jetbrains", path.get(3).parent().asString());
Assert.assertEquals("org", path.get(2).parent().asString());
Assert.assertEquals("org.jetbrains.kotlin", path.get(3).asString());
Assert.assertEquals("kotlin", path.get(3).shortName().asString());
Assert.assertEquals("org.jetbrains", path.get(3).parent().asString());
}
@Test
public void pathSegments() {
Assert.assertEquals(Lists.newArrayList(), new FqName("").pathSegments());
for (String name : new String[] { "com", "com.jetbrains", "com.jetbrains.jet" }) {
for (String name : new String[] { "org", "org.jetbrains", "org.jetbrains.kotlin" }) {
List<Name> segments = new FqName(name).pathSegments();
List<String> segmentsStrings = new ArrayList<String>();
for (Name segment : segments) {
@@ -23,6 +23,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.jetbrains.jet.codegen.CodegenTestUtil.assertIsCurrentTime;
@@ -194,37 +195,37 @@ public class PackageGenTest extends CodegenTestCase {
public void testJavaEquals() throws Exception {
loadText("fun foo(s1: String, s2: String) = s1 == s2");
Method main = generateFunction();
assertEquals(Boolean.TRUE, main.invoke(null, new String("jet"), new String("jet")));
assertEquals(Boolean.FALSE, main.invoke(null, new String("jet"), new String("ceylon")));
assertEquals(Boolean.TRUE, main.invoke(null, new String("kotlin"), new String("kotlin")));
assertEquals(Boolean.FALSE, main.invoke(null, new String("kotlin"), new String("ceylon")));
}
public void testJavaNotEquals() throws Exception {
loadText("fun foo(s1: String, s2: String) = s1 != s2");
Method main = generateFunction();
assertEquals(Boolean.FALSE, main.invoke(null, new String("jet"), new String("jet")));
assertEquals(Boolean.TRUE, main.invoke(null, new String("jet"), new String("ceylon")));
assertEquals(Boolean.FALSE, main.invoke(null, new String("kotlin"), new String("kotlin")));
assertEquals(Boolean.TRUE, main.invoke(null, new String("kotlin"), new String("ceylon")));
}
public void testJavaEqualsNull() throws Exception {
loadText("fun foo(s1: String?, s2: String?) = s1 == s2");
Method main = generateFunction();
assertEquals(Boolean.TRUE, main.invoke(null, null, null));
assertEquals(Boolean.FALSE, main.invoke(null, "jet", null));
assertEquals(Boolean.FALSE, main.invoke(null, null, "jet"));
assertEquals(Boolean.FALSE, main.invoke(null, "kotlin", null));
assertEquals(Boolean.FALSE, main.invoke(null, null, "kotlin"));
}
public void testEqualsNullLiteral() throws Exception {
loadText("fun foo(s: String?) = s == null");
Method main = generateFunction();
assertEquals(Boolean.TRUE, main.invoke(null, new Object[] { null }));
assertEquals(Boolean.FALSE, main.invoke(null, "jet"));
assertEquals(Boolean.FALSE, main.invoke(null, "kotlin"));
}
public void testTripleEq() throws Exception {
loadText("fun foo(s1: String?, s2: String?) = s1 === s2");
Method main = generateFunction();
String s1 = new String("jet");
String s2 = new String("jet");
String s1 = new String("kotlin");
String s2 = new String("kotlin");
assertEquals(Boolean.TRUE, main.invoke(null, s1, s1));
assertEquals(Boolean.FALSE, main.invoke(null, s1, s2));
}
@@ -232,8 +233,8 @@ public class PackageGenTest extends CodegenTestCase {
public void testTripleNotEq() throws Exception {
loadText("fun foo(s1: String?, s2: String?) = s1 !== s2");
Method main = generateFunction();
String s1 = new String("jet");
String s2 = new String("jet");
String s1 = new String("kotlin");
String s2 = new String("kotlin");
assertEquals(Boolean.FALSE, main.invoke(null, s1, s1));
assertEquals(Boolean.TRUE, main.invoke(null, s1, s2));
}
@@ -247,7 +248,7 @@ public class PackageGenTest extends CodegenTestCase {
public void testStringPlus() throws Exception {
loadText("fun foo(s1: String, s2: String) = s1 + s2");
Method main = generateFunction();
assertEquals("jetLang", main.invoke(null, "jet", "Lang"));
assertEquals("kotlinLang", main.invoke(null, "kotlin", "Lang"));
}
public void testStringPlusChained() throws Exception {
@@ -256,7 +257,7 @@ public class PackageGenTest extends CodegenTestCase {
int firstStringBuilderCreation = text.indexOf("NEW java/lang/StringBuilder");
assertEquals(-1, text.indexOf("NEW java/lang/StringBuilder", firstStringBuilderCreation + 1));
Method main = generateFunction();
assertEquals("jet Lang", main.invoke(null, "jet", " ", "Lang"));
assertEquals("kotlin Lang", main.invoke(null, "kotlin", " ", "Lang"));
}
public void testStringPlusEq() throws Exception {
@@ -269,13 +270,13 @@ public class PackageGenTest extends CodegenTestCase {
loadText("fun foo(s1: String, s2: String) = s1 < s2");
Method main = generateFunction();
assertEquals(Boolean.TRUE, main.invoke(null, "Ceylon", "Java"));
assertEquals(Boolean.FALSE, main.invoke(null, "Jet", "Java"));
assertEquals(Boolean.FALSE, main.invoke(null, "Kotlin", "Java"));
}
public void testElvis() throws Exception {
loadText("fun foo(s: String?) = s ?: \"null\"");
Method main = generateFunction();
assertEquals("jet", main.invoke(null, "jet"));
assertEquals("kotlin", main.invoke(null, "kotlin"));
assertEquals("null", main.invoke(null, new Object[] { null }));
}
@@ -289,7 +290,7 @@ public class PackageGenTest extends CodegenTestCase {
public void testVarargs() throws Exception {
loadText("fun foo() = java.util.Arrays.asList(\"IntelliJ\", \"IDEA\")");
Method main = generateFunction();
java.util.List<?> list = (java.util.List<?>) main.invoke(null);
List<?> list = (List<?>) main.invoke(null);
assertEquals(Arrays.asList("IntelliJ", "IDEA"), list);
}
@@ -339,11 +340,11 @@ public class PackageGenTest extends CodegenTestCase {
}
public void testArrayWrite() throws Exception {
loadText("fun foo(c: Array<String>) { c[0] = \"jet\"; }");
loadText("fun foo(c: Array<String>) { c[0] = \"kotlin\"; }");
Method main = generateFunction();
String[] array = new String[] { null };
main.invoke(null, new Object[] { array });
assertEquals("jet", array[0]);
assertEquals("kotlin", array[0]);
}
public void testArrayAugAssign() throws Exception {
@@ -450,12 +451,12 @@ public class PackageGenTest extends CodegenTestCase {
}
public void testArrayAccessForArrayList() throws Exception {
loadText("import java.util.*; fun foo(l: ArrayList<String>) { l[0] = \"Jet\" + l[0]; }");
loadText("import java.util.*; fun foo(l: ArrayList<String>) { l[0] = \"Kotlin\" + l[0]; }");
Method main = generateFunction();
ArrayList<String> list = new ArrayList<String>();
list.add("Language");
main.invoke(null, list);
assertEquals("JetLanguage", list.get(0));
assertEquals("KotlinLanguage", list.get(0));
}
public void testEscapeSequence() throws Exception {
@@ -77,7 +77,7 @@ public class JdkAnnotationsValidityTest extends UsefulTestCase {
// </item>
//
// KAnnotator produces above annotations and validation of TabularDataSupport results into:
// public open fun keySet(): jet.MutableSet<jet.Any> defined in javax.management.openmbean.TabularDataSupport :
// public open fun keySet(): kotlin.MutableSet<kotlin.Any> defined in javax.management.openmbean.TabularDataSupport :
// [Incompatible types in superclasses: [Any?, Any, Any], Incompatible projection kinds in type arguments of super methods' return types: [out Any?, Any, Any]]
private static final Set<String> classesToIgnore = new HashSet<String>(Arrays.asList("javax.management.openmbean.TabularDataSupport"));
@@ -43,8 +43,8 @@ public class JvmClassName {
private final static String CLASS_OBJECT_REPLACE_GUARD = "<class_object>";
private final static String TRAIT_IMPL_REPLACE_GUARD = "<trait_impl>";
// Internal name: jet/Map$Entry
// FqName: jet.Map.Entry
// Internal name: kotlin/Map$Entry
// FqName: kotlin.Map.Entry
private final String internalName;
private FqName fqName;
@@ -24,9 +24,9 @@ import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptorImpl;
import org.jetbrains.jet.lang.resolve.java.AnnotationLoadingUtil;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.constants.StringValue;
import org.jetbrains.jet.lang.resolve.java.AnnotationLoadingUtil;
import org.jetbrains.jet.lang.resolve.java.JvmPrimitiveType;
import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils;
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage;
@@ -110,7 +110,7 @@ public class JavaToKotlinClassMap extends JavaToKotlinClassMapBuilder implements
annotation.setAnnotationType(annotationClass.getDefaultType());
ValueParameterDescriptor value = DescriptorResolverUtils.getAnnotationParameterByName(
AnnotationLoadingUtil.DEFAULT_ANNOTATION_MEMBER_NAME, annotationClass);
assert value != null : "jet.deprecated must have one parameter called value";
assert value != null : "kotlin.deprecated must have one parameter called value";
annotation.setValueArgument(value, new StringValue("Deprecated in Java", true));
return annotation;
}
@@ -38,16 +38,13 @@ import java.util.Collection;
import java.util.Set;
/**
* Number of helper methods for searching jet element prototypes in java. Methods use java indices for search.
* Number of helper methods for searching kotlin element prototypes in java. Methods use java indices for search.
*/
public class JetFromJavaDescriptorHelper {
private JetFromJavaDescriptorHelper() {
}
/**
* Get java equivalents for jet top level classes.
*/
static Collection<PsiClass> getClassesForKotlinPackages(Project project, GlobalSearchScope scope) {
/* Will iterate through short name caches
Kotlin packages from jar a class files will be collected from java cache
@@ -56,7 +56,7 @@ import java.util.*;
import static org.jetbrains.jet.plugin.caches.JetFromJavaDescriptorHelper.getTopLevelFunctionFqNames;
/**
* Will provide both java elements from jet context and some special declarations special to jet.
* Will provide both java elements from kotlin context and some declarations special to kotlin.
* All those declaration are planned to be used in completion.
*/
public class JetShortNamesCache extends PsiShortNamesCache {
@@ -80,7 +80,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
}
/**
* Return jet class names form jet project sources which should be visible from java.
* Return kotlin class names from project sources which should be visible from java.
*/
@NotNull
@Override
@@ -97,7 +97,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
}
/**
* Return class names form jet sources in given scope which should be visible as Java classes.
* Return class names form kotlin sources in given scope which should be visible as Java classes.
*/
@NotNull
@Override
@@ -146,7 +146,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
}
/**
* Get jet non-extension top-level function names. Method is allowed to give invalid names - all result should be
* Get kotlin non-extension top-level function names. Method is allowed to give invalid names - all result should be
* checked with getTopLevelFunctionDescriptorsByName().
*
* @return
@@ -30,7 +30,7 @@ import org.jetbrains.jet.plugin.JetPluginUtil;
import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache;
/**
* Quick showing possible problems with jet internals in IDEA with a tooltips
* Quick showing possible problems with Kotlin internals in IDEA with tooltips
*/
public class DebugInfoAnnotator implements Annotator {
@@ -230,12 +230,12 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
private static String getMessageFromAnnotationDescriptor(@NotNull AnnotationDescriptor descriptor) {
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(descriptor.getType());
assert classDescriptor != null : "ClassDescriptor for jet.deprecated mustn't be null";
assert classDescriptor != null : "ClassDescriptor for kotlin.deprecated mustn't be null";
ValueParameterDescriptor parameter = DescriptorResolverUtils.getAnnotationParameterByName(
AnnotationLoadingUtil.DEFAULT_ANNOTATION_MEMBER_NAME, classDescriptor);
assert parameter != null : "jet.deprecated must have one parameter called value";
assert parameter != null : "kotlin.deprecated must have one parameter called value";
CompileTimeConstant<?> valueArgument = descriptor.getValueArgument(parameter);
assert valueArgument != null : "jet.deprecated must have value argument";
assert valueArgument != null : "kotlin.deprecated must have value argument";
return (String) valueArgument.getValue();
}
@@ -125,7 +125,7 @@ public class BuiltInsReferenceResolver extends AbstractProjectComponent {
if (ApplicationManager.getApplication().isUnitTestMode()) {
// In production, the above URL is enough as it contains sources for both native and compilable built-ins
// (it's simply "jet" directory in kotlin-plugin.jar)
// (it's simply the "kotlin" directory in kotlin-plugin.jar)
// But in tests, sources of built-ins are not added to the classpath automatically, so we manually specify URLs for both:
// LightClassUtil.getBuiltInsDirUrl() does so for native built-ins and the code below for compilable built-ins
try {
@@ -56,7 +56,7 @@ public final class TopLevelFIF extends CompositeFIF {
public JsExpression apply(
@Nullable JsExpression receiver, @NotNull List<JsExpression> arguments, @NotNull TranslationContext context
) {
assert arguments.size() == 1 : "Unexpected argument size for jet.identityEquals: " + arguments.size();
assert arguments.size() == 1 : "Unexpected argument size for kotlin.identityEquals: " + arguments.size();
return new JsBinaryOperation(JsBinaryOperator.REF_EQ, receiver, arguments.get(0));
}
};
+9 -9
View File
@@ -2,19 +2,19 @@
There are a number of extension functions on [Collection](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html), [Iterator](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Iterator-extensions.html), [Map](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Map-extensions.html) and arrays to allow easy composition collections using familiar combinators like
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#filter(jet.Function1)">filter()</a>
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#flatMap(jet.Function1)">flatMap()</a>
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#map(jet.Function1)">map()</a>
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#fold(T, jet.Function2)">fold()</a>
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#filter(kotlin.Function1)">filter()</a>
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#flatMap(kotlin.Function1)">flatMap()</a>
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#map(kotlin.Function1)">map()</a>
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#fold(T, kotlin.Function2)">fold()</a>
Functions on [Collection](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html), [Map](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Map-extensions.html) and arrays are all *eager*, in that methods like <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#map(jet.Function1)">map()</a> will create a complete result List when the method completes.
Functions on [Collection](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html), [Map](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Map-extensions.html) and arrays are all *eager*, in that methods like <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Collection-extensions.html#map(kotlin.Function1)">map()</a> will create a complete result List when the method completes.
Functions on [Iterator](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Iterator-extensions.html) are *lazy* so that they try to return new iterators that lazily evaluate things. For example <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Iterator-extensions.html#map(jet.Function1)">map()</a> returns a new Iterator that lazily maps the values in the original iterator.
Functions on [Iterator](http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Iterator-extensions.html) are *lazy* so that they try to return new iterators that lazily evaluate things. For example <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/java/util/Iterator-extensions.html#map(kotlin.Function1)">map()</a> returns a new Iterator that lazily maps the values in the original iterator.
## Preconditions
When writing code it is recommended you add checks early in a function to ensure parameters are valid. There are a number of helper methods for this:
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#assert(jet.Boolean)">assert(Boolean)</a> and <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#assert(jet.Boolean, jet.Function0)">assert(Boolean) { lazyMessage }</a> which use the JDK's assertion feature so they can be disabled using the -ea option
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#check(jet.Boolean)">check(Boolean)</a> and <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#check(jet.Boolean, jet.Function0)">check(Boolean) { lazyMessage }</a> for checking something to be true and throwing [IllegalStateException](http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalStateException.html) if not
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#require(jet.Boolean)">require(Boolean)</a> and <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#require(jet.Boolean, jet.Function0)">require(Boolean) { lazyMessage }</a> for requiring something to be true and throwing [IllegalArgumentException](http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html) if not
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#assert(kotlin.Boolean)">assert(Boolean)</a> and <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#assert(kotlin.Boolean, kotlin.Function0)">assert(Boolean) { lazyMessage }</a> which use the JDK's assertion feature so they can be disabled using the -ea option
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#check(kotlin.Boolean)">check(Boolean)</a> and <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#check(kotlin.Boolean, kotlin.Function0)">check(Boolean) { lazyMessage }</a> for checking something to be true and throwing [IllegalStateException](http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalStateException.html) if not
* <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#require(kotlin.Boolean)">require(Boolean)</a> and <a href="http://jetbrains.github.com/kotlin/versions/snapshot/apidocs/kotlin/package-summary.html#require(kotlin.Boolean, kotlin.Function0)">require(Boolean) { lazyMessage }</a> for requiring something to be true and throwing [IllegalArgumentException](http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html) if not
@@ -9,7 +9,7 @@ import java.text.DateFormat
import java.util.Date
// TODO this class should move into the runtime
// in jet.StringTemplate
// in kotlin.StringTemplate
class StringTemplate(val values : Array<Any?>) {
/**