I am not sure if anyone still looks at AJDT Bugzilla, so I am recording this problem here, creating tracker bug #576017 in AJDT Bugzilla only.
While answering StackOverflow #69196740, I noticed the following problem in AJDT.
This aspect compiles and runs fine in Eclipse 2021-06 and AspectJ 1.9.7:
package de.scrum_master.aspect;
import java.util.concurrent.Callable;
public aspect MemoizeAspect {
Object around(): execution(* doesNotExist()) {
MyCache<String, Object> cache = new MyCache<>();
return cache.get("key", () -> proceed());
}
Object around(): execution(* doesNotExist()) {
MyCache<String, Object> cache = new MyCache<>();
Callable<?> callable = () -> proceed();
return cache.get("key", callable);
}
Object around(): execution(* doesNotExist()) {
MyCache<String, Object> cache = new MyCache<>();
return cache.get("key", () -> "value");
}
public static class MyCache<K, V> {
public V get(K key, Callable<? extends V> loader) {
return null;
}
}
}
Eclipse does not show any errors in the "Problems" view. But the editor falsely flags an alleged error:

The error message is:
The method get(String, Callable<? extends Object>) in the type MemoizeAspect.MyCache<String,Object> is not applicable for the arguments (String, () -> {})

Please note:
- As you can see in the third around-advice, when returning a fixed value instead of
proceed() or proceed(arg1, args2) there is no problem.
- When transforming the aspect into annotation-style, it also works. But in that case, we also need to wrap
proceed() into a try-catch block handling Throwable, so the source code looks different.
- Factoring out the
Callable into a local variable like in the second around-advice works, too.
I am not sure if anyone still looks at AJDT Bugzilla, so I am recording this problem here, creating tracker bug #576017 in AJDT Bugzilla only.
While answering StackOverflow #69196740, I noticed the following problem in AJDT.
This aspect compiles and runs fine in Eclipse 2021-06 and AspectJ 1.9.7:
Eclipse does not show any errors in the "Problems" view. But the editor falsely flags an alleged error:
The error message is:
Please note:
proceed()orproceed(arg1, args2)there is no problem.proceed()into a try-catch block handlingThrowable, so the source code looks different.Callableinto a local variable like in the second around-advice works, too.