guix-more/kotlin-Update-for-dependencies.patch

kotlin-Update-for-dependencies.patch

1
From 0a2f04444a7cf9e23c8d54ca06f56975e04682d4 Mon Sep 17 00:00:00 2001
2
From: LEPILLER Julien <julien.lepiller@irisa.fr>
3
Date: Wed, 15 May 2019 13:21:32 +0200
4
Subject: [PATCH] Update for newer dependencies.
5
6
---
7
 build.xml                                     | 181 ++++--------------
8
 .../cli/jvm/compiler/JetCoreEnvironment.java  |  24 ++-
9
 .../resolve/lazy/IdentitySmartPointer.java    |   5 +
10
 .../JetCodeBlockModificationListener.java     |   2 +-
11
 .../asJava/KotlinJavaFileStubProvider.java    |   5 +-
12
 ...otlinLightClassForExplicitDeclaration.java |   2 +-
13
 .../jet/asJava/StubClassBuilder.java          |   4 +-
14
 .../java/util/concurrent/annotations.xml      |  10 -
15
 8 files changed, 71 insertions(+), 162 deletions(-)
16
17
diff --git a/build.xml b/build.xml
18
index b71942d..1d5f46b 100644
19
--- a/build.xml
20
+++ b/build.xml
21
@@ -108,52 +108,46 @@
22
     </target>
23
 
24
     <target name="compilerSources">
25
-        <if>
26
-            <istrue value="${generate.javadoc}"/>
27
+        <jar jarfile="${output}/kotlin-compiler-sources.jar">
28
+            <!-- TODO How to convert it from pathset or dirset ? -->
29
+            <fileset dir="compiler/frontend/src"/>
30
+            <fileset dir="compiler/frontend.java/src"/>
31
+            <fileset dir="compiler/backend/src"/>
32
+            <fileset dir="compiler/cli/src"/>
33
+            <fileset dir="j2k/src"/>
34
+            <fileset dir="compiler/util/src"/>
35
+            <fileset dir="compiler/jet.as.java.psi/src"/>
36
+            <fileset dir="runtime/src"/>
37
+            <fileset dir="js/js.translator/src"/>
38
+            <zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
39
 
40
-            <then>
41
-                <jar jarfile="${output}/kotlin-compiler-sources.jar">
42
-                    <!-- TODO How to convert it from pathset or dirset ? -->
43
-                    <fileset dir="compiler/frontend/src"/>
44
-                    <fileset dir="compiler/frontend.java/src"/>
45
-                    <fileset dir="compiler/backend/src"/>
46
-                    <fileset dir="compiler/cli/src"/>
47
-                    <fileset dir="j2k/src"/>
48
-                    <fileset dir="compiler/util/src"/>
49
-                    <fileset dir="compiler/jet.as.java.psi/src"/>
50
-                    <fileset dir="runtime/src"/>
51
-                    <fileset dir="js/js.translator/src"/>
52
-                    <zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
53
+            <manifest>
54
+                <attribute name="Built-By" value="JetBrains"/>
55
 
56
-                    <manifest>
57
-                        <attribute name="Built-By" value="JetBrains"/>
58
+                <attribute name="Implementation-Vendor" value="JetBrains"/>
59
+                <attribute name="Implementation-Title" value="Kotlin Compiler Sources"/>
60
+                <attribute name="Implementation-Version" value="${build.number}"/>
61
+            </manifest>
62
+        </jar>
63
 
64
-                        <attribute name="Implementation-Vendor" value="JetBrains"/>
65
-                        <attribute name="Implementation-Title" value="Kotlin Compiler Sources"/>
66
-                        <attribute name="Implementation-Version" value="${build.number}"/>
67
-                    </manifest>
68
-                </jar>
69
+        <delete dir="${output}/kotlin-compiler-javadoc" failonerror="false" />
70
+        <javadoc destdir="${output}/kotlin-compiler-javadoc"
71
+                 sourcepathref="compilerSources.path"
72
+                 classpathref="classpath"
73
+                 linksource="yes"
74
+                 windowtitle="Kotlin Compiler"/>
75
+        <jar jarfile="${output}/kotlin-compiler-javadoc.jar">
76
+            <fileset dir="${output}/kotlin-compiler-javadoc"/>
77
+            <zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
78
 
