I'm trying to create an inspection based on Structural Search to avoid initializing ExecutorService to Executor Variables.
The below is my template:
<searchConfiguration name="Use an ExecutorService variable to initialize instead of Executor" text="Executor $x$ = $y$;" recursive="true" caseInsensitive="true" type="JAVA" >
<constraint name="__context__" within="" contains="" />
<constraint name="x" nameOfExprType="java\.util\.concurrent\.Executor" within="" contains="" />
<constraint name="y" nameOfExprType="java\.util\.concurrent\.ExecutorService" within="" contains="" />
The code which I want to avoid such initializations:
private final Executor exec = Execs.singleThreaded("test-%s");
The structural search is not working as I expected. What's wrong with my template?
I removed "nameOfExprType" of x. It worked.