Skip to content

Commit

Permalink
Merge branch '3.0.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed Jun 30, 2015
2 parents 8e51452 + c61d901 commit 8e1769e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -41,7 +41,7 @@ ext {
jlineVersion = "2.12"
jnaVersion = "4.0.0"
slf4jVersion = "1.7.10"
reactorVersion = '2.0.0.RELEASE'
reactorVersion = '2.0.3.RELEASE'

spockVersion = '1.0-groovy-2.4'
springLoadedVersion = "1.2.3.RELEASE"
Expand Down
8 changes: 8 additions & 0 deletions grails-bootstrap/src/main/groovy/grails/util/Environment.java
Expand Up @@ -25,6 +25,7 @@

import org.codehaus.groovy.control.MultipleCompilationErrorsException;
import org.codehaus.groovy.runtime.DefaultGroovyMethods;
import org.grails.io.support.MainClassFinder;

/**
* Represents the current environment.
Expand Down Expand Up @@ -497,6 +498,13 @@ private String getReloadLocationInternal() {
if(current.exists()) {
location = current.getParentFile().getAbsolutePath();
}
else {
current = new File(".", "settings.gradle");
if(current.exists()) {
// multi-project build

}
}
}
return location;
}
Expand Down
9 changes: 9 additions & 0 deletions grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
Expand Up @@ -37,6 +37,7 @@
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.BeansException;
import org.springframework.beans.FatalBeanException;
import org.springframework.cglib.reflect.FastClass;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
Expand Down Expand Up @@ -1257,4 +1258,12 @@ public static Boolean hasBeenEnhancedForFeature(final Class<?> controllerClass,
}
return hasBeenEnhanced;
}

public static FastClass fastClass(Class superClass) {
FastClass.Generator gen = new FastClass.Generator();
gen.setType(superClass);
gen.setClassLoader(superClass.getClassLoader());
gen.setUseCache( !Environment.isReloadingAgentEnabled() );
return gen.create();
}
}
Expand Up @@ -16,9 +16,9 @@
package org.grails.core;

import grails.core.GrailsControllerClass;
import grails.util.GrailsClassUtils;
import grails.web.Action;
import groovy.lang.GroovyObject;
import org.springframework.beans.factory.config.Scope;
import org.springframework.cglib.reflect.FastClass;
import org.springframework.cglib.reflect.FastMethod;
import org.springframework.util.ReflectionUtils;
Expand Down Expand Up @@ -90,8 +90,8 @@ public String getDefaultAction() {
private void methodStrategy(Map<String, FastMethod> methodNames) {

Class superClass = getClazz();
FastClass fastClass = FastClass.create(superClass);
while (superClass != null && superClass != Object.class && superClass != GroovyObject.class) {
FastClass fastClass = GrailsClassUtils.fastClass(superClass);
while (superClass != Object.class && superClass != GroovyObject.class) {
for (Method method : superClass.getMethods()) {
if (Modifier.isPublic(method.getModifiers()) && method.getAnnotation(Action.class) != null) {
String methodName = method.getName();
Expand All @@ -101,7 +101,7 @@ private void methodStrategy(Map<String, FastMethod> methodNames) {
}
}
superClass = superClass.getSuperclass();
fastClass = FastClass.create(superClass);
fastClass = GrailsClassUtils.fastClass(superClass);
}

if (!isActionMethod(defaultActionName) && methodNames.size() == 1 && !isReadableProperty("scaffold")) {
Expand Down
12 changes: 6 additions & 6 deletions grails-plugin-events/src/main/groovy/grails/events/Events.groovy
Expand Up @@ -43,31 +43,31 @@ trait Events {
/**
* @see #on(reactor.bus.selector.Selector, reactor.fn.Consumer)
*/
public <E extends Event<?> > Registration<Consumer<E>> on(Class key, @DelegatesTo(strategy = Closure.DELEGATE_FIRST,
public <E extends Event<?> > Registration<Object, Consumer<E>> on(Class key, @DelegatesTo(strategy = Closure.DELEGATE_FIRST,
value = ClosureEventConsumer.ReplyDecorator) Closure consumer) {
on key, new ClosureEventConsumer<E>(consumer)
}

/**
* @see #on(reactor.bus.selector.Selector, reactor.fn.Consumer)
*/
public <E extends Event<?> > Registration<Consumer<E>> on(Selector key, @DelegatesTo(strategy = Closure.DELEGATE_FIRST,
public <E extends Event<?> > Registration<Object, Consumer<E>> on(Selector key, @DelegatesTo(strategy = Closure.DELEGATE_FIRST,
value = ClosureEventConsumer.ReplyDecorator) Closure consumer) {
on key, new ClosureEventConsumer<E>(consumer)
}

/**
* @see #on(reactor.bus.selector.Selector, reactor.fn.Consumer)
*/
public <E extends Event<?> > Registration<Consumer<E>> on(key, @DelegatesTo(strategy = Closure.DELEGATE_FIRST,
public <E extends Event<?> > Registration<Object, Consumer<E>> on(key, @DelegatesTo(strategy = Closure.DELEGATE_FIRST,
value = ClosureEventConsumer.ReplyDecorator) Closure consumer) {
on key, new ClosureEventConsumer<E>(consumer)
}

/**
* @see #on(reactor.bus.selector.Selector, reactor.fn.Consumer)
*/
public <E extends Event<?> > Registration<Consumer<E>> on(key, Consumer<E> consumer) {
public <E extends Event<?> > Registration<Object, Consumer<E>> on(key, Consumer<E> consumer) {
if(key instanceof CharSequence) {
key = key.toString()
}
Expand All @@ -77,7 +77,7 @@ trait Events {
/**
* @see #on(reactor.bus.selector.Selector, reactor.fn.Consumer)
*/
public <E extends Event<?> > Registration<Consumer<E>> on(Class type, Consumer<E> consumer) {
public <E extends Event<?> > Registration<Object, Consumer<E>> on(Class type, Consumer<E> consumer) {
on(Selectors.T(type), consumer)
}

Expand All @@ -94,7 +94,7 @@ trait Events {
*
* @return A {@link Registration} object that allows the caller to interact with the given mapping
*/
public <E extends Event<?> > Registration<Consumer<E>> on(Selector sel, Consumer<E> consumer) {
public <E extends Event<?> > Registration<Object, Consumer<E>> on(Selector sel, Consumer<E> consumer) {
if(eventBus == null) throw new IllegalStateException("EventBus not present. Event registration attempted outside of application context.")
eventBus.on sel, consumer
}
Expand Down
Expand Up @@ -19,8 +19,8 @@ import groovy.transform.CompileStatic
import reactor.bus.Bus
import reactor.bus.Event
import reactor.bus.EventBus
import reactor.core.processor.CancelException
import reactor.fn.Consumer
import reactor.fn.support.CancelConsumerException



Expand All @@ -45,7 +45,7 @@ class ClosureEventConsumer<T> implements Consumer<Event<T>> {
}

void cancel() {
throw new CancelConsumerException()
throw CancelException.get()
}

@Override
Expand Down

0 comments on commit 8e1769e

Please sign in to comment.