79
-                <delete dir="${output}/kotlin-compiler-javadoc" failonerror="false" />
80
-                <javadoc destdir="${output}/kotlin-compiler-javadoc"
81
-                         sourcepathref="compilerSources.path"
82
-                         classpathref="classpath"
83
-                         linksource="yes"
84
-                         windowtitle="Kotlin Compiler"/>
85
-                <jar jarfile="${output}/kotlin-compiler-javadoc.jar">
86
-                    <fileset dir="${output}/kotlin-compiler-javadoc"/>
87
-                    <zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
88
+            <manifest>
89
+                <attribute name="Built-By" value="JetBrains"/>
90
 
91
-                    <manifest>
92
-                        <attribute name="Built-By" value="JetBrains"/>
93
-
94
-                        <attribute name="Implementation-Vendor" value="JetBrains"/>
95
-                        <attribute name="Implementation-Title" value="Kotlin Compiler Javadoc"/>
96
-                        <attribute name="Implementation-Version" value="${build.number}"/>
97
-                    </manifest>
98
-                </jar>
99
-            </then>
100
-        </if>
101
+                <attribute name="Implementation-Vendor" value="JetBrains"/>
102
+                <attribute name="Implementation-Title" value="Kotlin Compiler Javadoc"/>
103
+                <attribute name="Implementation-Version" value="${build.number}"/>
104
+            </manifest>
105
+        </jar>
106
     </target>
107
 
108
   <target name="jslib">
109
@@ -278,109 +272,8 @@
110
 
111
         <delete file="${kotlin-home}/lib/kotlin-compiler.jar" failonerror="false"/>
112
 
