diff options
author | Yigit Boyar <yboyar@google.com> | 2015-10-29 17:17:48 -0700 |
---|---|---|
committer | Yigit Boyar <yboyar@google.com> | 2015-11-05 14:29:37 -0800 |
commit | 59229481aec5a284d322a2ca80dff836485feb0c (patch) | |
tree | 17ad6ab772d26599ba3476e75f49d268962ba759 /compiler/src/main | |
parent | 0dfa8cd57fb5acc72167b4c760e823d0b35efd4a (diff) | |
download | data-binding-59229481aec5a284d322a2ca80dff836485feb0c.tar.gz |
upgrade kotlin to 1.0-beta1
Change-Id: I62b77fd118e2715d272a16d96b9083d2347f5fb1
Diffstat (limited to 'compiler/src/main')
14 files changed, 614 insertions, 641 deletions
diff --git a/compiler/src/main/java/android/databinding/tool/Binding.java b/compiler/src/main/java/android/databinding/tool/Binding.java index c2bee938..5aa89803 100644 --- a/compiler/src/main/java/android/databinding/tool/Binding.java +++ b/compiler/src/main/java/android/databinding/tool/Binding.java @@ -26,7 +26,7 @@ import android.databinding.tool.store.Location; import android.databinding.tool.store.SetterStore; import android.databinding.tool.store.SetterStore.SetterCall; import android.databinding.tool.util.L; -import android.databinding.tool.writer.WriterPackage; +import android.databinding.tool.writer.LayoutBinderWriterKt; import java.util.List; @@ -138,7 +138,7 @@ public class Binding implements LocationScopeProvider { public String toJavaCode(String targetViewName, String bindingComponent) { final String currentValue = requiresOldValue() - ? "this." + WriterPackage.getOldValueName(mExpr) : null; + ? "this." + LayoutBinderWriterKt.getOldValueName(mExpr) : null; final String argCode = getExpr().toCode().generate(); return getSetterCall().toJava(bindingComponent, targetViewName, currentValue, argCode); } diff --git a/compiler/src/main/java/android/databinding/tool/BindingTarget.java b/compiler/src/main/java/android/databinding/tool/BindingTarget.java index 762433cc..63fc4238 100644 --- a/compiler/src/main/java/android/databinding/tool/BindingTarget.java +++ b/compiler/src/main/java/android/databinding/tool/BindingTarget.java @@ -19,7 +19,6 @@ package android.databinding.tool; import android.databinding.tool.expr.Expr; import android.databinding.tool.expr.ExprModel; import android.databinding.tool.processing.Scope; -import android.databinding.tool.processing.scopes.FileScopeProvider; import android.databinding.tool.processing.scopes.LocationScopeProvider; import android.databinding.tool.reflection.ModelAnalyzer; import android.databinding.tool.reflection.ModelClass; @@ -30,7 +29,6 @@ import android.databinding.tool.util.L; import android.databinding.tool.util.Preconditions; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/compiler/src/main/java/android/databinding/tool/LayoutBinder.java b/compiler/src/main/java/android/databinding/tool/LayoutBinder.java index e099f286..755f21b3 100644 --- a/compiler/src/main/java/android/databinding/tool/LayoutBinder.java +++ b/compiler/src/main/java/android/databinding/tool/LayoutBinder.java @@ -29,7 +29,7 @@ import android.databinding.tool.store.ResourceBundle; import android.databinding.tool.store.ResourceBundle.BindingTargetBundle; import android.databinding.tool.util.Preconditions; import android.databinding.tool.writer.LayoutBinderWriter; -import android.databinding.tool.writer.WriterPackage; +import android.databinding.tool.writer.LayoutBinderWriterKt; import java.util.ArrayList; import java.util.Collections; @@ -44,8 +44,8 @@ public class LayoutBinder implements FileScopeProvider { private static final Comparator<BindingTarget> COMPARE_FIELD_NAME = new Comparator<BindingTarget>() { @Override public int compare(BindingTarget first, BindingTarget second) { - final String fieldName1 = WriterPackage.getFieldName(first); - final String fieldName2 = WriterPackage.getFieldName(second); + final String fieldName1 = LayoutBinderWriterKt.getFieldName(first); + final String fieldName2 = LayoutBinderWriterKt.getFieldName(second); return fieldName1.compareTo(fieldName2); } }; diff --git a/compiler/src/main/java/android/databinding/tool/MergedBinding.java b/compiler/src/main/java/android/databinding/tool/MergedBinding.java index edeb9ee8..07a0fa67 100644 --- a/compiler/src/main/java/android/databinding/tool/MergedBinding.java +++ b/compiler/src/main/java/android/databinding/tool/MergedBinding.java @@ -22,7 +22,7 @@ import android.databinding.tool.expr.ExprModel; import android.databinding.tool.reflection.ModelClass; import android.databinding.tool.store.SetterStore; import android.databinding.tool.util.L; -import android.databinding.tool.writer.WriterPackage; +import android.databinding.tool.writer.LayoutBinderWriterKt; import java.lang.reflect.Array; import java.util.ArrayList; @@ -101,7 +101,7 @@ public class MergedBinding extends Binding { if (requiresOldValue()) { oldValues = new ArrayList<String>(); for (Expr expr : args.getChildren()) { - oldValues.add("this." + WriterPackage.getOldValueName(expr)); + oldValues.add("this." + LayoutBinderWriterKt.getOldValueName(expr)); } } else { oldValues = Arrays.asList(new String[args.getChildren().size()]); diff --git a/compiler/src/main/java/android/databinding/tool/expr/Expr.java b/compiler/src/main/java/android/databinding/tool/expr/Expr.java index b4b950e7..bf43fd2a 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/Expr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/Expr.java @@ -27,7 +27,7 @@ import android.databinding.tool.store.Location; import android.databinding.tool.util.L; import android.databinding.tool.util.Preconditions; import android.databinding.tool.writer.KCode; -import android.databinding.tool.writer.WriterPackage; +import android.databinding.tool.writer.LayoutBinderWriterKt; import java.util.ArrayList; import java.util.BitSet; @@ -662,7 +662,7 @@ abstract public class Expr implements VersionProvider, LocationScopeProvider { public KCode toCode() { if (isDynamic()) { - return new KCode(WriterPackage.getExecutePendingLocalName(this)); + return new KCode(LayoutBinderWriterKt.getExecutePendingLocalName(this)); } return generateCode(); } diff --git a/compiler/src/main/java/android/databinding/tool/expr/IdentifierExpr.java b/compiler/src/main/java/android/databinding/tool/expr/IdentifierExpr.java index 067a59cb..3b1b2f9c 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/IdentifierExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/IdentifierExpr.java @@ -21,7 +21,7 @@ import android.databinding.tool.reflection.ModelAnalyzer; import android.databinding.tool.reflection.ModelClass; import android.databinding.tool.util.Preconditions; import android.databinding.tool.writer.KCode; -import android.databinding.tool.writer.WriterPackage; +import android.databinding.tool.writer.LayoutBinderWriterKt; import java.util.ArrayList; import java.util.List; @@ -79,7 +79,7 @@ public class IdentifierExpr extends Expr { @Override protected KCode generateCode() { - return new KCode(WriterPackage.getExecutePendingLocalName(this)); + return new KCode(LayoutBinderWriterKt.getExecutePendingLocalName(this)); } public void setDeclared() { diff --git a/compiler/src/main/java/android/databinding/tool/expr/ListenerExpr.java b/compiler/src/main/java/android/databinding/tool/expr/ListenerExpr.java index d5e85bb5..6b99376e 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/ListenerExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/ListenerExpr.java @@ -20,7 +20,7 @@ import android.databinding.tool.reflection.ModelAnalyzer; import android.databinding.tool.reflection.ModelClass; import android.databinding.tool.reflection.ModelMethod; import android.databinding.tool.writer.KCode; -import android.databinding.tool.writer.WriterPackage; +import android.databinding.tool.writer.LayoutBinderWriterKt; import java.util.ArrayList; import java.util.List; @@ -87,8 +87,8 @@ public class ListenerExpr extends Expr { if (minApi > 1) { code.app("(getBuildSdkInt() < " + minApi + ") ? null : "); } - final String fieldName = WriterPackage.getFieldName(this); - final String listenerClassName = WriterPackage.getListenerClassName(this); + final String fieldName = LayoutBinderWriterKt.getFieldName(this); + final String listenerClassName = LayoutBinderWriterKt.getListenerClassName(this); final KCode value = getChild().toCode(); code.app("((") .app(fieldName) diff --git a/compiler/src/main/kotlin/android/databinding/tool/ext/ext.kt b/compiler/src/main/kotlin/android/databinding/tool/ext/ext.kt index c88f91ee..a7f3a1be 100644 --- a/compiler/src/main/kotlin/android/databinding/tool/ext/ext.kt +++ b/compiler/src/main/kotlin/android/databinding/tool/ext/ext.kt @@ -15,17 +15,12 @@ package android.databinding.tool.ext import android.databinding.tool.expr.VersionProvider import kotlin.properties.ReadOnlyProperty -import kotlin.properties.Delegates -import android.databinding.tool.ext.joinToCamelCase -import android.databinding.tool.ext.joinToCamelCaseAsVar -import android.databinding.tool.reflection.ModelAnalyzer -import android.databinding.tool.reflection.ModelClass -import android.databinding.tool.reflection.ModelAnalyzer +import kotlin.reflect.KProperty private class LazyExt<K, T>(private val initializer: (k : K) -> T) : ReadOnlyProperty<K, T> { private val mapping = hashMapOf<K, T>() - override fun get(thisRef: K, desc: PropertyMetadata): T { - val t = mapping.get(thisRef) + override fun getValue(thisRef: K, property: kotlin.reflect.KProperty<*>): T { + val t = mapping[thisRef] if (t != null) { return t } @@ -37,9 +32,10 @@ private class LazyExt<K, T>(private val initializer: (k : K) -> T) : ReadOnlyPro private class VersionedLazyExt<K, T>(private val initializer: (k : K) -> T) : ReadOnlyProperty<K, T> { private val mapping = hashMapOf<K, VersionedResult<T>>() - override fun get(thisRef: K, desc: PropertyMetadata): T { - val t = mapping.get(thisRef) - val version = if(thisRef is VersionProvider) thisRef.getVersion() else 1 + + override fun getValue(thisRef: K, property: KProperty<*>): T { + val t = mapping[thisRef] + val version = if(thisRef is VersionProvider) thisRef.version else 1 if (t != null && version == t.version) { return t.result } @@ -51,19 +47,18 @@ private class VersionedLazyExt<K, T>(private val initializer: (k : K) -> T) : Re data class VersionedResult<T>(val version : Int, val result : T) -fun Delegates.lazy<K, T>(initializer: (k : K) -> T): ReadOnlyProperty<K, T> = LazyExt(initializer) -fun Delegates.versionedLazy<K, T>(initializer: (k : K) -> T): ReadOnlyProperty<K, T> = VersionedLazyExt(initializer) +fun <K, T> lazyProp(initializer: (k : K) -> T): ReadOnlyProperty<K, T> = LazyExt(initializer) +fun <K, T> versionedLazy(initializer: (k : K) -> T): ReadOnlyProperty<K, T> = VersionedLazyExt(initializer) public fun Class<*>.toJavaCode() : String { - val name = getName(); if (name.startsWith('[')) { val numArray = name.lastIndexOf('[') + 1; val componentType : String; - when (name.charAt(numArray)) { + when (name[numArray]) { 'Z' -> componentType = "boolean" 'B' -> componentType = "byte" 'C' -> componentType = "char" - 'L' -> componentType = name.substring(numArray + 1, name.length() - 1).replace('$', '.'); + 'L' -> componentType = name.substring(numArray + 1, name.length - 1).replace('$', '.'); 'D' -> componentType = "double" 'F' -> componentType = "float" 'I' -> componentType = "int" @@ -78,19 +73,19 @@ public fun Class<*>.toJavaCode() : String { } } -public fun String.androidId() : String = this.splitBy("/")[1] +public fun String.androidId() : String = this.split("/")[1] public fun String.toCamelCase() : String { - val split = this.splitBy("_") - if (split.size() == 0) return "" - if (split.size() == 1) return split[0].capitalize() + val split = this.split("_") + if (split.size == 0) return "" + if (split.size == 1) return split[0].capitalize() return split.joinToCamelCase() } public fun String.toCamelCaseAsVar() : String { - val split = this.splitBy("_") - if (split.size() == 0) return "" - if (split.size() == 1) return split[0] + val split = this.split("_") + if (split.size == 0) return "" + if (split.size == 1) return split[0] return split.joinToCamelCaseAsVar() } diff --git a/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt b/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt index 9126103f..3d23e138 100644 --- a/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt +++ b/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt @@ -19,13 +19,13 @@ package android.databinding.tool.ext import android.databinding.tool.ext.toCamelCase import android.databinding.tool.ext.toCamelCaseAsVar -public fun List<String>.joinToCamelCase(): String = when(size()) { +public fun List<String>.joinToCamelCase(): String = when(size) { 0 -> throw IllegalArgumentException("invalid section size, cannot be zero") 1 -> this.get(0).toCamelCase() else -> this.map {it.toCamelCase()}.joinToString("") } -public fun List<String>.joinToCamelCaseAsVar(): String = when(size()) { +public fun List<String>.joinToCamelCaseAsVar(): String = when(size) { 0 -> throw IllegalArgumentException("invalid section size, cannot be zero") 1 -> this.get(0).toCamelCaseAsVar() else -> get(0).toCamelCaseAsVar() + drop(1).joinToCamelCase() diff --git a/compiler/src/main/kotlin/android/databinding/tool/writer/BRWriter.kt b/compiler/src/main/kotlin/android/databinding/tool/writer/BRWriter.kt index edf89c27..6c1290c5 100644 --- a/compiler/src/main/kotlin/android/databinding/tool/writer/BRWriter.kt +++ b/compiler/src/main/kotlin/android/databinding/tool/writer/BRWriter.kt @@ -17,12 +17,11 @@ package android.databinding.tool.writer import org.apache.commons.lang3.SystemUtils -import kotlin.properties.Delegates class BRWriter(properties: Set<String>, val useFinal : Boolean) { - val indexedProps = properties.sort().withIndex() + val indexedProps = properties.sorted().withIndex() public fun write(pkg : String): String = "package $pkg;${SystemUtils.LINE_SEPARATOR}$klass" - val klass: String by Delegates.lazy { + val klass: String by lazy { kcode("") { val prefix = if (useFinal) "final " else ""; nl("public class BR {") { diff --git a/compiler/src/main/kotlin/android/databinding/tool/writer/DataBinderWriter.kt b/compiler/src/main/kotlin/android/databinding/tool/writer/DataBinderWriter.kt index 54d16af4..8801303c 100644 --- a/compiler/src/main/kotlin/android/databinding/tool/writer/DataBinderWriter.kt +++ b/compiler/src/main/kotlin/android/databinding/tool/writer/DataBinderWriter.kt @@ -32,7 +32,7 @@ class DataBinderWriter(val pkg: String, val projectPackage: String, val classNam layoutBinders.groupBy{it.getLayoutname()}.forEach { val firstVal = it.value.get(0) tab("case ${firstVal.getModulePackage()}.R.layout.${firstVal.getLayoutname()}:") { - if (it.value.size() == 1) { + if (it.value.size == 1) { if (firstVal.isMerge()) { tab("return new ${firstVal.getPackage()}.${firstVal.getImplementationName()}(bindingComponent, new android.view.View[]{view});") } else { @@ -69,7 +69,7 @@ class DataBinderWriter(val pkg: String, val projectPackage: String, val classNam layoutBinders.filter{it.isMerge()}.groupBy{it.getLayoutname()}.forEach { val firstVal = it.value.get(0) tab("case ${firstVal.getModulePackage()}.R.layout.${firstVal.getLayoutname()}:") { - if (it.value.size() == 1) { + if (it.value.size == 1) { tab("return new ${firstVal.getPackage()}.${firstVal.getImplementationName()}(bindingComponent, views);") } else { // we should check the tag to decide which layout we need to inflate diff --git a/compiler/src/main/kotlin/android/databinding/tool/writer/KCode.kt b/compiler/src/main/kotlin/android/databinding/tool/writer/KCode.kt index 6a583a6a..fe961b49 100644 --- a/compiler/src/main/kotlin/android/databinding/tool/writer/KCode.kt +++ b/compiler/src/main/kotlin/android/databinding/tool/writer/KCode.kt @@ -35,7 +35,7 @@ class KCode (private val s : String? = null){ } val s = (0..n-1).fold(""){prev, next -> "${prev} "} cachedIndentations.set(n, true ) - while (indentCache.size() <= n) { + while (indentCache.size <= n) { indentCache.add(""); } indentCache.set(n, s) @@ -55,7 +55,7 @@ class KCode (private val s : String? = null){ return this } - fun tab(s : String?, init : (KCode.() -> Unit)? = null) : KCode { + infix fun tab(s : String?, init : (KCode.() -> Unit)? = null) : KCode { val c = KCode(s) if (init != null) { c.init() @@ -116,7 +116,7 @@ class KCode (private val s : String? = null){ return this } - fun app(s : String) : KCode { + infix fun app(s : String) : KCode { val c = KCode(s) return app("", c) } diff --git a/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt b/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt index cad7db10..c36236f1 100644 --- a/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt +++ b/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt @@ -23,21 +23,17 @@ import android.databinding.tool.expr.ListenerExpr import android.databinding.tool.expr.TernaryExpr import android.databinding.tool.expr.ResourceExpr import android.databinding.tool.ext.androidId -import android.databinding.tool.ext.br import android.databinding.tool.ext.joinToCamelCaseAsVar -import android.databinding.tool.ext.lazy +import android.databinding.tool.ext.lazyProp import android.databinding.tool.ext.versionedLazy +import android.databinding.tool.ext.br import android.databinding.tool.processing.ErrorMessages import android.databinding.tool.reflection.ModelAnalyzer import android.databinding.tool.util.L -import org.apache.commons.lang3.JavaVersion -import org.apache.commons.lang3.SystemUtils -import java.lang import java.util.ArrayList import java.util.Arrays import java.util.BitSet import java.util.HashMap -import kotlin.properties.Delegates fun String.stripNonJava() = this.split("[^a-zA-Z0-9]".toRegex()).map{ it.trim() }.joinToCamelCaseAsVar() @@ -52,20 +48,20 @@ enum class Scope { class ExprModelExt { val usedFieldNames = hashMapOf<Scope, MutableSet<String>>(); init { - Scope.values().forEach { usedFieldNames[it] = hashSetOf<String>() } + Scope.values.forEach { usedFieldNames[it] = hashSetOf<String>() } } val localizedFlags = arrayListOf<FlagSet>() fun localizeFlag(set : FlagSet, name:String) : FlagSet { localizedFlags.add(set) val result = getUniqueName(name, Scope.FLAG, false) - set.setLocalName(result) + set.localName = result return set } fun getUniqueName(base : String, scope : Scope, isPublic : kotlin.Boolean) : String { var candidateBase = base - if (!isPublic && candidateBase.length() > 20) { + if (!isPublic && candidateBase.length > 20) { candidateBase = candidateBase.substring(0, 20); } var candidate = candidateBase @@ -79,144 +75,136 @@ class ExprModelExt { } } -val ExprModel.ext by Delegates.lazy { target : ExprModel -> +val ExprModel.ext by lazyProp { target : ExprModel -> ExprModelExt() } fun ExprModel.getUniqueFieldName(base : String, isPublic : kotlin.Boolean) : String = ext.getUniqueName(base, Scope.FIELD, isPublic) fun ExprModel.getUniqueMethodName(base : String, isPublic : kotlin.Boolean) : String = ext.getUniqueName(base, Scope.METHOD, isPublic) -fun ExprModel.getUniqueFlagName(base : String) : String = ext.getUniqueName(base, Scope.FLAG, false) fun ExprModel.getConstructorParamName(base : String) : String = ext.getUniqueName(base, Scope.CONSTRUCTOR_PARAM, false) fun ExprModel.localizeFlag(set : FlagSet, base : String) : FlagSet = ext.localizeFlag(set, base) -val Expr.needsLocalField by Delegates.lazy { expr : Expr -> - expr.canBeEvaluatedToAVariable() && !(expr.isVariable() && !expr.isUsed()) && (expr.isDynamic() || expr is ResourceExpr) +val Expr.needsLocalField by lazyProp { expr : Expr -> + expr.canBeEvaluatedToAVariable() && !(expr.isVariable() && !expr.isUsed) && (expr.isDynamic || expr is ResourceExpr) } // not necessarily unique. Uniqueness is solved per scope -val BindingTarget.readableName by Delegates.lazy { target: BindingTarget -> - if (target.getId() == null) { - "boundView" + indexFromTag(target.getTag()) +val BindingTarget.readableName by lazyProp { target: BindingTarget -> + if (target.id == null) { + "boundView" + indexFromTag(target.tag) } else { - target.getId().androidId().stripNonJava() + target.id.androidId().stripNonJava() } } fun BindingTarget.superConversion(variable : String) : String { - if (getResolvedType() != null && getResolvedType().extendsViewStub()) { - return "new android.databinding.ViewStubProxy((android.view.ViewStub) ${variable})" + if (resolvedType != null && resolvedType.extendsViewStub()) { + return "new android.databinding.ViewStubProxy((android.view.ViewStub) $variable)" } else { - return "(${interfaceType}) ${variable}" + return "($interfaceClass) $variable" } } -val BindingTarget.fieldName : String by Delegates.lazy { target : BindingTarget -> +val BindingTarget.fieldName : String by lazyProp { target : BindingTarget -> val name : String val isPublic : kotlin.Boolean - if (target.getId() == null) { + if (target.id == null) { name = "m${target.readableName}" isPublic = false } else { name = target.readableName isPublic = true } - target.getModel().getUniqueFieldName(name, isPublic) + target.model.getUniqueFieldName(name, isPublic) } -val BindingTarget.androidId by Delegates.lazy { target : BindingTarget -> - if (target.getId().startsWith("@android:id/")) { - "android.R.id.${target.getId().androidId()}" +val BindingTarget.androidId by lazyProp { target : BindingTarget -> + if (target.id.startsWith("@android:id/")) { + "android.R.id.${target.id.androidId()}" } else { - "R.id.${target.getId().androidId()}" + "R.id.${target.id.androidId()}" } } -val BindingTarget.interfaceType by Delegates.lazy { target : BindingTarget -> - if (target.getResolvedType() != null && target.getResolvedType().extendsViewStub()) { +val BindingTarget.interfaceClass by lazyProp { target : BindingTarget -> + if (target.resolvedType != null && target.resolvedType.extendsViewStub()) { "android.databinding.ViewStubProxy" } else { - target.getInterfaceType() + target.interfaceType } } -val BindingTarget.constructorParamName by Delegates.lazy { target : BindingTarget -> - target.getModel().getConstructorParamName(target.readableName) +val BindingTarget.constructorParamName by lazyProp { target : BindingTarget -> + target.model.getConstructorParamName(target.readableName) } // not necessarily unique. Uniqueness is decided per scope -val Expr.readableName by Delegates.lazy { expr : Expr -> - val stripped = "${expr.getUniqueKey().stripNonJava()}" - L.d("readableUniqueName for [%s] %s is %s", System.identityHashCode(expr), expr.getUniqueKey(), stripped) +val Expr.readableName by lazyProp { expr : Expr -> + val stripped = "${expr.uniqueKey.stripNonJava()}" + L.d("readableUniqueName for [%s] %s is %s", System.identityHashCode(expr), expr.uniqueKey, stripped) stripped } -val Expr.fieldName by Delegates.lazy { expr : Expr -> - expr.getModel().getUniqueFieldName("m${expr.readableName.capitalize()}", false) +val Expr.fieldName by lazyProp { expr : Expr -> + expr.model.getUniqueFieldName("m${expr.readableName.capitalize()}", false) } -val Expr.listenerClassName by Delegates.lazy { expr : Expr -> - expr.getModel().getUniqueFieldName("${expr.getResolvedType().getSimpleName()}Impl", false) +val Expr.listenerClassName by lazyProp { expr : Expr -> + expr.model.getUniqueFieldName("${expr.resolvedType.simpleName}Impl", false) } -val Expr.oldValueName by Delegates.lazy { expr : Expr -> - expr.getModel().getUniqueFieldName("mOld${expr.readableName.capitalize()}", false) +val Expr.oldValueName by lazyProp { expr : Expr -> + expr.model.getUniqueFieldName("mOld${expr.readableName.capitalize()}", false) } -val Expr.executePendingLocalName by Delegates.lazy { expr : Expr -> - if(expr.needsLocalField) "${expr.getModel().ext.getUniqueName(expr.readableName, Scope.EXECUTE_PENDING_METHOD, false)}" +val Expr.executePendingLocalName by lazyProp { expr : Expr -> + if(expr.needsLocalField) "${expr.model.ext.getUniqueName(expr.readableName, Scope.EXECUTE_PENDING_METHOD, false)}" else expr.toCode().generate() } -val Expr.setterName by Delegates.lazy { expr : Expr -> - expr.getModel().getUniqueMethodName("set${expr.readableName.capitalize()}", true) +val Expr.setterName by lazyProp { expr : Expr -> + expr.model.getUniqueMethodName("set${expr.readableName.capitalize()}", true) } -val Expr.onChangeName by Delegates.lazy { expr : Expr -> - expr.getModel().getUniqueMethodName("onChange${expr.readableName.capitalize()}", false) +val Expr.onChangeName by lazyProp { expr : Expr -> + expr.model.getUniqueMethodName("onChange${expr.readableName.capitalize()}", false) } -val Expr.getterName by Delegates.lazy { expr : Expr -> - expr.getModel().getUniqueMethodName("get${expr.readableName.capitalize()}", true) +val Expr.getterName by lazyProp { expr : Expr -> + expr.model.getUniqueMethodName("get${expr.readableName.capitalize()}", true) } -val Expr.dirtyFlagName by Delegates.lazy { expr : Expr -> - expr.getModel().getUniqueFlagName("sFlag${expr.readableName.capitalize()}") -} - - -fun Expr.isVariable() = this is IdentifierExpr && this.isDynamic() +fun Expr.isVariable() = this is IdentifierExpr && this.isDynamic -fun Expr.conditionalFlagName(output : Boolean, suffix : String) = "${dirtyFlagName}_${output}$suffix" - -val Expr.dirtyFlagSet by Delegates.lazy { expr : Expr -> - FlagSet(expr.getInvalidFlags(), expr.getModel().getFlagBucketCount()) +val Expr.dirtyFlagSet by lazyProp { expr : Expr -> + FlagSet(expr.invalidFlags, expr.model.flagBucketCount) } -val Expr.invalidateFlagSet by Delegates.lazy { expr : Expr -> - FlagSet(expr.getId()) +val Expr.invalidateFlagSet by lazyProp { expr : Expr -> + FlagSet(expr.id) } -val Expr.shouldReadFlagSet by Delegates.versionedLazy { expr : Expr -> - FlagSet(expr.getShouldReadFlags(), expr.getModel().getFlagBucketCount()) +val Expr.shouldReadFlagSet by versionedLazy { expr : Expr -> + FlagSet(expr.shouldReadFlags, expr.model.flagBucketCount) } -val Expr.shouldReadWithConditionalsFlagSet by Delegates.versionedLazy { expr : Expr -> - FlagSet(expr.getShouldReadFlagsWithConditionals(), expr.getModel().getFlagBucketCount()) +val Expr.shouldReadWithConditionalsFlagSet by versionedLazy { expr : Expr -> + FlagSet(expr.shouldReadFlagsWithConditionals, expr.model.flagBucketCount) } -val Expr.conditionalFlags by Delegates.lazy { expr : Expr -> +val Expr.conditionalFlags by lazyProp { expr : Expr -> arrayListOf(FlagSet(expr.getRequirementFlagIndex(false)), FlagSet(expr.getRequirementFlagIndex(true))) } -val LayoutBinder.requiredComponent by Delegates.lazy { layoutBinder: LayoutBinder -> +val LayoutBinder.requiredComponent by lazyProp { layoutBinder: LayoutBinder -> val required = layoutBinder. - getBindingTargets(). - flatMap { it.getBindings() }. - firstOrNull { it.getBindingAdapterInstanceClass() != null } - required?.getBindingAdapterInstanceClass() + bindingTargets. + flatMap { it.bindings }. + firstOrNull { it.bindingAdapterInstanceClass != null } + required?.bindingAdapterInstanceClass } fun Expr.getRequirementFlagSet(expected : Boolean) : FlagSet = conditionalFlags[if(expected) 1 else 0] @@ -229,21 +217,21 @@ fun FlagSet.notEmpty(cb : (suffix : String, value : Long) -> Unit) { } } -fun FlagSet.getWordSuffix(wordIndex : Int) : String { - return if(wordIndex == 0) "" else "_${wordIndex}" +fun getWordSuffix(wordIndex : Int) : String { + return if(wordIndex == 0) "" else "_$wordIndex" } fun FlagSet.localValue(bucketIndex : Int) = - if (getLocalName() == null) binaryCode(bucketIndex) - else "${getLocalName()}${getWordSuffix(bucketIndex)}" + if (localName == null) binaryCode(bucketIndex) + else "$localName${getWordSuffix(bucketIndex)}" fun FlagSet.binaryCode(bucketIndex : Int) = longToBinary(buckets[bucketIndex]) -fun longToBinary(l : Long) = "0x${lang.Long.toHexString(l)}L" +fun longToBinary(l : Long) = "0x${java.lang.Long.toHexString(l)}L" fun <T> FlagSet.mapOr(other : FlagSet, cb : (suffix : String, index : Int) -> T) : List<T> { - val min = Math.min(buckets.size(), other.buckets.size()) + val min = Math.min(buckets.size, other.buckets.size) val result = arrayListOf<T>() for (i in 0..(min - 1)) { // if these two can match by any chance, call the callback @@ -257,7 +245,7 @@ fun <T> FlagSet.mapOr(other : FlagSet, cb : (suffix : String, index : Int) -> T) fun indexFromTag(tag : String) : kotlin.Int { val startIndex : kotlin.Int if (tag.startsWith("binding_")) { - startIndex = "binding_".length(); + startIndex = "binding_".length; } else { startIndex = tag.lastIndexOf('_') + 1 } @@ -265,47 +253,46 @@ fun indexFromTag(tag : String) : kotlin.Int { } class LayoutBinderWriter(val layoutBinder : LayoutBinder) { - val model = layoutBinder.getModel() + val model = layoutBinder.model val indices = HashMap<BindingTarget, kotlin.Int>() - val mDirtyFlags by Delegates.lazy { - val fs = FlagSet(BitSet(), model.getFlagBucketCount()); + val mDirtyFlags by lazy { + val fs = FlagSet(BitSet(), model.flagBucketCount); Arrays.fill(fs.buckets, -1) - fs.setDynamic(true) + fs.isDynamic = true model.localizeFlag(fs, "mDirtyFlags") fs } - val dynamics by Delegates.lazy { model.getExprMap().values().filter { it.isDynamic() } } - val className = layoutBinder.getImplementationName() + val className = layoutBinder.implementationName - val baseClassName = "${layoutBinder.getClassName()}" + val baseClassName = "${layoutBinder.className}" - val includedBinders by Delegates.lazy { - layoutBinder.getBindingTargets().filter { it.isBinder() } + val includedBinders by lazy { + layoutBinder.bindingTargets.filter { it.isBinder } } - val variables by Delegates.lazy { - model.getExprMap().values().filterIsInstance(javaClass<IdentifierExpr>()).filter { it.isVariable() } + val variables by lazy { + model.exprMap.values.filterIsInstance(IdentifierExpr::class.java).filter { it.isVariable() } } - val usedVariables by Delegates.lazy { - variables.filter {it.isUsed()} + val usedVariables by lazy { + variables.filter {it.isUsed } } public fun write(minSdk : kotlin.Int) : String { layoutBinder.resolveWhichExpressionsAreUsed() calculateIndices(); - return kcode("package ${layoutBinder.getPackage()};") { - nl("import ${layoutBinder.getModulePackage()}.R;") - nl("import ${layoutBinder.getModulePackage()}.BR;") + return kcode("package ${layoutBinder.`package`};") { + nl("import ${layoutBinder.modulePackage}.R;") + nl("import ${layoutBinder.modulePackage}.BR;") nl("import android.view.View;") val classDeclaration : String if (layoutBinder.hasVariations()) { - classDeclaration = "${className} extends ${baseClassName}" + classDeclaration = "$className extends $baseClassName" } else { - classDeclaration = "${className} extends android.databinding.ViewDataBinding" + classDeclaration = "$className extends android.databinding.ViewDataBinding" } - nl("public class ${classDeclaration} {") { + nl("public class $classDeclaration {") { tab(declareIncludeViews()) tab(declareViews()) tab(declareVariables()) @@ -332,15 +319,15 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { }.generate() } fun calculateIndices() : Unit { - val taggedViews = layoutBinder.getBindingTargets().filter{ - it.isUsed() && it.getTag() != null && !it.isBinder() + val taggedViews = layoutBinder.bindingTargets.filter{ + it.isUsed && it.tag != null && !it.isBinder } taggedViews.forEach { - indices.put(it, indexFromTag(it.getTag())) + indices.put(it, indexFromTag(it.tag)) } val indexStart = maxIndex() + 1 - layoutBinder.getBindingTargets().filter{ - it.isUsed() && !taggedViews.contains(it) + layoutBinder.bindingTargets.filter{ + it.isUsed && !taggedViews.contains(it) }.withIndex().forEach { indices.put(it.value, it.index + indexStart) } @@ -349,22 +336,19 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { nl("private static final android.databinding.ViewDataBinding.IncludedLayouts sIncludes;") nl("private static final android.util.SparseIntArray sViewsWithIds;") nl("static {") { - val hasBinders = layoutBinder.getBindingTargets().firstOrNull{ it.isUsed() && it.isBinder()} != null + val hasBinders = layoutBinder.bindingTargets.firstOrNull{ it.isUsed && it.isBinder } != null if (!hasBinders) { tab("sIncludes = null;") } else { - val numBindings = layoutBinder.getBindingTargets().filter{ it.isUsed() }.count() - tab("sIncludes = new android.databinding.ViewDataBinding.IncludedLayouts(${numBindings});") + val numBindings = layoutBinder.bindingTargets.filter{ it.isUsed }.count() + tab("sIncludes = new android.databinding.ViewDataBinding.IncludedLayouts($numBindings);") val includeMap = HashMap<BindingTarget, ArrayList<BindingTarget>>() - layoutBinder.getBindingTargets().filter{ it.isUsed() && it.isBinder() }.forEach { - val includeTag = it.getTag(); - val parent = layoutBinder.getBindingTargets().firstOrNull { - it.isUsed() && !it.isBinder() && includeTag.equals(it.getTag()) - } - if (parent == null) { - throw IllegalStateException("Could not find parent of include file") - } - var list = includeMap.get(parent) + layoutBinder.bindingTargets.filter{ it.isUsed && it.isBinder }.forEach { + val includeTag = it.tag; + val parent = layoutBinder.bindingTargets.firstOrNull { + it.isUsed && !it.isBinder && includeTag.equals(it.tag) + } ?: throw IllegalStateException("Could not find parent of include file") + var list = includeMap[parent] if (list == null) { list = ArrayList<BindingTarget>() includeMap.put(parent, list) @@ -372,36 +356,36 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { list.add(it) } - includeMap.keySet().forEach { - val index = indices.get(it) - tab("sIncludes.setIncludes(${index}, ") { + includeMap.keys.forEach { + val index = indices[it] + tab("sIncludes.setIncludes($index, ") { tab ("new String[] {${ - includeMap.get(it)!!.map { - "\"${it.getIncludedLayout()}\"" + includeMap[it]!!.map { + "\"${it.includedLayout}\"" }.joinToString(", ") }},") tab("new int[] {${ - includeMap.get(it)!!.map { - "${indices.get(it)}" + includeMap[it]!!.map { + "${indices[it]}" }.joinToString(", ") }},") tab("new int[] {${ - includeMap.get(it)!!.map { - "R.layout.${it.getIncludedLayout()}" + includeMap[it]!!.map { + "R.layout.${it.includedLayout}" }.joinToString(", ") }});") } } } - val viewsWithIds = layoutBinder.getBindingTargets().filter { - it.isUsed() && !it.isBinder() && (!it.supportsTag() || (it.getId() != null && it.getTag() == null)) + val viewsWithIds = layoutBinder.bindingTargets.filter { + it.isUsed && !it.isBinder && (!it.supportsTag() || (it.id != null && it.tag == null)) } if (viewsWithIds.isEmpty()) { tab("sViewsWithIds = null;") } else { tab("sViewsWithIds = new android.util.SparseIntArray();") viewsWithIds.forEach { - tab("sViewsWithIds.put(${it.androidId}, ${indices.get(it)});") + tab("sViewsWithIds.put(${it.androidId}, ${indices[it]});") } } } @@ -409,7 +393,7 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { } fun maxIndex() : kotlin.Int { - val maxIndex = indices.values().max() + val maxIndex = indices.values.max() if (maxIndex == null) { return -1 } else { @@ -421,7 +405,7 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { val bindingCount = maxIndex() + 1 val parameterType : String val superParam : String - if (layoutBinder.isMerge()) { + if (layoutBinder.isMerge) { parameterType = "View[]" superParam = "root[0]" } else { @@ -431,56 +415,56 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { val rootTagsSupported = minSdk >= 14 if (layoutBinder.hasVariations()) { nl("") - nl("public ${className}(android.databinding.DataBindingComponent bindingComponent, ${parameterType} root) {") { - tab("this(bindingComponent, ${superParam}, mapBindings(bindingComponent, root, ${bindingCount}, sIncludes, sViewsWithIds));") + nl("public $className(android.databinding.DataBindingComponent bindingComponent, $parameterType root) {") { + tab("this(bindingComponent, $superParam, mapBindings(bindingComponent, root, $bindingCount, sIncludes, sViewsWithIds));") } nl("}") - nl("private ${className}(android.databinding.DataBindingComponent bindingComponent, ${parameterType} root, Object[] bindings) {") { - tab("super(bindingComponent, ${superParam}, ${model.getObservables().size()}") { - layoutBinder.getSortedTargets().filter { it.getId() != null }.forEach { + nl("private $className(android.databinding.DataBindingComponent bindingComponent, $parameterType root, Object[] bindings) {") { + tab("super(bindingComponent, $superParam, ${model.observables.size}") { + layoutBinder.sortedTargets.filter { it.id != null }.forEach { tab(", ${fieldConversion(it)}") } tab(");") } } } else { - nl("public ${baseClassName}(android.databinding.DataBindingComponent bindingComponent, ${parameterType} root) {") { - tab("super(bindingComponent, ${superParam}, ${model.getObservables().size()});") - tab("final Object[] bindings = mapBindings(bindingComponent, root, ${bindingCount}, sIncludes, sViewsWithIds);") + nl("public $baseClassName(android.databinding.DataBindingComponent bindingComponent, $parameterType root) {") { + tab("super(bindingComponent, $superParam, ${model.observables.size});") + tab("final Object[] bindings = mapBindings(bindingComponent, root, $bindingCount, sIncludes, sViewsWithIds);") } } if (layoutBinder.requiredComponent != null) { tab("ensureBindingComponentIsNotNull(${layoutBinder.requiredComponent}.class);") } - val taggedViews = layoutBinder.getSortedTargets().filter{it.isUsed()} + val taggedViews = layoutBinder.sortedTargets.filter{it.isUsed } taggedViews.forEach { - if (!layoutBinder.hasVariations() || it.getId() == null) { + if (!layoutBinder.hasVariations() || it.id == null) { tab("this.${it.fieldName} = ${fieldConversion(it)};") } - if (!it.isBinder()) { - if (it.getResolvedType() != null && it.getResolvedType().extendsViewStub()) { + if (!it.isBinder) { + if (it.resolvedType != null && it.resolvedType.extendsViewStub()) { tab("this.${it.fieldName}.setContainingBinding(this);") } - if (it.supportsTag() && it.getTag() != null && - (rootTagsSupported || it.getTag().startsWith("binding_"))) { - val originalTag = it.getOriginalTag(); + if (it.supportsTag() && it.tag != null && + (rootTagsSupported || it.tag.startsWith("binding_"))) { + val originalTag = it.originalTag; var tagValue = "null" if (originalTag != null && !originalTag.startsWith("@{")) { - tagValue = "\"${originalTag}\"" + tagValue = "\"$originalTag\"" if (originalTag.startsWith("@")) { - var packageName = layoutBinder.getModulePackage() + var packageName = layoutBinder.modulePackage if (originalTag.startsWith("@android:")) { packageName = "android" } val slashIndex = originalTag.indexOf('/') val resourceId = originalTag.substring(slashIndex + 1) - tagValue = "root.getResources().getString(${packageName}.R.string.${resourceId})" + tagValue = "root.getResources().getString($packageName.R.string.$resourceId)" } } - tab("this.${it.fieldName}.setTag(${tagValue});") - } else if (it.getTag() != null && !it.getTag().startsWith("binding_") && - it.getOriginalTag() != null) { - L.e(ErrorMessages.ROOT_TAG_NOT_SUPPORTED, it.getOriginalTag()) + tab("this.${it.fieldName}.setTag($tagValue);") + } else if (it.tag != null && !it.tag.startsWith("binding_") && + it.originalTag != null) { + L.e(ErrorMessages.ROOT_TAG_NOT_SUPPORTED, it.originalTag) } } } @@ -490,14 +474,11 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { } fun fieldConversion(target : BindingTarget) : String { - if (!target.isUsed()) { + if (!target.isUsed) { return "null" } else { - val index = indices.get(target) - if (index == null) { - throw IllegalStateException("Unknown binding target") - } - val variableName = "bindings[${index}]" + val index = indices[target] ?: throw IllegalStateException("Unknown binding target") + val variableName = "bindings[$index]" return target.superConversion(variableName) } } @@ -505,14 +486,14 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { fun declareInvalidateAll() = kcode("") { nl("@Override") nl("public void invalidateAll() {") { - val fs = FlagSet(layoutBinder.getModel().getInvalidateAnyBitSet(), - layoutBinder.getModel().getFlagBucketCount()); + val fs = FlagSet(layoutBinder.model.invalidateAnyBitSet, + layoutBinder.model.flagBucketCount); tab("synchronized(this) {") { - for (i in (0..(mDirtyFlags.buckets.size() - 1))) { + for (i in (0..(mDirtyFlags.buckets.size - 1))) { tab("${mDirtyFlags.localValue(i)} = ${fs.localValue(i)};") } } tab("}") - includedBinders.filter{it.isUsed()}.forEach { binder -> + includedBinders.filter{it.isUsed }.forEach { binder -> tab("${binder.fieldName}.invalidateAll();") } tab("requestRebind();"); @@ -523,19 +504,19 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { fun declareHasPendingBindings() = kcode("") { nl("@Override") nl("public boolean hasPendingBindings() {") { - if (mDirtyFlags.buckets.size() > 0) { + if (mDirtyFlags.buckets.size > 0) { tab("synchronized(this) {") { - val flagCheck = 0.rangeTo(mDirtyFlags.buckets.size() - 1).map { + val flagCheck = 0.rangeTo(mDirtyFlags.buckets.size - 1).map { "${mDirtyFlags.localValue(it)} != 0" }.joinToString(" || ") - tab("if (${flagCheck}) {") { + tab("if ($flagCheck) {") { tab("return true;") } tab("}") } tab("}") } - includedBinders.filter{it.isUsed()}.forEach { binder -> + includedBinders.filter{it.isUsed }.forEach { binder -> tab("if (${binder.fieldName}.hasPendingBindings()) {") { tab("return true;") } @@ -550,15 +531,15 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { nl("public boolean setVariable(int variableId, Object variable) {") { tab("switch(variableId) {") { usedVariables.forEach { - tab ("case ${it.getName().br()} :") { - tab("${it.setterName}((${it.getResolvedType().toJavaCode()}) variable);") + tab ("case ${it.name.br()} :") { + tab("${it.setterName}((${it.resolvedType.toJavaCode()}) variable);") tab("return true;") } } - val declaredOnly = variables.filter { !it.isUsed() && it.isDeclared() }; + val declaredOnly = variables.filter { !it.isUsed && it.isDeclared }; declaredOnly.forEachIndexed { i, identifierExpr -> - tab ("case ${identifierExpr.getName().br()} :") { - if (i == declaredOnly.size() - 1) { + tab ("case ${identifierExpr.name.br()} :") { + if (i == declaredOnly.size - 1) { tab("return true;") } } @@ -571,36 +552,36 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { } fun variableSettersAndGetters() = kcode("") { - variables.filterNot{it.isUsed()}.forEach { - nl("public void ${it.setterName}(${it.getResolvedType().toJavaCode()} ${it.readableName}) {") { + variables.filterNot{it.isUsed }.forEach { + nl("public void ${it.setterName}(${it.resolvedType.toJavaCode()} ${it.readableName}) {") { tab("// not used, ignore") } nl("}") nl("") - nl("public ${it.getResolvedType().toJavaCode()} ${it.getterName}() {") { - tab("return ${it.getDefaultValue()};") + nl("public ${it.resolvedType.toJavaCode()} ${it.getterName}() {") { + tab("return ${it.defaultValue};") } nl("}") } usedVariables.forEach { - if (it.getUserDefinedType() != null) { - nl("public void ${it.setterName}(${it.getResolvedType().toJavaCode()} ${it.readableName}) {") { - if (it.isObservable()) { - tab("updateRegistration(${it.getId()}, ${it.readableName});"); + if (it.userDefinedType != null) { + nl("public void ${it.setterName}(${it.resolvedType.toJavaCode()} ${it.readableName}) {") { + if (it.isObservable) { + tab("updateRegistration(${it.id}, ${it.readableName});"); } tab("this.${it.fieldName} = ${it.readableName};") // set dirty flags! val flagSet = it.invalidateFlagSet tab("synchronized(this) {") { mDirtyFlags.mapOr(flagSet) { suffix, index -> - tab("${mDirtyFlags.getLocalName()}$suffix |= ${flagSet.localValue(index)};") + tab("${mDirtyFlags.localName}$suffix |= ${flagSet.localValue(index)};") } } tab ("}") tab("super.requestRebind();") } nl("}") nl("") - nl("public ${it.getResolvedType().toJavaCode()} ${it.getterName}() {") { + nl("public ${it.resolvedType.toJavaCode()} ${it.getterName}() {") { tab("return ${it.fieldName};") } nl("}") @@ -612,9 +593,9 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { nl("@Override") nl("protected boolean onFieldChange(int localFieldId, Object object, int fieldId) {") { tab("switch (localFieldId) {") { - model.getObservables().forEach { - tab("case ${it.getId()} :") { - tab("return ${it.onChangeName}((${it.getResolvedType().toJavaCode()}) object, fieldId);") + model.observables.forEach { + tab("case ${it.id} :") { + tab("return ${it.onChangeName}((${it.resolvedType.toJavaCode()}) object, fieldId);") } } } @@ -624,10 +605,10 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { nl("}") nl("") - model.getObservables().forEach { - nl("private boolean ${it.onChangeName}(${it.getResolvedType().toJavaCode()} ${it.readableName}, int fieldId) {") { + model.observables.forEach { + nl("private boolean ${it.onChangeName}(${it.resolvedType.toJavaCode()} ${it.readableName}, int fieldId) {") { tab("switch (fieldId) {", { - val accessedFields: List<FieldAccessExpr> = it.getParents().filterIsInstance(javaClass<FieldAccessExpr>()) + val accessedFields: List<FieldAccessExpr> = it.parents.filterIsInstance(FieldAccessExpr::class.java) accessedFields.filter { it.hasBindableAnnotations() } .groupBy { it.brName } .forEach { @@ -650,7 +631,7 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { val flagSet = it.invalidateFlagSet tab("synchronized(this) {") { mDirtyFlags.mapOr(flagSet) { suffix, index -> - tab("${mDirtyFlags.getLocalName()}$suffix |= ${flagSet.localValue(index)};") + tab("${mDirtyFlags.localName}$suffix |= ${flagSet.localValue(index)};") } } tab("}") tab("return true;") @@ -667,37 +648,37 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { fun declareViews() = kcode("// views") { val oneLayout = !layoutBinder.hasVariations(); - layoutBinder.getSortedTargets().filter {it.isUsed() && (oneLayout || it.getId() == null)}.forEach { + layoutBinder.sortedTargets.filter {it.isUsed && (oneLayout || it.id == null)}.forEach { val access : String - if (oneLayout && it.getId() != null) { + if (oneLayout && it.id != null) { access = "public" } else { access = "private" } - nl("${access} final ${it.interfaceType} ${it.fieldName};") + nl("$access final ${it.interfaceClass} ${it.fieldName};") } } fun declareVariables() = kcode("// variables") { usedVariables.forEach { - nl("private ${it.getResolvedType().toJavaCode()} ${it.fieldName};") + nl("private ${it.resolvedType.toJavaCode()} ${it.fieldName};") } } fun declareBoundValues() = kcode("// values") { - layoutBinder.getSortedTargets().filter { it.isUsed() } - .flatMap { it.getBindings() } + layoutBinder.sortedTargets.filter { it.isUsed } + .flatMap { it.bindings } .filter { it.requiresOldValue() } - .flatMap{ it.getComponentExpressions().toArrayList() } + .flatMap{ it.componentExpressions.toArrayList() } .groupBy { it } .forEach { - val expr = it.getKey() - nl("private ${expr.getResolvedType().toJavaCode()} ${expr.oldValueName};") + val expr = it.key + nl("private ${expr.resolvedType.toJavaCode()} ${expr.oldValueName};") } } fun declareListeners() = kcode("// listeners") { - model.getExprMap().values().filter { + model.exprMap.values.filter { it is ListenerExpr }.groupBy { it }.forEach { val expr = it.key as ListenerExpr @@ -709,15 +690,15 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { model.ext.localizedFlags.forEach { flag -> flag.notEmpty { suffix, value -> nl("private") - app(" ", if(flag.isDynamic()) null else "static final"); - app(" ", " ${flag.type} ${flag.getLocalName()}$suffix = ${longToBinary(value)};") + app(" ", if(flag.isDynamic) null else "static final"); + app(" ", " ${flag.type} ${flag.localName}$suffix = ${longToBinary(value)};") } } } fun flagMapping() = kcode("/* flag mapping") { - if (model.getFlagMapping() != null) { - val mapping = model.getFlagMapping() + if (model.flagMapping != null) { + val mapping = model.flagMapping for (i in mapping.indices) { tab("flag $i: ${mapping[i]}") } @@ -729,22 +710,22 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { nl("@Override") nl("protected void executeBindings() {") { val tmpDirtyFlags = FlagSet(mDirtyFlags.buckets) - tmpDirtyFlags.setLocalName("dirtyFlags"); - for (i in (0..mDirtyFlags.buckets.size() - 1)) { + tmpDirtyFlags.localName = "dirtyFlags"; + for (i in (0..mDirtyFlags.buckets.size - 1)) { tab("${tmpDirtyFlags.type} ${tmpDirtyFlags.localValue(i)} = 0;") } tab("synchronized(this) {") { - for (i in (0..mDirtyFlags.buckets.size() - 1)) { + for (i in (0..mDirtyFlags.buckets.size - 1)) { tab("${tmpDirtyFlags.localValue(i)} = ${mDirtyFlags.localValue(i)};") tab("${mDirtyFlags.localValue(i)} = 0;") } } tab("}") - model.getPendingExpressions().filter { it.needsLocalField }.forEach { - tab("${it.getResolvedType().toJavaCode()} ${it.executePendingLocalName} = ${if (it.isVariable()) it.fieldName else it.getDefaultValue()};") + model.pendingExpressions.filter { it.needsLocalField }.forEach { + tab("${it.resolvedType.toJavaCode()} ${it.executePendingLocalName} = ${if (it.isVariable()) it.fieldName else it.defaultValue};") } L.d("writing executePendingBindings for %s", className) do { - val batch = ExprModel.filterShouldRead(model.getPendingExpressions()).toArrayList() + val batch = ExprModel.filterShouldRead(model.pendingExpressions).toArrayList() val justRead = arrayListOf<Expr>() L.d("batch: %s", batch) while (!batch.none()) { @@ -752,37 +733,37 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { if (readNow.isEmpty()) { throw IllegalStateException("do not know what I can read. bailing out ${batch.joinToString("\n")}") } - L.d("new read now. batch size: %d, readNow size: %d", batch.size(), readNow.size()) + L.d("new read now. batch size: %d, readNow size: %d", batch.size, readNow.size) nl(readWithDependants(readNow, justRead, batch, tmpDirtyFlags)) batch.removeAll(justRead) } tab("// batch finished") } while (model.markBitsRead()) // verify everything is read. - val batch = ExprModel.filterShouldRead(model.getPendingExpressions()).toArrayList() + val batch = ExprModel.filterShouldRead(model.pendingExpressions).toArrayList() if (batch.isNotEmpty()) { L.e("could not generate code for %s. This might be caused by circular dependencies." - + "Please report on b.android.com. %d %s %s", layoutBinder.getLayoutname(), - batch.size(), batch.get(0), batch.get(0).toCode().generate()) + + "Please report on b.android.com. %d %s %s", layoutBinder.layoutname, + batch.size, batch[0], batch[0].toCode().generate()) } // - layoutBinder.getSortedTargets().filter { it.isUsed() } - .flatMap { it.getBindings() } + layoutBinder.sortedTargets.filter { it.isUsed } + .flatMap { it.bindings } .groupBy { - "${tmpDirtyFlags.mapOr(it.getExpr().dirtyFlagSet) { suffix, index -> - "(${tmpDirtyFlags.localValue(index)} & ${it.getExpr().dirtyFlagSet.localValue(index)}) != 0" + "${tmpDirtyFlags.mapOr(it.expr.dirtyFlagSet) { suffix, index -> + "(${tmpDirtyFlags.localValue(index)} & ${it.expr.dirtyFlagSet.localValue(index)}) != 0" }.joinToString(" || ") }" }.forEach { tab("if (${it.key}) {") { - it.value.groupBy { Math.max(1, it.getMinApi()) }.forEach { + it.value.groupBy { Math.max(1, it.minApi) }.forEach { val setterValues = kcode("") { it.value.forEach { binding -> val fieldName: String - if (binding.getTarget().getViewClass(). - equals(binding.getTarget().getInterfaceType())) { - fieldName = "this.${binding.getTarget().fieldName}" + if (binding.target.viewClass. + equals(binding.target.interfaceType)) { + fieldName = "this.${binding.target.fieldName}" } else { - fieldName = "((${binding.getTarget().getViewClass()}) this.${binding.getTarget().fieldName})" + fieldName = "((${binding.target.viewClass}) this.${binding.target.fieldName})" } tab(binding.toJavaCode(fieldName, "this.mBindingComponent")).app(";") } @@ -802,27 +783,27 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { } - layoutBinder.getSortedTargets().filter { it.isUsed() } - .flatMap { it.getBindings() } + layoutBinder.sortedTargets.filter { it.isUsed } + .flatMap { it.bindings } .filter { it.requiresOldValue() } - .groupBy {"${tmpDirtyFlags.mapOr(it.getExpr().dirtyFlagSet) { suffix, index -> - "(${tmpDirtyFlags.localValue(index)} & ${it.getExpr().dirtyFlagSet.localValue(index)}) != 0" + .groupBy {"${tmpDirtyFlags.mapOr(it.expr.dirtyFlagSet) { suffix, index -> + "(${tmpDirtyFlags.localValue(index)} & ${it.expr.dirtyFlagSet.localValue(index)}) != 0" }.joinToString(" || ") }"}.forEach { tab("if (${it.key}) {") { - it.value.groupBy { it.getExpr() }.map { it.value.first() }.forEach { - it.getComponentExpressions().forEach { expr -> + it.value.groupBy { it.expr }.map { it.value.first() }.forEach { + it.componentExpressions.forEach { expr -> tab("this.${expr.oldValueName} = ${expr.toCode().generate()};") } } } tab("}") } - includedBinders.filter{it.isUsed()}.forEach { binder -> + includedBinders.filter{it.isUsed }.forEach { binder -> tab("${binder.fieldName}.executePendingBindings();") } - layoutBinder.getSortedTargets().filter{ - it.isUsed() && it.getResolvedType() != null && it.getResolvedType().extendsViewStub() + layoutBinder.sortedTargets.filter{ + it.isUsed && it.resolvedType != null && it.resolvedType.extendsViewStub() }.forEach { tab("if (${it.fieldName}.getBinding() != null) {") { tab("${it.fieldName}.getBinding().executePendingBindings();") @@ -852,36 +833,36 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { if (!assignedValues.isEmpty()) { val assignment = kcode("") { assignedValues.forEach { expr: Expr -> - tab("// read ${expr.getUniqueKey()}") + tab("// read ${expr.uniqueKey}") tab("${expr.executePendingLocalName}").app(" = ", expr.toFullCode()).app(";") } } if (condition != null) { - tab("if (${condition}) {") { + tab("if ($condition) {") { app("", assignment) } tab ("}") } else { app("", assignment) } - it.value.filter { it.isObservable() }.forEach { expr: Expr -> - tab("updateRegistration(${expr.getId()}, ${expr.executePendingLocalName});") + it.value.filter { it.isObservable }.forEach { expr: Expr -> + tab("updateRegistration(${expr.id}, ${expr.executePendingLocalName});") } } it.value.forEach { expr: Expr -> justRead.add(expr) - L.d("%s / readWithDependants %s", className, expr.getUniqueKey()); + L.d("%s / readWithDependants %s", className, expr.uniqueKey); L.d("flag set:%s . inherited flags: %s. need another if: %s", flagSet, inheritedFlags, needsIfWrapper); // if I am the condition for an expression, set its flag - expr.getDependants().filter { - !it.isConditional() && it.getDependant() is TernaryExpr && - (it.getDependant() as TernaryExpr).getPred() == expr - }.map { it.getDependant() }.groupBy { + expr.dependants.filter { + !it.isConditional && it.dependant is TernaryExpr && + (it.dependant as TernaryExpr).pred == expr + }.map { it.dependant }.groupBy { // group by when those ternaries will be evaluated (e.g. don't set conditional flags for no reason) - val ternaryBitSet = it.getShouldReadFlagsWithConditionals() - val isBehindTernary = ternaryBitSet.nextSetBit(model.getInvalidateAnyFlagIndex()) == -1 + val ternaryBitSet = it.shouldReadFlagsWithConditionals + val isBehindTernary = ternaryBitSet.nextSetBit(model.invalidateAnyFlagIndex) == -1 if (!isBehindTernary) { val ternaryFlags = it.shouldReadWithConditionalsFlagSet "if(${tmpDirtyFlags.mapOr(ternaryFlags){ suffix, index -> @@ -935,14 +916,14 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { } app("}") } } - val chosen = expr.getDependants().filter { - val dependant = it.getDependant() + val chosen = expr.dependants.filter { + val dependant = it.dependant batch.contains(dependant) && - dependant.shouldReadFlagSet.andNot(flagSet).isEmpty() && + dependant.shouldReadFlagSet.andNot(flagSet).isEmpty && dependant.shouldReadNow(justRead) } if (chosen.isNotEmpty()) { - dependants.addAll(chosen.map { it.getDependant() }) + dependants.addAll(chosen.map { it.dependant }) } } } @@ -967,10 +948,10 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { fun condition(expr : Expr) : String? { if (expr.canBeEvaluatedToAVariable() && !expr.isVariable()) { // create an if case for all dependencies that might be null - val nullables = expr.getDependencies().filter { - it.isMandatory() && it.getOther().getResolvedType().isNullable() - }.map { it.getOther() } - if (!expr.isEqualityCheck() && nullables.isNotEmpty()) { + val nullables = expr.dependencies.filter { + it.isMandatory && it.other.resolvedType.isNullable + }.map { it.other } + if (!expr.isEqualityCheck && nullables.isNotEmpty()) { return "${nullables.map { "${it.executePendingLocalName} != null" }.joinToString(" && ")}" } else { return null @@ -981,43 +962,43 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { } fun declareListenerImpls() = kcode("// Listener Stub Implementations") { - model.getExprMap().values().filter { - it.isUsed() && it is ListenerExpr + model.exprMap.values.filter { + it.isUsed && it is ListenerExpr }.groupBy { it }.forEach { val expr = it.key as ListenerExpr - val listenerType = expr.getResolvedType(); + val listenerType = expr.resolvedType; val extendsImplements : String - if (listenerType.isInterface()) { + if (listenerType.isInterface) { extendsImplements = "implements" } else { extendsImplements = "extends" } - nl("public static class ${expr.listenerClassName} ${extendsImplements} ${listenerType.getCanonicalName()}{") { - if (expr.getChild().isDynamic()) { - tab("private ${expr.getChild().getResolvedType().toJavaCode()} value;") - tab("public ${expr.listenerClassName} setValue(${expr.getChild().getResolvedType().toJavaCode()} value) {") { + nl("public static class ${expr.listenerClassName} $extendsImplements ${listenerType.canonicalName}{") { + if (expr.child.isDynamic) { + tab("private ${expr.child.resolvedType.toJavaCode()} value;") + tab("public ${expr.listenerClassName} setValue(${expr.child.resolvedType.toJavaCode()} value) {") { tab("this.value = value;") tab("return value == null ? null : this;") } tab("}") } - val listenerMethod = expr.getMethod() - val parameterTypes = listenerMethod.getParameterTypes() + val listenerMethod = expr.method + val parameterTypes = listenerMethod.parameterTypes val returnType = listenerMethod.getReturnType(parameterTypes.toArrayList()) tab("@Override") - tab("public ${returnType} ${listenerMethod.getName()}(${ + tab("public $returnType ${listenerMethod.name}(${ parameterTypes.withIndex().map { "${it.value.toJavaCode()} arg${it.index}" }.joinToString(", ") }) {") { val obj : String - if (expr.getChild().isDynamic()) { + if (expr.child.isDynamic) { obj = "this.value" } else { - obj = expr.getChild().toCode().generate(); + obj = expr.child.toCode().generate(); } val returnStr : String - if (!returnType.isVoid()) { + if (!returnType.isVoid) { returnStr = "return " } else { returnStr = "" @@ -1025,7 +1006,7 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { val args = parameterTypes.withIndex().map { "arg${it.index}" }.joinToString(", ") - tab("${returnStr}${obj}.${expr.getName()}(${args});") + tab("$returnStr$obj.${expr.name}($args);") } tab("}") } @@ -1034,33 +1015,33 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { } fun declareFactories() = kcode("") { - nl("public static ${baseClassName} inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot) {") { + nl("public static $baseClassName inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot) {") { tab("return inflate(inflater, root, attachToRoot, android.databinding.DataBindingUtil.getDefaultComponent());") } nl("}") - nl("public static ${baseClassName} inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot, android.databinding.DataBindingComponent bindingComponent) {") { - tab("return android.databinding.DataBindingUtil.<${baseClassName}>inflate(inflater, ${layoutBinder.getModulePackage()}.R.layout.${layoutBinder.getLayoutname()}, root, attachToRoot, bindingComponent);") + nl("public static $baseClassName inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot, android.databinding.DataBindingComponent bindingComponent) {") { + tab("return android.databinding.DataBindingUtil.<$baseClassName>inflate(inflater, ${layoutBinder.modulePackage}.R.layout.${layoutBinder.layoutname}, root, attachToRoot, bindingComponent);") } nl("}") - if (!layoutBinder.isMerge()) { - nl("public static ${baseClassName} inflate(android.view.LayoutInflater inflater) {") { + if (!layoutBinder.isMerge) { + nl("public static $baseClassName inflate(android.view.LayoutInflater inflater) {") { tab("return inflate(inflater, android.databinding.DataBindingUtil.getDefaultComponent());") } nl("}") - nl("public static ${baseClassName} inflate(android.view.LayoutInflater inflater, android.databinding.DataBindingComponent bindingComponent) {") { - tab("return bind(inflater.inflate(${layoutBinder.getModulePackage()}.R.layout.${layoutBinder.getLayoutname()}, null, false), bindingComponent);") + nl("public static $baseClassName inflate(android.view.LayoutInflater inflater, android.databinding.DataBindingComponent bindingComponent) {") { + tab("return bind(inflater.inflate(${layoutBinder.modulePackage}.R.layout.${layoutBinder.layoutname}, null, false), bindingComponent);") } nl("}") - nl("public static ${baseClassName} bind(android.view.View view) {") { + nl("public static $baseClassName bind(android.view.View view) {") { tab("return bind(view, android.databinding.DataBindingUtil.getDefaultComponent());") } nl("}") - nl("public static ${baseClassName} bind(android.view.View view, android.databinding.DataBindingComponent bindingComponent) {") { - tab("if (!\"${layoutBinder.getTag()}_0\".equals(view.getTag())) {") { + nl("public static $baseClassName bind(android.view.View view, android.databinding.DataBindingComponent bindingComponent) {") { + tab("if (!\"${layoutBinder.tag}_0\".equals(view.getTag())) {") { tab("throw new RuntimeException(\"view tag isn't correct on view:\" + view.getTag());") } tab("}") - tab("return new ${baseClassName}(bindingComponent, view);") + tab("return new $baseClassName(bindingComponent, view);") } nl("}") } @@ -1070,43 +1051,43 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { * When called for a library compilation, we do not generate real implementations */ public fun writeBaseClass(forLibrary : Boolean) : String = - kcode("package ${layoutBinder.getPackage()};") { + kcode("package ${layoutBinder.`package`};") { nl("import android.databinding.Bindable;") nl("import android.databinding.DataBindingUtil;") nl("import android.databinding.ViewDataBinding;") - nl("public abstract class ${baseClassName} extends ViewDataBinding {") - layoutBinder.getSortedTargets().filter{it.getId() != null}.forEach { - tab("public final ${it.interfaceType} ${it.fieldName};") + nl("public abstract class $baseClassName extends ViewDataBinding {") + layoutBinder.sortedTargets.filter{it.id != null}.forEach { + tab("public final ${it.interfaceClass} ${it.fieldName};") } nl("") - tab("protected ${baseClassName}(android.databinding.DataBindingComponent bindingComponent, android.view.View root_, int localFieldCount") { - layoutBinder.getSortedTargets().filter{it.getId() != null}.forEach { - tab(", ${it.interfaceType} ${it.constructorParamName}") + tab("protected $baseClassName(android.databinding.DataBindingComponent bindingComponent, android.view.View root_, int localFieldCount") { + layoutBinder.sortedTargets.filter{it.id != null}.forEach { + tab(", ${it.interfaceClass} ${it.constructorParamName}") } } tab(") {") { tab("super(bindingComponent, root_, localFieldCount);") - layoutBinder.getSortedTargets().filter{it.getId() != null}.forEach { + layoutBinder.sortedTargets.filter{it.id != null}.forEach { tab("this.${it.fieldName} = ${it.constructorParamName};") } } tab("}") nl("") variables.forEach { - if (it.getUserDefinedType() != null) { - val type = ModelAnalyzer.getInstance().applyImports(it.getUserDefinedType(), model.getImports()) - tab("public abstract void ${it.setterName}(${type} ${it.readableName});") + if (it.userDefinedType != null) { + val type = ModelAnalyzer.getInstance().applyImports(it.userDefinedType, model.imports) + tab("public abstract void ${it.setterName}($type ${it.readableName});") } } - tab("public static ${baseClassName} inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot) {") { + tab("public static $baseClassName inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot) {") { tab("return inflate(inflater, root, attachToRoot, android.databinding.DataBindingUtil.getDefaultComponent());") } tab("}") - tab("public static ${baseClassName} inflate(android.view.LayoutInflater inflater) {") { + tab("public static $baseClassName inflate(android.view.LayoutInflater inflater) {") { tab("return inflate(inflater, android.databinding.DataBindingUtil.getDefaultComponent());") } tab("}") - tab("public static ${baseClassName} bind(android.view.View view) {") { + tab("public static $baseClassName bind(android.view.View view) {") { if (forLibrary) { tab("return null;") } else { @@ -1114,27 +1095,27 @@ class LayoutBinderWriter(val layoutBinder : LayoutBinder) { } } tab("}") - tab("public static ${baseClassName} inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot, android.databinding.DataBindingComponent bindingComponent) {") { + tab("public static $baseClassName inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot, android.databinding.DataBindingComponent bindingComponent) {") { if (forLibrary) { tab("return null;") } else { - tab("return DataBindingUtil.<${baseClassName}>inflate(inflater, ${layoutBinder.getModulePackage()}.R.layout.${layoutBinder.getLayoutname()}, root, attachToRoot, bindingComponent);") + tab("return DataBindingUtil.<$baseClassName>inflate(inflater, ${layoutBinder.modulePackage}.R.layout.${layoutBinder.layoutname}, root, attachToRoot, bindingComponent);") } } tab("}") - tab("public static ${baseClassName} inflate(android.view.LayoutInflater inflater, android.databinding.DataBindingComponent bindingComponent) {") { + tab("public static $baseClassName inflate(android.view.LayoutInflater inflater, android.databinding.DataBindingComponent bindingComponent) {") { if (forLibrary) { tab("return null;") } else { - tab("return DataBindingUtil.<${baseClassName}>inflate(inflater, ${layoutBinder.getModulePackage()}.R.layout.${layoutBinder.getLayoutname()}, null, false, bindingComponent);") + tab("return DataBindingUtil.<$baseClassName>inflate(inflater, ${layoutBinder.modulePackage}.R.layout.${layoutBinder.layoutname}, null, false, bindingComponent);") } } tab("}") - tab("public static ${baseClassName} bind(android.view.View view, android.databinding.DataBindingComponent bindingComponent) {") { + tab("public static $baseClassName bind(android.view.View view, android.databinding.DataBindingComponent bindingComponent) {") { if (forLibrary) { tab("return null;") } else { - tab("return (${baseClassName})bind(bindingComponent, view, ${layoutBinder.getModulePackage()}.R.layout.${layoutBinder.getLayoutname()});") + tab("return ($baseClassName)bind(bindingComponent, view, ${layoutBinder.modulePackage}.R.layout.${layoutBinder.layoutname});") } } tab("}") diff --git a/compiler/src/main/resources/NOTICE.txt b/compiler/src/main/resources/NOTICE.txt index 3d9a3f79..36ed1c9e 100644 --- a/compiler/src/main/resources/NOTICE.txt +++ b/compiler/src/main/resources/NOTICE.txt @@ -1,6 +1,6 @@ List of 3rd party licenses: ----------------------------------------------------------------------------- -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@4f7bf2e0 name:antlr4 classifier:null extension:jar type:jar] +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@51d6b1e name:antlr4 classifier:null extension:jar type:jar] ****** LICENSE: [The "BSD license"] @@ -34,259 +34,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@46266496 name:commons-io classifier:null extension:jar type:jar] - - ****** NOTICE: -Apache Commons IO -Copyright 2002-2014 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - - ****** LICENSE: - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - - ------------------------------------------------------------------------------ -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@59dea2a7 name:antlr4-annotations classifier:null extension:jar type:jar] - - ****** LICENSE: -[The "BSD license"] -Copyright (c) 2015 Terence Parr, Sam Harwell -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - ------------------------------------------------------------------------------ -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@32496639 name:kotlin-stdlib classifier:null extension:jar type:jar] +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@651cb3d9 name:kotlin-stdlib classifier:null extension:jar type:jar] ****** NOTICE: ========================================================================= @@ -523,27 +271,15 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@268edb0a name:commons-codec classifier:null extension:jar type:jar] +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@2fc42657 name:commons-io classifier:null extension:jar type:jar] ****** NOTICE: -Apache Commons Codec -Copyright 2002-2015 The Apache Software Foundation +Apache Commons IO +Copyright 2002-2014 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). -src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java -contains test data from http://aspell.net/test/orig/batch0.tab. -Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org) - -=============================================================================== - -The content of package org.apache.commons.codec.language.bm has been translated -from the original php source code available at http://stevemorse.org/phoneticinfo.htm -with permission from the original authors. -Original source copyright: -Copyright (c) 2008 Alexander Beider & Stephen P. Morse. - ****** LICENSE: Apache License @@ -751,8 +487,9 @@ Copyright (c) 2008 Alexander Beider & Stephen P. Morse. + ----------------------------------------------------------------------------- -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@2a7dabb8 name:antlr-runtime classifier:null extension:jar type:jar] +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@15859779 name:antlr4-annotations classifier:null extension:jar type:jar] ****** LICENSE: [The "BSD license"] @@ -786,34 +523,26 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@510c2e71 name:kotlin-runtime classifier:null extension:jar type:jar] +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@a364cb2 name:commons-codec classifier:null extension:jar type:jar] ****** NOTICE: - ========================================================================= - == NOTICE file corresponding to the section 4 d of == - == the Apache License, Version 2.0, == - == in this case for the Kotlin Compiler distribution. == - ========================================================================= +Apache Commons Codec +Copyright 2002-2015 The Apache Software Foundation - Kotlin Compiler - Copyright 2010-2015 JetBrains s.r.o and respective authors and developers +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). - ****** LICENSE: -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java +contains test data from http://aspell.net/test/orig/batch0.tab. +Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org) + +=============================================================================== + +The content of package org.apache.commons.codec.language.bm has been translated +from the original php source code available at http://stevemorse.org/phoneticinfo.htm +with permission from the original authors. +Original source copyright: +Copyright (c) 2008 Alexander Beider & Stephen P. Morse. ****** LICENSE: @@ -1023,7 +752,41 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@7012ce6e name:juniversalchardet classifier:null extension:jar type:jar] +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@6c2e3a1a name:antlr-runtime classifier:null extension:jar type:jar] + + ****** LICENSE: +[The "BSD license"] +Copyright (c) 2015 Terence Parr, Sam Harwell +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + +----------------------------------------------------------------------------- +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@76957ab3 name:juniversalchardet classifier:null extension:jar type:jar] ****** LICENSE: MOZILLA PUBLIC LICENSE @@ -1500,7 +1263,7 @@ EXHIBIT A -Mozilla Public License. ----------------------------------------------------------------------------- -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@772c2848 name:org.abego.treelayout.core classifier:null extension:jar type:jar] +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@1abebee9 name:org.abego.treelayout.core classifier:null extension:jar type:jar] ****** LICENSE: [The "BSD license"] @@ -1535,7 +1298,7 @@ POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@1ec82e2e name:antlr4-runtime classifier:null extension:jar type:jar] +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@1bfa74bc name:antlr4-runtime classifier:null extension:jar type:jar] ****** LICENSE: [The "BSD license"] @@ -1569,7 +1332,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@3e6cffb0 name:ST4 classifier:null extension:jar type:jar] +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@3b9eaadc name:ST4 classifier:null extension:jar type:jar] ****** LICENSE: [The "BSD license"] @@ -1603,7 +1366,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- -* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@2d45d486 name:commons-lang3 classifier:null extension:jar type:jar] +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@4770644e name:commons-lang3 classifier:null extension:jar type:jar] ****** NOTICE: Apache Commons Lang @@ -1821,3 +1584,240 @@ under the Apache License 2.0 (see: StringUtils.containsWhitespace()) + +----------------------------------------------------------------------------- +* [ResolvedArtifact dependency:org.gradle.api.internal.artifacts.ivyservice.dynamicversions.DefaultResolvedModuleVersion@238af8b0 name:kotlin-runtime classifier:null extension:jar type:jar] + + ****** NOTICE: + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Kotlin Compiler distribution. == + ========================================================================= + + Kotlin Compiler + Copyright 2010-2015 JetBrains s.r.o and respective authors and developers + + ****** LICENSE: +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + ****** LICENSE: + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + |