Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async Execution Aspect compiler error when using ListenableFuture [SPR-12895] #17494

Closed
spring-issuemaster opened this issue Apr 7, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Apr 7, 2015

Daniel Gonzalez opened SPR-12895 and commented

When using @Async annotation to create an async execution for a method ListenableFuture is one of the options that could be used as return type in the method as it seems to be supported by all the spring async aspect code.

On aspect AnnotationAsyncExecutionAspect.aj the pointcut to intercept async annotations classes is as follows:

private pointcut asyncMarkedMethod()
		: execution(@Async (void || Future+) *(..));

Which accepts Future or one of its subclasses as return type.

But then in the same class a compiler error is declared that only accepts Future:

declare error:
		execution(@Async !(void||Future) *(..)):
		"Only methods that return void or Future may have an @Async annotation";

This declarations causes that when I used something like:

@Async
public ListenableFuture execute() {
...
return new AsyncResult();
}

Fails with a compiler error.

Also I cannot used the plain Future as then I cannot add callback handlers to the future. I always can call the task manager directly but as it seems that it is a feature that it is supported by the annotation I would prefer to do that as I'm using it in other places on the application without any issue.


Affects: 4.1.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.