113
-        <if>
114
-            <isfalse value="${shrink}"/>
115
-
116
-            <then>
117
-                <copy file="${output}/kotlin-compiler-jarjar.jar"
118
-                      tofile="${kotlin-home}/lib/kotlin-compiler.jar"/>
119
-            </then>
120
-
121
-            <else>
122
-                <cleandir dir="${output}/kotlin-compiler.exploded"/>
123
-                <unzip src="${output}/kotlin-compiler-jarjar.jar" dest="${output}/kotlin-compiler.exploded"/>
124
-
125
-                <!-- Clean JarJar result -->
126
-                <jar jarfile="${output}/kotlin-compiler-before-proguard.jar"
127
-                     manifest="${output}/kotlin-compiler.exploded/META-INF/MANIFEST.MF">
128
-
129
-                    <fileset dir="${output}/kotlin-compiler.exploded">
130
-                        <include name="**/*.class"/>
131
-                        <include name="**/*.properties"/>
132
-                        <include name="**/*.jet"/>
133
-                        <include name="**/*.kt"/>
134
-                        <include name="META-INF/services/**"/>
135
-                        <include name="META-INF/native/**"/>
136
-                        <include name="messages/**"/>
137
-                    </fileset>
138
-                    <zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
139
-                </jar>
140
-                <delete dir="${output}/kotlin-compiler.exploded"/>
141
-
142
-                <available property="rtjar" value="${java.home}/lib/rt.jar" file="${java.home}/lib/rt.jar"/>
143
-                <available property="rtjar" value="${java.home}/../Classes/classes.jar" file="${java.home}/../Classes/classes.jar"/>
144
-
145
-                <proguard><![CDATA[
146
-                    -injars '${output}/kotlin-compiler-before-proguard.jar'
147
-                    -outjars '${kotlin-home}/lib/kotlin-compiler.jar'
148
-
149
-                    -dontwarn org.jetbrains.jet.internal.com.intellij.util.**
150
-                    -dontwarn org.jetbrains.jet.internal.com.intellij.codeInsight.**
151
-                    -dontwarn org.jetbrains.jet.internal.com.thoughtworks.xstream.**
152
-                    -dontwarn org.fusesource.**
153
-
154
-                    -libraryjars '${rtjar}'
155
-
156
-                    -target 1.6
157
-                    -dontoptimize
158
-                    -dontobfuscate
159
-
160
-                    -keep class org.fusesource.** { *; }
161
-
162
-                    -keepclasseswithmembers public class * {
163
-                        public static void main(java.lang.String[]);
164
-                    }
165
-
166
-                    -keep class org.jetbrains.annotations.** {
167
-                        public protected *;
168
-                    }
169
-
170
-                    -keep class org.jetbrains.k2js.** {
171
-                        public protected *;
172
-                    }
173
-
174
-                    -keep class org.jetbrains.jet.** {
175
-                        public protected *;
176
-                    }
177
-
178
-                    -keep class jet.** {
179
-                        public protected *;
180
-                    }
181
-
182
-                    -keepclasseswithmembers class * { void start(); }
183
-
184
-                    -keepclasseswithmembers class * { void stop(); }
185
-                    -keepclasseswithmembers class * { void dispose(); }
186
-
187
-                    -keepclasseswithmembers class * { ** getFileSystem(); }
188
-                    -keepclasseswithmembers class * { ** isVarArgs(); }
189
-                    -keepclasseswithmembers class * { ** getApplication(); }
190
-                    -keepclasseswithmembers class * { ** finalizeReferent(); }
191
-                    -keepclasseswithmembers class * { ** newBuilder(); }
192
-                    -keepclasseswithmembers class * { ** startFinalizer(java.lang.Class,java.lang.Object); }
193
-                    -keepclasseswithmembers class * { ** executeOnPooledThread(java.lang.Runnable); }
194
-                    -keepclasseswithmembers class * { ** getUserData(java.lang.String); }
195
-                    -keepclasseswithmembers class * { int getBooleanAttributes(java.io.File); }
196
-
197
-                    -keepclasseswithmembers class * { ** project(); }
198
-
199
-                    -keepclasseswithmembers class * { ** TYPE; }
200
-                    -keepclasseswithmembers class * { ** ourInstance; }
201
-
202
-                    -keepclasseswithmembers class * { <init>(kotlinc.internal.com.intellij.lang.ASTNode); }
203
-
204
-                    -keepclassmembers enum * {
205
-                        public static **[] values();
206
-                        public static ** valueOf(java.lang.String);
207
-                    }
208
-
209
-                    -keepclassmembers class * {
210
-                        ** toString();
211
-                        ** hashCode();
212
-                    }
213
-                ]]></proguard>
214
-            </else>
215
-        </if>
216
+        <copy file="${output}/kotlin-compiler-jarjar.jar"
217
+            tofile="${kotlin-home}/lib/kotlin-compiler.jar" />
218
     </target>
219
 
220
     <target name="antTools">
221
diff --git a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
222
index 880a288..c786c7b 100644
223
--- a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
224
+++ b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
225
@@ -16,6 +16,12 @@
226
 
227
 package org.jetbrains.jet.cli.jvm.compiler;
228
 
229
+import com.intellij.openapi.fileTypes.PlainTextFileType;
230
+import com.intellij.psi.augment.PsiAugmentProvider;
231
+import com.intellij.psi.compiled.ClassFileDecompilers;
232
+import com.intellij.codeInsight.ContainerProvider;
233
+import com.intellij.lang.jvm.facade.JvmElementProvider;
234
+import com.intellij.psi.PsiElementFinder;
235
 import com.intellij.codeInsight.ExternalAnnotationsManager;
236
 import com.intellij.core.CoreApplicationEnvironment;
237
 import com.intellij.core.CoreJavaFileManager;
