You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/08/28 03:24:18 UTC
zest-java git commit: ZEST-118;
Forgot to expand all the types in CompositeAssemblyImpl. This should
have massive impact.
Repository: zest-java
Updated Branches:
refs/heads/develop 7e41b4119 -> 4e5cfd8ca
ZEST-118; Forgot to expand all the types in CompositeAssemblyImpl. This should have massive impact.
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/4e5cfd8c
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/4e5cfd8c
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/4e5cfd8c
Branch: refs/heads/develop
Commit: 4e5cfd8ca010fd3bc0e1558b5c122f1ef5d2fc82
Parents: 7e41b41
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Fri Aug 28 09:23:52 2015 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Fri Aug 28 09:23:52 2015 +0800
----------------------------------------------------------------------
.../bootstrap/CompositeAssemblyImpl.java | 50 ++++++++++++--------
1 file changed, 31 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zest-java/blob/4e5cfd8c/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/CompositeAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/CompositeAssemblyImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/CompositeAssemblyImpl.java
index 05c6f66..0eed62f 100755
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/CompositeAssemblyImpl.java
+++ b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/CompositeAssemblyImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.zest.runtime.bootstrap;
+import java.util.function.Function;
import org.apache.zest.api.common.*;
import org.apache.zest.api.common.Optional;
import org.apache.zest.api.composite.InvalidCompositeException;
@@ -125,10 +126,10 @@ public abstract class CompositeAssemblyImpl
compositeMethodsModel = new CompositeMethodsModel( mixinsModel );
// Implement composite methods
- List<Class<?>> constraintClasses = toList( constraintDeclarations( this.types.stream() ) );
- List<Class<?>> concernClasses = toList( concat( concerns.stream(), concernDeclarations( this.types.stream() ) ) );
- List<Class<?>> sideEffectClasses = toList( concat( sideEffects.stream(), sideEffectDeclarations( this.types.stream() ) ) );
- List<Class<?>> mixinClasses = toList( concat( mixins.stream(), mixinDeclarations( this.types.stream() ) ) );
+ List<Class<?>> constraintClasses = toList( constraintDeclarations( getAllTypes() ) );
+ List<Class<?>> concernClasses = toList( concat( concerns.stream(), concernDeclarations( getAllTypes() ) ) );
+ List<Class<?>> sideEffectClasses = toList( concat( sideEffects.stream(), sideEffectDeclarations( getAllTypes() ) ) );
+ List<Class<?>> mixinClasses = toList( concat( mixins.stream(), mixinDeclarations( getAllTypes() ) ) );
//noinspection unchecked
implementMixinType( types,
constraintClasses,
@@ -665,7 +666,14 @@ public abstract class CompositeAssemblyImpl
{
return types
.filter( mixinType -> Annotations.annotationOn( mixinType, Concerns.class ) != null )
- .flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, Concerns.class ).value() ) );
+ .flatMap( new Function<Type, Stream<? extends Class<?>>>()
+ {
+ @Override
+ public Stream<? extends Class<?>> apply( Type mixinType )
+ {
+ return Arrays.stream( Annotations.annotationOn( mixinType, Concerns.class ).value() );
+ }
+ } );
}
@SuppressWarnings( "unchecked" )
@@ -682,6 +690,24 @@ public abstract class CompositeAssemblyImpl
.flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, SideEffects.class ).value() ) );
}
+ protected Stream<Class<?>> mixinDeclarations( Class<?> type )
+ {
+ Stream<? extends Type> types = getTypes( type );
+ return mixinDeclarations( types );
+ }
+
+ private Stream<Class<?>> mixinDeclarations( Stream<? extends Type> types )
+ {
+ return types.flatMap( this::getTypes )
+ .filter( mixinType -> Annotations.annotationOn( mixinType, Mixins.class ) != null )
+ .flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, Mixins.class ).value() ) );
+ }
+
+ private Stream<Type> getAllTypes()
+ {
+ return this.types.stream().flatMap( this::getTypes );
+ }
+
private Stream<? extends Type> getTypes( Type type )
{
if( type instanceof Class )
@@ -698,18 +724,4 @@ public abstract class CompositeAssemblyImpl
}
throw new UnsupportedOperationException( "Unable to handle type " + type.getTypeName() );
}
-
- @SuppressWarnings( "unchecked" )
- protected Stream<Class<?>> mixinDeclarations( Class<?> type )
- {
- Stream<? extends Type> types = getTypes( type );
- return mixinDeclarations( types );
- }
-
- private Stream<Class<?>> mixinDeclarations( Stream<? extends Type> types )
- {
- return types.flatMap( this::getTypes )
- .filter( mixinType -> Annotations.annotationOn( mixinType, Mixins.class ) != null )
- .flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, Mixins.class ).value() ) );
- }
}