Refactoring: use DescriptionRenderer to generate overriding functions / properties.

This commit is contained in:
Michał Sapalski
2013-04-06 12:36:50 +02:00
committed by Andrey Breslav
parent 01c4826b06
commit 2352d86932
10 changed files with 336 additions and 365 deletions
@@ -29,215 +29,215 @@ class JavaToKotlinMethodMapGenerated {
ImmutableMultimap.Builder<String, JavaToKotlinMethodMap.ClassData> b = ImmutableMultimap.builder();
put(b, "java.lang.String", "String",
pair("compareTo(java.lang.String)", "fun compareTo(that : jet.String) : jet.Int"),
pair("equals(java.lang.Object)", "fun equals(other : jet.Any?) : jet.Boolean"),
pair("toString()", "fun toString() : jet.String")
pair("compareTo(java.lang.String)", "fun compareTo(that: jet.String): jet.Int"),
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
pair("toString()", "fun toString(): jet.String")
);
put(b, "java.lang.CharSequence", "CharSequence",
pair("toString()", "fun toString() : jet.String")
pair("toString()", "fun toString(): jet.String")
);
put(b, "java.lang.Throwable", "Throwable",
pair("getCause()", "fun getCause() : jet.Throwable?"),
pair("getMessage()", "fun getMessage() : jet.String?"),
pair("printStackTrace()", "fun printStackTrace() : jet.Unit")
pair("getCause()", "fun getCause(): jet.Throwable?"),
pair("getMessage()", "fun getMessage(): jet.String?"),
pair("printStackTrace()", "fun printStackTrace(): jet.Unit")
);
put(b, "java.lang.Comparable", "Comparable",
pair("compareTo(T)", "fun compareTo(other : T) : jet.Int")
pair("compareTo(T)", "fun compareTo(other: T): jet.Int")
);
put(b, "java.lang.Enum", "Enum",
pair("name()", "fun name() : jet.String"),
pair("ordinal()", "fun ordinal() : jet.Int")
pair("name()", "fun name(): jet.String"),
pair("ordinal()", "fun ordinal(): jet.Int")
);
put(b, "java.lang.Iterable", "Iterable",
pair("iterator()", "fun iterator() : jet.Iterator<T>")
pair("iterator()", "fun iterator(): jet.Iterator<T>")
);
put(b, "java.lang.Iterable", "MutableIterable",
pair("iterator()", "fun iterator() : jet.MutableIterator<T>")
pair("iterator()", "fun iterator(): jet.MutableIterator<T>")
);
put(b, "java.util.Iterator", "Iterator",
pair("hasNext()", "fun hasNext() : jet.Boolean"),
pair("next()", "fun next() : T")
pair("hasNext()", "fun hasNext(): jet.Boolean"),
pair("next()", "fun next(): T")
);
put(b, "java.util.Iterator", "MutableIterator",
pair("hasNext()", "fun hasNext() : jet.Boolean"),
pair("next()", "fun next() : T"),
pair("remove()", "fun remove() : jet.Unit")
pair("hasNext()", "fun hasNext(): jet.Boolean"),
pair("next()", "fun next(): T"),
pair("remove()", "fun remove(): jet.Unit")
);
put(b, "java.util.Collection", "Collection",
pair("contains(java.lang.Object)", "fun contains(o : jet.Any?) : jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other : jet.Any?) : jet.Boolean"),
pair("hashCode()", "fun hashCode() : jet.Int"),
pair("isEmpty()", "fun isEmpty() : jet.Boolean"),
pair("iterator()", "fun iterator() : jet.Iterator<E>"),
pair("size()", "fun size() : jet.Int"),
pair("toArray()", "fun toArray() : jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a : jet.Array<out T>) : jet.Array<T>")
pair("contains(java.lang.Object)", "fun contains(o: jet.Any?): jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
pair("hashCode()", "fun hashCode(): jet.Int"),
pair("isEmpty()", "fun isEmpty(): jet.Boolean"),
pair("iterator()", "fun iterator(): jet.Iterator<E>"),
pair("size()", "fun size(): jet.Int"),
pair("toArray()", "fun toArray(): jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a: jet.Array<out T>): jet.Array<T>")
);
put(b, "java.util.Collection", "MutableCollection",
pair("add(E)", "fun add(e : E) : jet.Boolean"),
pair("addAll(java.util.Collection<? extends E>)", "fun addAll(c : jet.Collection<E>) : jet.Boolean"),
pair("clear()", "fun clear() : jet.Unit"),
pair("contains(java.lang.Object)", "fun contains(o : jet.Any?) : jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other : jet.Any?) : jet.Boolean"),
pair("hashCode()", "fun hashCode() : jet.Int"),
pair("isEmpty()", "fun isEmpty() : jet.Boolean"),
pair("iterator()", "fun iterator() : jet.MutableIterator<E>"),
pair("remove(java.lang.Object)", "fun remove(o : jet.Any?) : jet.Boolean"),
pair("removeAll(java.util.Collection<?>)", "fun removeAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("retainAll(java.util.Collection<?>)", "fun retainAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("size()", "fun size() : jet.Int"),
pair("toArray()", "fun toArray() : jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a : jet.Array<out T>) : jet.Array<T>")
pair("add(E)", "fun add(e: E): jet.Boolean"),
pair("addAll(java.util.Collection<? extends E>)", "fun addAll(c: jet.Collection<E>): jet.Boolean"),
pair("clear()", "fun clear(): jet.Unit"),
pair("contains(java.lang.Object)", "fun contains(o: jet.Any?): jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
pair("hashCode()", "fun hashCode(): jet.Int"),
pair("isEmpty()", "fun isEmpty(): jet.Boolean"),
pair("iterator()", "fun iterator(): jet.MutableIterator<E>"),
pair("remove(java.lang.Object)", "fun remove(o: jet.Any?): jet.Boolean"),
pair("removeAll(java.util.Collection<?>)", "fun removeAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("retainAll(java.util.Collection<?>)", "fun retainAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("size()", "fun size(): jet.Int"),
pair("toArray()", "fun toArray(): jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a: jet.Array<out T>): jet.Array<T>")
);
put(b, "java.util.List", "List",
pair("contains(java.lang.Object)", "fun contains(o : jet.Any?) : jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other : jet.Any?) : jet.Boolean"),
pair("get(int)", "fun get(index : jet.Int) : E"),
pair("hashCode()", "fun hashCode() : jet.Int"),
pair("indexOf(java.lang.Object)", "fun indexOf(o : jet.Any?) : jet.Int"),
pair("isEmpty()", "fun isEmpty() : jet.Boolean"),
pair("iterator()", "fun iterator() : jet.Iterator<E>"),
pair("lastIndexOf(java.lang.Object)", "fun lastIndexOf(o : jet.Any?) : jet.Int"),
pair("listIterator()", "fun listIterator() : jet.ListIterator<E>"),
pair("listIterator(int)", "fun listIterator(index : jet.Int) : jet.ListIterator<E>"),
pair("size()", "fun size() : jet.Int"),
pair("subList(int, int)", "fun subList(fromIndex : jet.Int, toIndex : jet.Int) : jet.List<E>"),
pair("toArray()", "fun toArray() : jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a : jet.Array<out T>) : jet.Array<T>")
pair("contains(java.lang.Object)", "fun contains(o: jet.Any?): jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
pair("get(int)", "fun get(index: jet.Int): E"),
pair("hashCode()", "fun hashCode(): jet.Int"),
pair("indexOf(java.lang.Object)", "fun indexOf(o: jet.Any?): jet.Int"),
pair("isEmpty()", "fun isEmpty(): jet.Boolean"),
pair("iterator()", "fun iterator(): jet.Iterator<E>"),
pair("lastIndexOf(java.lang.Object)", "fun lastIndexOf(o: jet.Any?): jet.Int"),
pair("listIterator()", "fun listIterator(): jet.ListIterator<E>"),
pair("listIterator(int)", "fun listIterator(index: jet.Int): jet.ListIterator<E>"),
pair("size()", "fun size(): jet.Int"),
pair("subList(int, int)", "fun subList(fromIndex: jet.Int, toIndex: jet.Int): jet.List<E>"),
pair("toArray()", "fun toArray(): jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a: jet.Array<out T>): jet.Array<T>")
);
put(b, "java.util.List", "MutableList",
pair("add(E)", "fun add(e : E) : jet.Boolean"),
pair("add(int, E)", "fun add(index : jet.Int, element : E) : jet.Unit"),
pair("addAll(int, java.util.Collection<? extends E>)", "fun addAll(index : jet.Int, c : jet.Collection<E>) : jet.Boolean"),
pair("addAll(java.util.Collection<? extends E>)", "fun addAll(c : jet.Collection<E>) : jet.Boolean"),
pair("clear()", "fun clear() : jet.Unit"),
pair("contains(java.lang.Object)", "fun contains(o : jet.Any?) : jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other : jet.Any?) : jet.Boolean"),
pair("get(int)", "fun get(index : jet.Int) : E"),
pair("hashCode()", "fun hashCode() : jet.Int"),
pair("indexOf(java.lang.Object)", "fun indexOf(o : jet.Any?) : jet.Int"),
pair("isEmpty()", "fun isEmpty() : jet.Boolean"),
pair("iterator()", "fun iterator() : jet.Iterator<E>"),
pair("lastIndexOf(java.lang.Object)", "fun lastIndexOf(o : jet.Any?) : jet.Int"),
pair("listIterator()", "fun listIterator() : jet.MutableListIterator<E>"),
pair("listIterator(int)", "fun listIterator(index : jet.Int) : jet.MutableListIterator<E>"),
pair("remove(int)", "fun remove(index : jet.Int) : E"),
pair("remove(java.lang.Object)", "fun remove(o : jet.Any?) : jet.Boolean"),
pair("removeAll(java.util.Collection<?>)", "fun removeAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("retainAll(java.util.Collection<?>)", "fun retainAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("set(int, E)", "fun set(index : jet.Int, element : E) : E"),
pair("size()", "fun size() : jet.Int"),
pair("subList(int, int)", "fun subList(fromIndex : jet.Int, toIndex : jet.Int) : jet.MutableList<E>"),
pair("toArray()", "fun toArray() : jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a : jet.Array<out T>) : jet.Array<T>")
pair("add(E)", "fun add(e: E): jet.Boolean"),
pair("add(int, E)", "fun add(index: jet.Int, element: E): jet.Unit"),
pair("addAll(int, java.util.Collection<? extends E>)", "fun addAll(index: jet.Int, c: jet.Collection<E>): jet.Boolean"),
pair("addAll(java.util.Collection<? extends E>)", "fun addAll(c: jet.Collection<E>): jet.Boolean"),
pair("clear()", "fun clear(): jet.Unit"),
pair("contains(java.lang.Object)", "fun contains(o: jet.Any?): jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
pair("get(int)", "fun get(index: jet.Int): E"),
pair("hashCode()", "fun hashCode(): jet.Int"),
pair("indexOf(java.lang.Object)", "fun indexOf(o: jet.Any?): jet.Int"),
pair("isEmpty()", "fun isEmpty(): jet.Boolean"),
pair("iterator()", "fun iterator(): jet.Iterator<E>"),
pair("lastIndexOf(java.lang.Object)", "fun lastIndexOf(o: jet.Any?): jet.Int"),
pair("listIterator()", "fun listIterator(): jet.MutableListIterator<E>"),
pair("listIterator(int)", "fun listIterator(index: jet.Int): jet.MutableListIterator<E>"),
pair("remove(int)", "fun remove(index: jet.Int): E"),
pair("remove(java.lang.Object)", "fun remove(o: jet.Any?): jet.Boolean"),
pair("removeAll(java.util.Collection<?>)", "fun removeAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("retainAll(java.util.Collection<?>)", "fun retainAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("set(int, E)", "fun set(index: jet.Int, element: E): E"),
pair("size()", "fun size(): jet.Int"),
pair("subList(int, int)", "fun subList(fromIndex: jet.Int, toIndex: jet.Int): jet.MutableList<E>"),
pair("toArray()", "fun toArray(): jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a: jet.Array<out T>): jet.Array<T>")
);
put(b, "java.util.Set", "Set",
pair("contains(java.lang.Object)", "fun contains(o : jet.Any?) : jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other : jet.Any?) : jet.Boolean"),
pair("hashCode()", "fun hashCode() : jet.Int"),
pair("isEmpty()", "fun isEmpty() : jet.Boolean"),
pair("iterator()", "fun iterator() : jet.Iterator<E>"),
pair("size()", "fun size() : jet.Int"),
pair("toArray()", "fun toArray() : jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a : jet.Array<out T>) : jet.Array<T>")
pair("contains(java.lang.Object)", "fun contains(o: jet.Any?): jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
pair("hashCode()", "fun hashCode(): jet.Int"),
pair("isEmpty()", "fun isEmpty(): jet.Boolean"),
pair("iterator()", "fun iterator(): jet.Iterator<E>"),
pair("size()", "fun size(): jet.Int"),
pair("toArray()", "fun toArray(): jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a: jet.Array<out T>): jet.Array<T>")
);
put(b, "java.util.Set", "MutableSet",
pair("add(E)", "fun add(e : E) : jet.Boolean"),
pair("addAll(java.util.Collection<? extends E>)", "fun addAll(c : jet.Collection<E>) : jet.Boolean"),
pair("clear()", "fun clear() : jet.Unit"),
pair("contains(java.lang.Object)", "fun contains(o : jet.Any?) : jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other : jet.Any?) : jet.Boolean"),
pair("hashCode()", "fun hashCode() : jet.Int"),
pair("isEmpty()", "fun isEmpty() : jet.Boolean"),
pair("iterator()", "fun iterator() : jet.MutableIterator<E>"),
pair("remove(java.lang.Object)", "fun remove(o : jet.Any?) : jet.Boolean"),
pair("removeAll(java.util.Collection<?>)", "fun removeAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("retainAll(java.util.Collection<?>)", "fun retainAll(c : jet.Collection<jet.Any?>) : jet.Boolean"),
pair("size()", "fun size() : jet.Int"),
pair("toArray()", "fun toArray() : jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a : jet.Array<out T>) : jet.Array<T>")
pair("add(E)", "fun add(e: E): jet.Boolean"),
pair("addAll(java.util.Collection<? extends E>)", "fun addAll(c: jet.Collection<E>): jet.Boolean"),
pair("clear()", "fun clear(): jet.Unit"),
pair("contains(java.lang.Object)", "fun contains(o: jet.Any?): jet.Boolean"),
pair("containsAll(java.util.Collection<?>)", "fun containsAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
pair("hashCode()", "fun hashCode(): jet.Int"),
pair("isEmpty()", "fun isEmpty(): jet.Boolean"),
pair("iterator()", "fun iterator(): jet.MutableIterator<E>"),
pair("remove(java.lang.Object)", "fun remove(o: jet.Any?): jet.Boolean"),
pair("removeAll(java.util.Collection<?>)", "fun removeAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("retainAll(java.util.Collection<?>)", "fun retainAll(c: jet.Collection<jet.Any?>): jet.Boolean"),
pair("size()", "fun size(): jet.Int"),
pair("toArray()", "fun toArray(): jet.Array<jet.Any?>"),
pair("toArray(T[])", "fun <T> toArray(a: jet.Array<out T>): jet.Array<T>")
);
put(b, "java.util.Map", "Map",
pair("containsKey(java.lang.Object)", "fun containsKey(key : jet.Any?) : jet.Boolean"),
pair("containsValue(java.lang.Object)", "fun containsValue(value : jet.Any?) : jet.Boolean"),
pair("entrySet()", "fun entrySet() : jet.Set<jet.Map.Entry<K, V>>"),
pair("get(java.lang.Object)", "fun get(key : jet.Any?) : V?"),
pair("isEmpty()", "fun isEmpty() : jet.Boolean"),
pair("keySet()", "fun keySet() : jet.Set<K>"),
pair("size()", "fun size() : jet.Int"),
pair("values()", "fun values() : jet.Collection<V>")
pair("containsKey(java.lang.Object)", "fun containsKey(key: jet.Any?): jet.Boolean"),
pair("containsValue(java.lang.Object)", "fun containsValue(value: jet.Any?): jet.Boolean"),
pair("entrySet()", "fun entrySet(): jet.Set<jet.Map.Entry<K, V>>"),
pair("get(java.lang.Object)", "fun get(key: jet.Any?): V?"),
pair("isEmpty()", "fun isEmpty(): jet.Boolean"),
pair("keySet()", "fun keySet(): jet.Set<K>"),
pair("size()", "fun size(): jet.Int"),
pair("values()", "fun values(): jet.Collection<V>")
);
put(b, "java.util.Map", "MutableMap",
pair("clear()", "fun clear() : jet.Unit"),
pair("containsKey(java.lang.Object)", "fun containsKey(key : jet.Any?) : jet.Boolean"),
pair("containsValue(java.lang.Object)", "fun containsValue(value : jet.Any?) : jet.Boolean"),
pair("entrySet()", "fun entrySet() : jet.MutableSet<jet.MutableMap.MutableEntry<K, V>>"),
pair("get(java.lang.Object)", "fun get(key : jet.Any?) : V?"),
pair("isEmpty()", "fun isEmpty() : jet.Boolean"),
pair("keySet()", "fun keySet() : jet.MutableSet<K>"),
pair("put(K, V)", "fun put(key : K, value : V) : V?"),
pair("putAll(java.util.Map<? extends K,? extends V>)", "fun putAll(m : jet.Map<out K, V>) : jet.Unit"),
pair("remove(java.lang.Object)", "fun remove(key : jet.Any?) : V?"),
pair("size()", "fun size() : jet.Int"),
pair("values()", "fun values() : jet.MutableCollection<V>")
pair("clear()", "fun clear(): jet.Unit"),
pair("containsKey(java.lang.Object)", "fun containsKey(key: jet.Any?): jet.Boolean"),
pair("containsValue(java.lang.Object)", "fun containsValue(value: jet.Any?): jet.Boolean"),
pair("entrySet()", "fun entrySet(): jet.MutableSet<jet.MutableMap.MutableEntry<K, V>>"),
pair("get(java.lang.Object)", "fun get(key: jet.Any?): V?"),
pair("isEmpty()", "fun isEmpty(): jet.Boolean"),
pair("keySet()", "fun keySet(): jet.MutableSet<K>"),
pair("put(K, V)", "fun put(key: K, value: V): V?"),
pair("putAll(java.util.Map<? extends K,? extends V>)", "fun putAll(m: jet.Map<out K, V>): jet.Unit"),
pair("remove(java.lang.Object)", "fun remove(key: jet.Any?): V?"),
pair("size()", "fun size(): jet.Int"),
pair("values()", "fun values(): jet.MutableCollection<V>")
);
put(b, "java.util.Map.Entry", "Map.Entry",
pair("equals(java.lang.Object)", "fun equals(other : jet.Any?) : jet.Boolean"),
pair("getKey()", "fun getKey() : K"),
pair("getValue()", "fun getValue() : V"),
pair("hashCode()", "fun hashCode() : jet.Int")
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
pair("getKey()", "fun getKey(): K"),
pair("getValue()", "fun getValue(): V"),
pair("hashCode()", "fun hashCode(): jet.Int")
);
put(b, "java.util.Map.Entry", "MutableMap.MutableEntry",
pair("equals(java.lang.Object)", "fun equals(other : jet.Any?) : jet.Boolean"),
pair("getKey()", "fun getKey() : K"),
pair("getValue()", "fun getValue() : V"),
pair("hashCode()", "fun hashCode() : jet.Int"),
pair("setValue(V)", "fun setValue(value : V) : V")
pair("equals(java.lang.Object)", "fun equals(other: jet.Any?): jet.Boolean"),
pair("getKey()", "fun getKey(): K"),
pair("getValue()", "fun getValue(): V"),
pair("hashCode()", "fun hashCode(): jet.Int"),
pair("setValue(V)", "fun setValue(value: V): V")
);
put(b, "java.util.ListIterator", "ListIterator",
pair("hasNext()", "fun hasNext() : jet.Boolean"),
pair("hasPrevious()", "fun hasPrevious() : jet.Boolean"),
pair("next()", "fun next() : T"),
pair("nextIndex()", "fun nextIndex() : jet.Int"),
pair("previous()", "fun previous() : T"),
pair("previousIndex()", "fun previousIndex() : jet.Int")
pair("hasNext()", "fun hasNext(): jet.Boolean"),
pair("hasPrevious()", "fun hasPrevious(): jet.Boolean"),
pair("next()", "fun next(): T"),
pair("nextIndex()", "fun nextIndex(): jet.Int"),
pair("previous()", "fun previous(): T"),
pair("previousIndex()", "fun previousIndex(): jet.Int")
);
put(b, "java.util.ListIterator", "MutableListIterator",
pair("add(E)", "fun add(e : T) : jet.Unit"),
pair("hasNext()", "fun hasNext() : jet.Boolean"),
pair("hasPrevious()", "fun hasPrevious() : jet.Boolean"),
pair("next()", "fun next() : T"),
pair("nextIndex()", "fun nextIndex() : jet.Int"),
pair("previous()", "fun previous() : T"),
pair("previousIndex()", "fun previousIndex() : jet.Int"),
pair("remove()", "fun remove() : jet.Unit"),
pair("set(E)", "fun set(e : T) : jet.Unit")
pair("add(E)", "fun add(e: T): jet.Unit"),
pair("hasNext()", "fun hasNext(): jet.Boolean"),
pair("hasPrevious()", "fun hasPrevious(): jet.Boolean"),
pair("next()", "fun next(): T"),
pair("nextIndex()", "fun nextIndex(): jet.Int"),
pair("previous()", "fun previous(): T"),
pair("previousIndex()", "fun previousIndex(): jet.Int"),
pair("remove()", "fun remove(): jet.Unit"),
pair("set(E)", "fun set(e: T): jet.Unit")
);
map = b.build();
@@ -17,7 +17,6 @@
package org.jetbrains.jet.renderer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
@@ -27,6 +26,22 @@ import org.jetbrains.jet.lang.types.JetType;
public interface DescriptorRenderer extends Renderer<DeclarationDescriptor> {
DescriptorRenderer COMPACT_WITH_MODIFIERS = new DescriptorRendererBuilder().setWithDefinedIn(false).build();
DescriptorRenderer SOURCE_CODE = new DescriptorRendererBuilder()
.setNormalizedVisibilities(true)
.setWithDefinedIn(false)
.setShortNames(false)
.setShowInternalKeyword(false)
.setOverrideRenderingPolicy(OverrideRenderingPolicy.RENDER_OVERRIDE)
.setUnitReturnType(false).build();
DescriptorRenderer SOURCE_CODE_SHORT_NAMES_IN_TYPES = new DescriptorRendererBuilder()
.setNormalizedVisibilities(true)
.setWithDefinedIn(false)
.setShortNames(true)
.setShowInternalKeyword(false)
.setOverrideRenderingPolicy(OverrideRenderingPolicy.RENDER_OVERRIDE)
.setUnitReturnType(false).build();
DescriptorRenderer COMPACT = new DescriptorRendererBuilder()
.setWithDefinedIn(false)
.setModifiers(false).build();
@@ -58,6 +73,10 @@ public interface DescriptorRenderer extends Renderer<DeclarationDescriptor> {
PLAIN, HTML
}
enum OverrideRenderingPolicy {
RENDER_OVERRIDE, RENDER_OPEN, RENDER_OPEN_OVERRIDE
}
/** @see DefaultValueParameterHandler */
interface ValueParametersHandler {
void appendBeforeValueParameters(@NotNull FunctionDescriptor function, @NotNull StringBuilder stringBuilder);
@@ -21,7 +21,6 @@ import org.jetbrains.jet.lang.resolve.name.FqName;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
public class DescriptorRendererBuilder {
private boolean shortNames = false;
@@ -31,6 +30,11 @@ public class DescriptorRendererBuilder {
private boolean debugMode = false;
private boolean classWithPrimaryConstructor = false;
private boolean verbose = false;
private boolean unitReturnType = true;
private boolean normalizedVisibilities = false;
private boolean showInternalKeyword = true;
@NotNull
private DescriptorRenderer.OverrideRenderingPolicy overrideRenderingPolicy = DescriptorRenderer.OverrideRenderingPolicy.RENDER_OPEN;
@NotNull
private DescriptorRenderer.ValueParametersHandler valueParametersHandler = new DescriptorRenderer.DefaultValueParameterHandler();
@NotNull
@@ -76,6 +80,26 @@ public class DescriptorRendererBuilder {
return this;
}
public DescriptorRendererBuilder setUnitReturnType(boolean unitReturnType) {
this.unitReturnType = unitReturnType;
return this;
}
public DescriptorRendererBuilder setNormalizedVisibilities(boolean normalizedVisibilities) {
this.normalizedVisibilities = normalizedVisibilities;
return this;
}
public DescriptorRendererBuilder setShowInternalKeyword(boolean showInternalKeyword) {
this.showInternalKeyword = showInternalKeyword;
return this;
}
public DescriptorRendererBuilder setOverrideRenderingPolicy(DescriptorRenderer.OverrideRenderingPolicy overrideRenderingPolicy) {
this.overrideRenderingPolicy = overrideRenderingPolicy;
return this;
}
public DescriptorRendererBuilder setValueParametersHandler(@NotNull DescriptorRenderer.ValueParametersHandler valueParametersHandler) {
this.valueParametersHandler = valueParametersHandler;
return this;
@@ -93,6 +117,8 @@ public class DescriptorRendererBuilder {
public DescriptorRenderer build() {
return new DescriptorRendererImpl(shortNames, withDefinedIn, modifiers, startFromName, debugMode, classWithPrimaryConstructor,
verbose, valueParametersHandler, textFormat, excludedAnnotationClasses);
verbose, unitReturnType, normalizedVisibilities, showInternalKeyword, overrideRenderingPolicy,
valueParametersHandler, textFormat, excludedAnnotationClasses);
}
}
@@ -55,6 +55,11 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
private final boolean debugMode;
private final boolean classWithPrimaryConstructor;
private final boolean verbose;
private final boolean unitReturnType;
private final boolean normalizedVisibilities;
private final boolean showInternalKeyword;
@NotNull
private final OverrideRenderingPolicy overrideRenderingPolicy;
@NotNull
private final ValueParametersHandler handler;
@NotNull
@@ -70,6 +75,10 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
boolean debugMode,
boolean classWithPrimaryConstructor,
boolean verbose,
boolean unitReturnType,
boolean normalizedVisibilities,
boolean showInternalKeyword,
@NotNull OverrideRenderingPolicy overrideRenderingPolicy,
@NotNull ValueParametersHandler handler,
@NotNull TextFormat textFormat,
@NotNull Collection<FqName> excludedAnnotationClasses
@@ -81,6 +90,10 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
this.handler = handler;
this.classWithPrimaryConstructor = classWithPrimaryConstructor;
this.verbose = verbose;
this.unitReturnType = unitReturnType;
this.normalizedVisibilities = normalizedVisibilities;
this.showInternalKeyword = showInternalKeyword;
this.overrideRenderingPolicy = overrideRenderingPolicy;
this.debugMode = debugMode;
this.textFormat = textFormat;
this.excludedAnnotationClasses = Sets.newHashSet(excludedAnnotationClasses);
@@ -307,6 +320,10 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
private void renderVisibility(@NotNull Visibility visibility, @NotNull StringBuilder builder) {
if (!modifiers) return;
if (normalizedVisibilities) {
visibility = visibility.normalize();
}
if (!showInternalKeyword && visibility == Visibilities.INTERNAL) return;
builder.append(renderKeyword(visibility.toString())).append(" ");
}
@@ -325,19 +342,32 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
private void renderModalityForCallable(@NotNull CallableMemberDescriptor callable, @NotNull StringBuilder builder) {
if (!DescriptorUtils.isTopLevelDeclaration(callable) || callable.getModality() != Modality.FINAL) {
if (overridesSomething(callable)
&& overrideRenderingPolicy == OverrideRenderingPolicy.RENDER_OVERRIDE
&& callable.getModality() == Modality.OPEN) {
return;
}
renderModality(callable.getModality(), builder);
}
}
private boolean overridesSomething(CallableMemberDescriptor callable) {
return !callable.getOverriddenDescriptors().isEmpty();
}
private void renderOverrideAndMemberKind(@NotNull CallableMemberDescriptor callableMember, @NotNull StringBuilder builder) {
if (verbose) {
if (!callableMember.getOverriddenDescriptors().isEmpty()) {
builder.append("override /*").append(callableMember.getOverriddenDescriptors().size()).append("*/ ");
}
if (callableMember.getKind() != CallableMemberDescriptor.Kind.DECLARATION) {
builder.append("/*").append(callableMember.getKind().name().toLowerCase()).append("*/ ");
if (!modifiers) return;
if (overridesSomething(callableMember)) {
if (overrideRenderingPolicy != OverrideRenderingPolicy.RENDER_OPEN) {
builder.append("override ");
if (verbose) {
builder.append("/*").append(callableMember.getOverriddenDescriptors().size()).append("*/ ");
}
}
}
if (verbose && callableMember.getKind() != CallableMemberDescriptor.Kind.DECLARATION) {
builder.append("/*").append(callableMember.getKind().name().toLowerCase()).append("*/ ");
}
}
@NotNull
@@ -371,7 +401,8 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
builder.append(renderKeyword(variance)).append(" ");
}
renderName(typeParameter, builder);
if (typeParameter.getUpperBounds().size() == 1) {
int upperBoundsCount = typeParameter.getUpperBounds().size();
if ((upperBoundsCount > 1 && !topLevel) || upperBoundsCount == 1) {
JetType upperBound = typeParameter.getUpperBounds().iterator().next();
if (!KotlinBuiltIns.getInstance().getDefaultBound().equals(upperBound)) {
builder.append(" : ").append(renderType(upperBound));
@@ -443,7 +474,9 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
renderName(function, builder);
renderValueParameters(function, builder);
JetType returnType = function.getReturnType();
builder.append(" : ").append(returnType == null ? "[NULL]" : escape(renderType(returnType)));
if (unitReturnType || !KotlinBuiltIns.getInstance().isUnit(returnType)) {
builder.append(": ").append(returnType == null ? "[NULL]" : escape(renderType(returnType)));
}
renderWhereSuffix(function.getTypeParameters(), builder);
}
@@ -458,6 +491,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
renderTypeParameters(classDescriptor.getTypeConstructor().getParameters(), builder, false);
renderValueParameters(constructor, builder);
renderWhereSuffix(constructor.getTypeParameters(), builder);
}
private void renderWhereSuffix(@NotNull List<TypeParameterDescriptor> typeParameters, @NotNull StringBuilder builder) {
@@ -465,8 +499,13 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
for (TypeParameterDescriptor typeParameter : typeParameters) {
if (typeParameter.getUpperBounds().size() > 1) {
boolean first = true;
for (JetType upperBound : typeParameter.getUpperBounds()) {
upperBoundStrings.add(renderName(typeParameter.getName()) + " : " + escape(renderType(upperBound)));
// first parameter is rendered by renderTypeParameter:
if (!first) {
upperBoundStrings.add(renderName(typeParameter.getName()) + " : " + escape(renderType(upperBound)));
}
first = false;
}
}
}
@@ -531,7 +570,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
}
renderName(variable, builder);
builder.append(" : ").append(escape(renderType(typeToRender)));
builder.append(": ").append(escape(renderType(typeToRender)));
if (verbose && varargElementType != null) {
builder.append(" /*").append(escape(renderType(realType))).append("*/");
@@ -555,7 +594,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
builder.append(escape(renderType(receiver.getType()))).append(".");
}
renderName(property, builder);
builder.append(" : ").append(escape(renderType(property.getType())));
builder.append(": ").append(escape(renderType(property.getType())));
renderWhereSuffix(property.getTypeParameters(), builder);
}
@@ -709,4 +748,4 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
return null;
}
}
}
}
@@ -51,6 +51,7 @@ public class NamespaceComparator {
private static final DescriptorRenderer RENDERER = new DescriptorRendererBuilder()
.setWithDefinedIn(false)
.setExcludedAnnotationClasses(Arrays.asList(new FqName(ExpectedLoadErrorsUtil.ANNOTATION_CLASS_NAME)))
.setOverrideRenderingPolicy(DescriptorRenderer.OverrideRenderingPolicy.RENDER_OPEN_OVERRIDE)
.setVerbose(true).build();
private static final ImmutableSet<String> JAVA_OBJECT_METHOD_NAMES = ImmutableSet.of(