238
@@ -72,7 +78,15 @@ public class JetCoreEnvironment {
239
         this.configuration = configuration.copy();
240
         this.configuration.setReadOnly(true);
241
 
242
+        CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ContainerProvider.EP_NAME,
243
+                                                          ContainerProvider.class);
244
+        CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClassFileDecompilers.EP_NAME,
245
+                                                          ClassFileDecompilers.Decompiler.class);
246
+        CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), PsiAugmentProvider.EP_NAME,
247
+                                                          PsiAugmentProvider.class);
248
+
249
         this.applicationEnvironment = new JavaCoreApplicationEnvironment(parentDisposable);
250
+        applicationEnvironment.registerFileType(PlainTextFileType.INSTANCE, "xml");
251
         applicationEnvironment.registerFileType(JetFileType.INSTANCE, "kt");
252
         applicationEnvironment.registerFileType(JetFileType.INSTANCE, "kts");
253
         applicationEnvironment.registerFileType(JetFileType.INSTANCE, "ktm");
254
@@ -81,7 +95,15 @@ public class JetCoreEnvironment {
255
         applicationEnvironment.registerParserDefinition(new JavaParserDefinition());
256
         applicationEnvironment.registerParserDefinition(new JetParserDefinition());
257
 
258
-        projectEnvironment = new JavaCoreProjectEnvironment(parentDisposable, applicationEnvironment);
259
+        projectEnvironment = new JavaCoreProjectEnvironment(parentDisposable, applicationEnvironment) {
260
+            @Override
261
+            protected void preregisterServices() {
262
+                CoreApplicationEnvironment.registerExtensionPoint(Extensions.getArea(myProject),
263
+                        JvmElementProvider.EP_NAME, JvmElementProvider.class);
264
+                CoreApplicationEnvironment.registerExtensionPoint(Extensions.getArea(myProject),
265
+                        PsiElementFinder.EP_NAME, PsiElementFinder.class);
266
+            }
267
+        };
268
 
269
         MockProject project = projectEnvironment.getProject();
270
         project.registerService(JetScriptDefinitionProvider.class, new JetScriptDefinitionProvider());
271
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/IdentitySmartPointer.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/IdentitySmartPointer.java
272
index dca7927..e5310b3 100644
273
--- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/IdentitySmartPointer.java
274
+++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/IdentitySmartPointer.java
275
@@ -56,4 +56,9 @@ public class IdentitySmartPointer<E extends PsiElement> implements SmartPsiEleme
276
     public Segment getRange() {
277
         return element.getTextRange();
278
     }
279
+
280
+    @Override
281
+    public Segment getPsiRange() {
282
+        return element.getTextRange();
283
+    }
284
 }
285
diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetCodeBlockModificationListener.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetCodeBlockModificationListener.java
286
index 863ebfd..1d99aaa 100644
287
--- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetCodeBlockModificationListener.java
288
+++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetCodeBlockModificationListener.java
289
@@ -55,7 +55,7 @@ public class JetCodeBlockModificationListener implements PsiTreeChangePreprocess
290
 
291
             case CHILDREN_CHANGED:
292
                 // general childrenChanged() event after each change
293
-                if (!event.isGenericChildrenChange()) {
294
+                if (!event.isGenericChange()) {
295
                     processChange(event.getParent(), event.getParent(), null);
296
                 }
297
                 break;
298
diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinJavaFileStubProvider.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinJavaFileStubProvider.java
299
index 73ef03d..1b80776 100644
300
--- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinJavaFileStubProvider.java
301
+++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinJavaFileStubProvider.java
302
@@ -167,7 +167,7 @@ public class KotlinJavaFileStubProvider implements CachedValueProvider<PsiJavaFi
303
         javaFileStub.setPsiFactory(new ClsWrapperStubPsiFactory());
304
 
305
         ClsFileImpl fakeFile =
306
-                new ClsFileImpl((PsiManagerImpl) manager, new ClassFileViewProvider(manager, virtualFile)) {
307
+                new ClsFileImpl(new ClassFileViewProvider(manager, virtualFile)) {
308
                     @NotNull
309
                     @Override
310
                     public PsiClassHolderFileStub getStub() {
311
@@ -181,7 +181,6 @@ public class KotlinJavaFileStubProvider implements CachedValueProvider<PsiJavaFi
312
                     }
313
                 };
314
 
315
-        fakeFile.setPhysical(false);
316
         javaFileStub.setPsi(fakeFile);
317
         return javaFileStub;
318
     }
319
@@ -243,4 +242,4 @@ public class KotlinJavaFileStubProvider implements CachedValueProvider<PsiJavaFi
320
             }
