【发布时间】:2022-09-30 23:58:30
【问题描述】:
我最近为一个相当大的项目切换到 Java 11,并想切换到使用 var class = new Class() 而不是 Class class = new CLass()。
我为此尝试使用 Intellij 结构搜索(和替换),但结果比预期的要复杂。
我的第一次尝试是$Type$ $Inst$ = new $Constructor$($Argument$);,它也匹配全局变量(不允许 var)。
我的第二次尝试是:
class $Class$ {
$ReturnType$ $Method$ ($ParameterType$ $Parameter$) throws $ExceptionType$ {
$Statements$;
final $Type$ $Inst$ = new $Constructor$($Argument$);
$Statements2$;
}
}
错过了内部的所有电话,例如尝试块(因为它们被表达式匹配)
任何帮助将不胜感激!
标签: intellij-idea structural-search