diff --git a/build.gradle b/build.gradle index 0d80eec..832fbc9 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ ext { def versionMajor = 0 def versionMinor = 5 def versionPatch = 0 - version = "${versionMajor}.${versionMinor}.${versionPatch}" + versionName = "${versionMajor}.${versionMinor}.${versionPatch}" compileSdkVersion = 23 buildToolsVersion = '23.0.2' diff --git a/droidux-processor/build.gradle b/droidux-processor/build.gradle index 98db7d8..e9bba9b 100644 --- a/droidux-processor/build.gradle +++ b/droidux-processor/build.gradle @@ -34,7 +34,7 @@ publish { userOrg = project_bintray_org groupId = project_group artifactId = 'droidux-processor' - version = project.version + version = project.versionName description = 'Code generator for info.izumin.android.droidux' website = project_url } diff --git a/droidux-processor/src/main/java/info/izumin/android/droidux/processor/generator/StoreClassGenerator.java b/droidux-processor/src/main/java/info/izumin/android/droidux/processor/generator/StoreClassGenerator.java index 27abdb1..d2565b3 100644 --- a/droidux-processor/src/main/java/info/izumin/android/droidux/processor/generator/StoreClassGenerator.java +++ b/droidux-processor/src/main/java/info/izumin/android/droidux/processor/generator/StoreClassGenerator.java @@ -80,7 +80,7 @@ public FieldSpec apply(StoreImplModel input) { private MethodSpec createConstructor() { MethodSpec.Builder builder = MethodSpec.constructorBuilder() .addModifiers(Modifier.PROTECTED) - .addParameter(getParameterSpec(storeModel.getBuilderModel().getClassName())); + .addParameter(getParameterSpec(storeModel.getBuilderModel().getClassName(), Modifier.FINAL)); for (StoreImplModel storeImpl : storeModel.getStoreImplModels()) { builder = builder.addStatement("$N = new $T($N.$N, $N.$N)", diff --git a/droidux-processor/src/main/java/info/izumin/android/droidux/processor/model/StoreModel.java b/droidux-processor/src/main/java/info/izumin/android/droidux/processor/model/StoreModel.java index 9f9a9be..58da143 100644 --- a/droidux-processor/src/main/java/info/izumin/android/droidux/processor/model/StoreModel.java +++ b/droidux-processor/src/main/java/info/izumin/android/droidux/processor/model/StoreModel.java @@ -6,7 +6,6 @@ import com.squareup.javapoet.ClassName; import java.util.List; -import java.util.function.Consumer; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; @@ -74,25 +73,22 @@ public StoreMethodModel apply(ExecutableElement input) { }) .toList(); - FluentIterable.from(storeImplModels) - .forEach(new Consumer() { - @Override - public void accept(final StoreImplModel storeImplModel) { - storeImplModel.setIsBindable(FluentIterable.from(methodModels) - .filter(new Predicate() { - @Override - public boolean apply(StoreMethodModel input) { - return ClassName.get(input.getReturnType()).equals(storeImplModel.getState()); - } - }) - .anyMatch(new Predicate() { - @Override - public boolean apply(StoreMethodModel input) { - return input.isBindable(); - } - })); - } - }); + for (final StoreImplModel storeImplModel : storeImplModels) { + storeImplModel.setIsBindable(FluentIterable.from(methodModels) + .filter(new Predicate() { + @Override + public boolean apply(StoreMethodModel input) { + return ClassName.get(input.getReturnType()).equals(storeImplModel.getState()); + } + }) + .anyMatch(new Predicate() { + @Override + public boolean apply(StoreMethodModel input) { + return input.isBindable(); + } + })); + } + this.builderModel = new BuilderModel(this); } diff --git a/droidux-processor/src/test/java/info/izumin/android/droidux/processor/fixture/Source.java b/droidux-processor/src/test/java/info/izumin/android/droidux/processor/fixture/Source.java index b1352c5..e825c29 100644 --- a/droidux-processor/src/test/java/info/izumin/android/droidux/processor/fixture/Source.java +++ b/droidux-processor/src/test/java/info/izumin/android/droidux/processor/fixture/Source.java @@ -113,7 +113,7 @@ public static class Counter { " private final DroiduxRootStore_CounterStoreImpl counterStoreImpl;", " private final Dispatcher dispatcher;", "", - " protected DroiduxRootStore(Builder builder) {", + " protected DroiduxRootStore(final Builder builder) {", " counterStoreImpl= new DroiduxRootStore_CounterStoreImpl(builder.counter, builder.counterReducer);", " dispatcher = new Dispatcher(builder.middlewares, counterStoreImpl);", " for (Middleware middleware : builder.middlewares) {", @@ -211,7 +211,7 @@ public static class BindableCounter { " private final DroiduxRootStore_CounterStoreImpl counterStoreImpl;", " private final Dispatcher dispatcher;", "", - " protected DroiduxRootStore(Builder builder) {", + " protected DroiduxRootStore(final Builder builder) {", " counterStoreImpl = new DroiduxRootStore_CounterStoreImpl(builder.counter, builder.counterReducer);", " counterStoreImpl.addListener(new OnStateChangedListener() {", " @Override", @@ -322,7 +322,7 @@ public static class CombinedTwoReducers { " private final DroiduxRootStore_TodoListStoreImpl todoListStoreImpl;", " private final Dispatcher dispatcher;", "", - " protected DroiduxRootStore(Builder builder) {", + " protected DroiduxRootStore(final Builder builder) {", " counterStoreImpl= new DroiduxRootStore_CounterStoreImpl(builder.counter, builder.counterReducer);", " todoListStoreImpl= new DroiduxRootStore_TodoListStoreImpl(builder.todoList, builder.todoListReducer);", " dispatcher = new Dispatcher(builder.middlewares, counterStoreImpl, todoListStoreImpl);", @@ -453,7 +453,7 @@ public static class CombinedReducerAndBindableReducer { " private final DroiduxRootStore_TodoListStoreImpl todoListStoreImpl;", " private final Dispatcher dispatcher;", "", - " protected DroiduxRootStore(Builder builder) {", + " protected DroiduxRootStore(final Builder builder) {", " counterStoreImpl= new DroiduxRootStore_CounterStoreImpl(builder.counter, builder.counterReducer);", " todoListStoreImpl= new DroiduxRootStore_TodoListStoreImpl(builder.todoList, builder.todoListReducer);", " todoListStoreImpl.addListener(new OnStateChangedListener() {", diff --git a/droidux/build.gradle b/droidux/build.gradle index 99c86ad..569930b 100644 --- a/droidux/build.gradle +++ b/droidux/build.gradle @@ -40,7 +40,7 @@ publish { userOrg = project_bintray_org groupId = project_group artifactId = 'droidux' - version = project.version + version = project.versionName description = '"Predictable state container" implementation, inspired by Redux for JS.' website = project_url }