Idempotency errors under 2020.1
已回答
Since updating my plugin to 2020.1, I've been receiving errors like this:
[java] Caused by: java.lang.Throwable: Non-idempotent computation: it returns different results when invoked multiple times or on different threads:
[java] 0 != 1
[java] which is length of [] and [cursive.psi.resolve.ClojureResolveResultImpl@772d6d24]
[java]
[java] Recomputation gives [Lcursive.psi.resolve.ClojureResolveResult;@5241dc42 (class [Lcursive.psi.resolve.ClojureResolveResult;) which is equivalent to 'fresh'
[java] Recomputation log:
[java] Resolving cursive.psi.impl.symbols.SymbolReference@eb426928 of class cursive.psi.impl.symbols.SymbolReference
[java] ... 154 more
The error message mentions different threads, this would be possible in my plugin because my resolve process uses thread-local variables. Is this not permitted? If not, is there another way I could pass some external context into the resolve process?
请先登录再写评论。
Indeed this is not permitted, see https://www.jetbrains.org/intellij/sdk/docs/reference_guide/api_notable/api_notable_list_2020.html "
ResolveCacheusingIdempotenceCheckerin tests". Linked javadoc has some more information https://upsource.jetbrains.com/idea-ce/file/idea-ce-e2d423f42b53eafd5c625b93149a0ebc7e49756c/platform/core-impl/src/com/intellij/util/IdempotenceChecker.java