(メッセージはありません)
@@ -144,6 +144,8 @@ | ||
144 | 144 | classLoader.getClass().getSimpleName().equals("PluginClassLoader") // IDEA 固有 |
145 | 145 | ) { |
146 | 146 | pluginLocation = classLoader.toString(); |
147 | + } else { | |
148 | + log.debug("pluginLocation is null. vmClassName:%s classLoader:%s", vmClassName, classLoader); | |
147 | 149 | } |
148 | 150 | } |
149 | 151 | else { |
@@ -42,13 +42,13 @@ | ||
42 | 42 | String className, |
43 | 43 | byte[] bytecode) |
44 | 44 | throws CannotCompileException, NotFoundException, IOException { |
45 | - | |
45 | + | |
46 | 46 | // 変換除外クラス名の場合は何もしない |
47 | 47 | ExcludeClassNameCache excludeClassCache = ExcludeClassNameCache.getInstance(); |
48 | 48 | if (excludeClassCache.contains(classId)) { |
49 | 49 | return null; |
50 | 50 | } |
51 | - | |
51 | + | |
52 | 52 | // 変換済みクラス・キャッシュがある場合はそれを返す |
53 | 53 | TransformedClassCache classCache = TransformedClassCache.getInstance(); |
54 | 54 | byte[] cachedBytecode = classCache.get(classId); |
@@ -55,26 +55,26 @@ | ||
55 | 55 | if (cachedBytecode != null) { |
56 | 56 | return cachedBytecode; |
57 | 57 | } |
58 | - | |
59 | - // 定義済みの変換除外クラス (上記 2 つのキャッシュに追加するため、以降の処理は、数回起動後はほとんど呼ばれない) | |
58 | + | |
59 | + // 定義済みの変換除外クラス (上記 2 つのキャッシュにより、以降の処理は数回起動後はほとんど呼ばれない) | |
60 | 60 | PleiadesConfig config = PleiadesConfig.getInstance(); |
61 | 61 | if (config.isExcludePackage(className)) { |
62 | 62 | excludeClassCache.add(classId); |
63 | 63 | return null; |
64 | 64 | } |
65 | - | |
65 | + | |
66 | 66 | // バイトコードに翻訳アスペクトを埋め込み |
67 | 67 | CtClass ctClass = createCtClass(bytecode); |
68 | - | |
68 | + | |
69 | 69 | try { |
70 | 70 | byte[] transformedBytecode = transformClass(ctClass); |
71 | - | |
71 | + | |
72 | 72 | // 次回起動用の情報を作成 |
73 | 73 | if (classCache.isActive()) { |
74 | - | |
74 | + | |
75 | 75 | if (transformedBytecode == null) { |
76 | 76 | if (!classCache.contains(classId)) { |
77 | - | |
77 | + | |
78 | 78 | // 変換対象外の場合は、変換除外リストに追加 |
79 | 79 | excludeClassCache.add(classId); |
80 | 80 | } |
@@ -84,9 +84,9 @@ | ||
84 | 84 | } |
85 | 85 | } |
86 | 86 | return transformedBytecode; |
87 | - | |
87 | + | |
88 | 88 | } catch (CannotCompileException e) { |
89 | - | |
89 | + | |
90 | 90 | // 関連クラス未ロードでコンパイル不可、次回変換除外 |
91 | 91 | excludeClassCache.add(classId); |
92 | 92 | throw e; |
@@ -101,20 +101,20 @@ | ||
101 | 101 | */ |
102 | 102 | protected byte[] transformClass(CtClass ctClass) |
103 | 103 | throws CannotCompileException, NotFoundException, IOException { |
104 | - | |
104 | + | |
105 | 105 | long start = System.nanoTime(); |
106 | - | |
106 | + | |
107 | 107 | // コンストラクター、メソッドの変換 |
108 | 108 | TranslationEditor editor = new TranslationEditor(ctClass); |
109 | 109 | for (CtBehavior ctBehavior : ctClass.getDeclaredBehaviors()) { |
110 | - | |
110 | + | |
111 | 111 | // コードを検査し、呼び出し部分を編集 |
112 | 112 | ctBehavior.instrument(editor); |
113 | - | |
113 | + | |
114 | 114 | // メソッドを編集 |
115 | 115 | editor.editBehavior(ctBehavior); |
116 | 116 | } |
117 | - | |
117 | + | |
118 | 118 | // スタティック・イニシャライザーの変換 |
119 | 119 | CtConstructor ctInitializer = ctClass.getClassInitializer(); |
120 | 120 | if (ctInitializer != null) { |
@@ -299,7 +299,8 @@ | ||
299 | 299 | config.getArguments().setValue(java.util.List.of( |
300 | 300 | //"wrapper", |
301 | 301 | //"--gradle-version=7.4.2", |
302 | - "--init-script=../.metadata/init.gradle")); | |
302 | + "--init-script", | |
303 | + "../.metadata/init.gradle")); | |
303 | 304 | |
304 | 305 | // 2022-03: macOS で JAVA_HOME 未指定だとエラー、Win でも 17 指定だとエラーになるため設定 (17 未対応?) |
305 | 306 | // 2022-06: toolingapi 7.x で 17 対応になったため指定しない |
@@ -317,7 +318,7 @@ | ||
317 | 318 | <pointCut editPoint="execution" timing="before"> |
318 | 319 | <!-- 作成時の Gradle 引数をプロジェクト設定に引き継がない --> |
319 | 320 | <advice><![CDATA[ |
320 | - if (((java.util.List) $0.getArguments().getValue()).contains("wrapper")) | |
321 | + if (((java.util.List) $0.getArguments().getValue()).contains("--init-script")) | |
321 | 322 | $0.setOverwriteWorkspaceSettings(false); |
322 | 323 | ]]></advice> |
323 | 324 |