Skip to content

Commit 88d5cc9

Browse files
committed
refactor(java): wrap resolveMethod in runReadAction
Ensure thread-safe access to resolveMethod by wrapping it in runReadAction. Also, update documentation to include a summary of the project's architecture and migration plan.
1 parent 3e4d517 commit 88d5cc9

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

core/src/main/resources/genius/zh/code/bridge.vm

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,19 @@ Here is an example output to the USER:
105105
//..
106106
</tool.response2>
107107
<you.answer3>
108+
// 当你获取到了足够的上下文信息后,你应该对系统的现状做一个总结,然后提供迁移方案。
109+
现在我已经了解了项目的目录结构和组件列表,您当前使用的是 xx 框架,项目的规模适中,依赖关系较为简单。如下是使用 C4 架构模型(Context-Container-Component-Code)
110+
生成的项目架构图:
111+
112+
```mermaid
113+
// xxx
114+
```
115+
</you.answer3>
116+
<you.answer4>
108117
// 根据先前的信息,你得考虑是否需要调整迁移计划。
109118
// 在手动修改代码之前,你应该考虑各种自动化工具的可能性,比如 Java 里的 OpenRewrite (直接生成 Yaml Receipt 即可),JS 里的 jscodeshift(生成 JS 代码即可)
110119
// 在获取到足够的信息后,你可以开始提供迁移方案;由于用户使用的是 IDEA,所以需要考虑相关的能力,比如修改完 build.gradle.kts 后,是否需要同步到 IDEA 中。
111-
现在我已经了解了项目的目录结构和组件列表,接下来我将为您提供迁移方案。我将先使用 Mermaid 生成迁移方案图:
120+
接下来我将为您提供迁移方案。我将先使用 Mermaid 生成迁移方案图:
112121
```mermaid
113122
//
114123
```
@@ -118,19 +127,19 @@ Here is an example output to the USER:
118127
/run:build --refresh-dependencies [注释:需要,用户先打 patch,再刷新项目依赖]
119128
</devin>
120129

121-
</you.answer3>
122-
<user.answer3>
130+
</you.answer4>
131+
<user.answer4>
123132
//xxx
124-
</user.answer3>
125-
<your.answer4>
133+
</user.answer4>
134+
<your.answer5>
126135
// ... 优先使用 DevIns 指令来修改代码和提供范例
127136
现在,我将读取 xx 文件,然后为您提供迁移示例:
128137
<devin>
129138
```patch
130139
//
131140
```
132141
</devin>
133-
</your.answer4>
142+
</your.answer5>
134143
</example>
135144
<example id="2">
136145
<user.question>

java/src/main/kotlin/cc/unitmesh/idea/util/JavaCallHelper.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ object JavaCallHelper {
2323
method.accept(object : JavaRecursiveElementVisitor() {
2424
override fun visitMethodCallExpression(expression: PsiMethodCallExpression) {
2525
super.visitMethodCallExpression(expression)
26-
calledMethods.add(expression.resolveMethod() ?: return)
26+
val resolveMethod = runReadAction { expression.resolveMethod() }
27+
calledMethods.add(resolveMethod ?: return)
2728
}
2829
})
2930

0 commit comments

Comments
 (0)