321
         }
322
     }
323
-}
324
\ No newline at end of file
325
+}
326
diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForExplicitDeclaration.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForExplicitDeclaration.java
327
index ce76c14..177a0ef 100644
328
--- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForExplicitDeclaration.java
329
+++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/KotlinLightClassForExplicitDeclaration.java
330
@@ -171,7 +171,7 @@ public class KotlinLightClassForExplicitDeclaration extends AbstractLightClass i
331
         protected PsiFile compute() {
332
             VirtualFile virtualFile = classOrObject.getContainingFile().getVirtualFile();
333
             assert virtualFile != null : "No virtual file for " + classOrObject.getText();
334
-            return new ClsFileImpl((PsiManagerImpl) getManager(), new ClassFileViewProvider(getManager(), virtualFile)) {
335
+            return new ClsFileImpl(new ClassFileViewProvider(getManager(), virtualFile)) {
336
                 @NotNull
337
                 @Override
338
                 public String getPackageName() {
339
diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/StubClassBuilder.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/StubClassBuilder.java
340
index 5bc1a79..59edee5 100644
341
--- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/StubClassBuilder.java
342
+++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/StubClassBuilder.java
343
@@ -44,7 +44,7 @@ public class StubClassBuilder extends ClassBuilder {
344
         }
345
 
346
         @Override
347
-        public ClassReader readerForInnerClass(Object o) {
348
+        public void accept(Object o, StubBuildingVisitor<Object> visitor) {
349
             throw new UnsupportedOperationException("Shall not be called!");
350
         }
351
     };
352
@@ -67,7 +67,7 @@ public class StubClassBuilder extends ClassBuilder {
353
     @Override
354
     public void defineClass(PsiElement origin, int version, int access, String name, @Nullable String signature, String superName, String[] interfaces) {
355
         assert v == null : "defineClass() called twice?";
356
-        v = new StubBuildingVisitor<Object>(null, EMPTY_STRATEGY, parent, access);
357
+        v = new StubBuildingVisitor<Object>(null, EMPTY_STRATEGY, parent, access, name);
358
 
359
         super.defineClass(origin, version, access, name, signature, superName, interfaces);
360
 
361
diff --git a/jdk-annotations/java/util/concurrent/annotations.xml b/jdk-annotations/java/util/concurrent/annotations.xml
362
index a6681b0..c47e09d 100644
363
--- a/jdk-annotations/java/util/concurrent/annotations.xml
364
+++ b/jdk-annotations/java/util/concurrent/annotations.xml
365
@@ -1,14 +1,4 @@
366
 <root>
367
-  <item name='java.util.concurrent.BlockingQueue int drainTo(java.util.Collection&lt;? super E&gt;, int)'>
368
-    <annotation name='jet.runtime.typeinfo.KotlinSignature'>
369
-      <val name="value" val="&quot;fun drainTo(c : MutableCollection<in E>, maxElements: Int) : Int&quot;"/>
370
-    </annotation>
371
-  </item>
372
-  <item name='java.util.concurrent.BlockingQueue int drainTo(java.util.Collection&lt;? super E&gt;)'>
373
-    <annotation name='jet.runtime.typeinfo.KotlinSignature'>
374
-      <val name="value" val="&quot;fun drainTo(c : MutableCollection<in E>) : Int&quot;"/>
375
-    </annotation>
376
-  </item>
377
 
378
     <item name='java.util.concurrent.ConcurrentNavigableMap java.util.concurrent.ConcurrentNavigableMap&lt;K,V&gt; headMap(K, boolean) 0'>
379
         <annotation name='org.jetbrains.annotations.NotNull'/>
380
-- 
381
2.21.0
382
383