diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java index 0fd243f7358..f802e8d3341 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java @@ -1,17 +1,6 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.psi; @@ -70,15 +59,7 @@ public class KtElementImplStub> extends StubBasedPsiEle PsiFile file = getContainingFile(); if (!(file instanceof KtFile)) { // KtElementImpl.copy() might be the reason for this exception - String fileString = ""; - if (file.isValid()) { - try { - fileString = " " + file.getText(); - } - catch (Exception e) { - // ignore when failed to get file text - } - } + String fileString = file.isValid() ? (" " + file.getText()) : ""; // getNode() will fail if getContainingFile() returns not PsiFileImpl instance String nodeString = (file instanceof PsiFileImpl ? (" node = " + getNode()) : ""); @@ -126,7 +107,7 @@ public class KtElementImplStub> extends StubBasedPsiEle } @NotNull - protected , StubT extends StubElement> List getStubOrPsiChildrenAsList( + protected , StubT extends StubElement> List getStubOrPsiChildrenAsList( @NotNull KtStubElementType elementType ) { return Arrays.asList(getStubOrPsiChildren(elementType, elementType.getArrayFactory())); diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java.203 b/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java.202 similarity index 80% rename from compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java.203 rename to compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java.202 index f802e8d3341..0fd243f7358 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java.203 +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java.202 @@ -1,6 +1,17 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.jetbrains.kotlin.psi; @@ -59,7 +70,15 @@ public class KtElementImplStub> extends StubBasedPsiEle PsiFile file = getContainingFile(); if (!(file instanceof KtFile)) { // KtElementImpl.copy() might be the reason for this exception - String fileString = file.isValid() ? (" " + file.getText()) : ""; + String fileString = ""; + if (file.isValid()) { + try { + fileString = " " + file.getText(); + } + catch (Exception e) { + // ignore when failed to get file text + } + } // getNode() will fail if getContainingFile() returns not PsiFileImpl instance String nodeString = (file instanceof PsiFileImpl ? (" node = " + getNode()) : ""); @@ -107,7 +126,7 @@ public class KtElementImplStub> extends StubBasedPsiEle } @NotNull - protected , StubT extends StubElement> List getStubOrPsiChildrenAsList( + protected , StubT extends StubElement> List getStubOrPsiChildrenAsList( @NotNull KtStubElementType elementType ) { return Arrays.asList(getStubOrPsiChildren(elementType, elementType.getArrayFactory())); diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationUseSiteTargetElementType.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationUseSiteTargetElementType.kt index 76725de1152..49c92c5370c 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationUseSiteTargetElementType.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationUseSiteTargetElementType.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.psi.stubs.elements @@ -30,7 +19,7 @@ class KtAnnotationUseSiteTargetElementType(debugName: String) : debugName, KtAnnotationUseSiteTarget::class.java, KotlinAnnotationUseSiteTargetStub::class.java ) { - override fun createStub(psi: KtAnnotationUseSiteTarget, parentStub: StubElement): KotlinAnnotationUseSiteTargetStub { + override fun createStub(psi: KtAnnotationUseSiteTarget, parentStub: StubElement): KotlinAnnotationUseSiteTargetStub { val useSiteTarget = psi.getAnnotationUseSiteTarget().name return KotlinAnnotationUseSiteTargetStubImpl(parentStub, StringRef.fromString(useSiteTarget)!!) } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationUseSiteTargetElementType.kt.203 b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationUseSiteTargetElementType.kt.202 similarity index 68% rename from compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationUseSiteTargetElementType.kt.203 rename to compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationUseSiteTargetElementType.kt.202 index 49c92c5370c..76725de1152 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationUseSiteTargetElementType.kt.203 +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtAnnotationUseSiteTargetElementType.kt.202 @@ -1,6 +1,17 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.jetbrains.kotlin.psi.stubs.elements @@ -19,7 +30,7 @@ class KtAnnotationUseSiteTargetElementType(debugName: String) : debugName, KtAnnotationUseSiteTarget::class.java, KotlinAnnotationUseSiteTargetStub::class.java ) { - override fun createStub(psi: KtAnnotationUseSiteTarget, parentStub: StubElement): KotlinAnnotationUseSiteTargetStub { + override fun createStub(psi: KtAnnotationUseSiteTarget, parentStub: StubElement): KotlinAnnotationUseSiteTargetStub { val useSiteTarget = psi.getAnnotationUseSiteTarget().name return KotlinAnnotationUseSiteTargetStubImpl(parentStub, StringRef.fromString(useSiteTarget)!!) } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtContractEffectElementType.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtContractEffectElementType.kt index b5c86d289ca..4f038d83149 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtContractEffectElementType.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtContractEffectElementType.kt @@ -22,7 +22,7 @@ class KtContractEffectElementType(debugName: String, psiClass: Class?): KotlinContractEffectStub { + override fun createStub(psi: KtContractEffect, parentStub: StubElement<*>?): KotlinContractEffectStub { return KotlinContractEffectStubImpl(parentStub, this) } -} \ No newline at end of file +} diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtContractEffectElementType.kt.203 b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtContractEffectElementType.kt.202 similarity index 95% rename from compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtContractEffectElementType.kt.203 rename to compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtContractEffectElementType.kt.202 index cb9124601ae..b5c86d289ca 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtContractEffectElementType.kt.203 +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtContractEffectElementType.kt.202 @@ -22,7 +22,7 @@ class KtContractEffectElementType(debugName: String, psiClass: Class?): KotlinContractEffectStub { + override fun createStub(psi: KtContractEffect, parentStub: StubElement?): KotlinContractEffectStub { return KotlinContractEffectStubImpl(parentStub, this) } } \ No newline at end of file diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt index 31899b9e2cf..6cd05a3097b 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.psi.stubs.elements @@ -27,7 +16,7 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinImportAliasStubImpl class KtImportAliasElementType(debugName: String) : KtStubElementType(debugName, KtImportAlias::class.java, KotlinImportAliasStub::class.java) { - override fun createStub(psi: KtImportAlias, parentStub: StubElement?): KotlinImportAliasStub { + override fun createStub(psi: KtImportAlias, parentStub: StubElement?): KotlinImportAliasStub { return KotlinImportAliasStubImpl(parentStub, StringRef.fromString(psi.name)) } @@ -39,4 +28,4 @@ class KtImportAliasElementType(debugName: String) : val name = dataStream.readName() return KotlinImportAliasStubImpl(parentStub, name) } -} \ No newline at end of file +} diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt.203 b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt.202 similarity index 64% rename from compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt.203 rename to compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt.202 index 5c363038ff3..31899b9e2cf 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt.203 +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtImportAliasElementType.kt.202 @@ -1,6 +1,17 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.jetbrains.kotlin.psi.stubs.elements @@ -16,7 +27,7 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinImportAliasStubImpl class KtImportAliasElementType(debugName: String) : KtStubElementType(debugName, KtImportAlias::class.java, KotlinImportAliasStub::class.java) { - override fun createStub(psi: KtImportAlias, parentStub: StubElement?): KotlinImportAliasStub { + override fun createStub(psi: KtImportAlias, parentStub: StubElement?): KotlinImportAliasStub { return KotlinImportAliasStubImpl(parentStub, StringRef.fromString(psi.name)) } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtModifierListElementType.java b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtModifierListElementType.java index 575d6b25595..321d238340a 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtModifierListElementType.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtModifierListElementType.java @@ -1,17 +1,6 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.psi.stubs.elements; @@ -36,7 +25,7 @@ public class KtModifierListElementType extends KtStubE } @Override - public KotlinModifierListStub createStub(@NotNull T psi, StubElement parentStub) { + public KotlinModifierListStub createStub(@NotNull T psi, StubElement parentStub) { return new KotlinModifierListStubImpl(parentStub, computeMaskFromModifierList(psi), this); } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtModifierListElementType.java.203 b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtModifierListElementType.java.202 similarity index 73% rename from compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtModifierListElementType.java.203 rename to compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtModifierListElementType.java.202 index 321d238340a..575d6b25595 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtModifierListElementType.java.203 +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtModifierListElementType.java.202 @@ -1,6 +1,17 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.jetbrains.kotlin.psi.stubs.elements; @@ -25,7 +36,7 @@ public class KtModifierListElementType extends KtStubE } @Override - public KotlinModifierListStub createStub(@NotNull T psi, StubElement parentStub) { + public KotlinModifierListStub createStub(@NotNull T psi, StubElement parentStub) { return new KotlinModifierListStubImpl(parentStub, computeMaskFromModifierList(psi), this); } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtPlaceHolderStubElementType.java b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtPlaceHolderStubElementType.java index 386b010d8d8..3abeed91ec9 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtPlaceHolderStubElementType.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtPlaceHolderStubElementType.java @@ -1,17 +1,6 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.psi.stubs.elements; @@ -34,7 +23,7 @@ public class KtPlaceHolderStubElementType createStub(@NotNull T psi, StubElement parentStub) { + public KotlinPlaceHolderStub createStub(@NotNull T psi, StubElement parentStub) { return new KotlinPlaceHolderStubImpl<>(parentStub, this); } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtPlaceHolderStubElementType.java.203 b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtPlaceHolderStubElementType.java.202 similarity index 70% rename from compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtPlaceHolderStubElementType.java.203 rename to compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtPlaceHolderStubElementType.java.202 index 3abeed91ec9..386b010d8d8 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtPlaceHolderStubElementType.java.203 +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtPlaceHolderStubElementType.java.202 @@ -1,6 +1,17 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.jetbrains.kotlin.psi.stubs.elements; @@ -23,7 +34,7 @@ public class KtPlaceHolderStubElementType createStub(@NotNull T psi, StubElement parentStub) { + public KotlinPlaceHolderStub createStub(@NotNull T psi, StubElement parentStub) { return new KotlinPlaceHolderStubImpl<>(parentStub, this); } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtScriptElementType.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtScriptElementType.kt index 7b772301258..15c241ddfcd 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtScriptElementType.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtScriptElementType.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.psi.stubs.elements @@ -30,7 +19,7 @@ class KtScriptElementType(debugName: String) : KtStubElementType): KotlinScriptStub { + override fun createStub(psi: KtScript, parentStub: StubElement): KotlinScriptStub { return KotlinScriptStubImpl(parentStub, StringRef.fromString(psi.fqName.asString())) } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtScriptElementType.kt.203 b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtScriptElementType.kt.202 similarity index 67% rename from compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtScriptElementType.kt.203 rename to compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtScriptElementType.kt.202 index 15c241ddfcd..7b772301258 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtScriptElementType.kt.203 +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtScriptElementType.kt.202 @@ -1,6 +1,17 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.jetbrains.kotlin.psi.stubs.elements @@ -19,7 +30,7 @@ class KtScriptElementType(debugName: String) : KtStubElementType): KotlinScriptStub { + override fun createStub(psi: KtScript, parentStub: StubElement): KotlinScriptStub { return KotlinScriptStubImpl(parentStub, StringRef.fromString(psi.fqName.asString())) } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementType.java b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementType.java index 0a004de458c..a67feb9aa5f 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementType.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementType.java @@ -1,17 +1,6 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.psi.stubs.elements; @@ -36,7 +25,7 @@ import org.jetbrains.kotlin.psi.KtProperty; import java.lang.reflect.Array; import java.lang.reflect.Constructor; -public abstract class KtStubElementType> extends IStubElementType { +public abstract class KtStubElementType, PsiT extends KtElementImplStub> extends IStubElementType { @NotNull private final Constructor byNodeConstructor; diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementType.java.203 b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementType.java.202 similarity index 83% rename from compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementType.java.203 rename to compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementType.java.202 index a67feb9aa5f..0a004de458c 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementType.java.203 +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementType.java.202 @@ -1,6 +1,17 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.jetbrains.kotlin.psi.stubs.elements; @@ -25,7 +36,7 @@ import org.jetbrains.kotlin.psi.KtProperty; import java.lang.reflect.Array; import java.lang.reflect.Constructor; -public abstract class KtStubElementType, PsiT extends KtElementImplStub> extends IStubElementType { +public abstract class KtStubElementType> extends IStubElementType { @NotNull private final Constructor byNodeConstructor; diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentElementType.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentElementType.kt index 796a181bd2e..6bc4529f4b8 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentElementType.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentElementType.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -16,7 +16,7 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinValueArgumentStubImpl class KtValueArgumentElementType(debugName: String, psiClass: Class) : KtStubElementType, T>(debugName, psiClass, KotlinValueArgumentStub::class.java) { - override fun createStub(psi: T, parentStub: StubElement?): KotlinValueArgumentStub { + override fun createStub(psi: T, parentStub: StubElement?): KotlinValueArgumentStub { return KotlinValueArgumentStubImpl(parentStub, this, psi.isSpread) } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentElementType.kt.203 b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentElementType.kt.202 similarity index 87% rename from compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentElementType.kt.203 rename to compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentElementType.kt.202 index 6bc4529f4b8..796a181bd2e 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentElementType.kt.203 +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtValueArgumentElementType.kt.202 @@ -1,5 +1,5 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -16,7 +16,7 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinValueArgumentStubImpl class KtValueArgumentElementType(debugName: String, psiClass: Class) : KtStubElementType, T>(debugName, psiClass, KotlinValueArgumentStub::class.java) { - override fun createStub(psi: T, parentStub: StubElement?): KotlinValueArgumentStub { + override fun createStub(psi: T, parentStub: StubElement?): KotlinValueArgumentStub { return KotlinValueArgumentStubImpl(parentStub, this, psi.isSpread) } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt index 637350f81c6..10c5c49bc57 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.psi.stubs.impl @@ -24,7 +13,7 @@ import org.jetbrains.kotlin.psi.stubs.KotlinImportAliasStub import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes class KotlinImportAliasStubImpl( - parent: StubElement?, + parent: StubElement?, private val name: StringRef? ) : KotlinStubBaseImpl(parent, KtStubElementTypes.IMPORT_ALIAS), KotlinImportAliasStub { override fun getName(): String? = StringRef.toString(name) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt.202 b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt.202 new file mode 100644 index 00000000000..637350f81c6 --- /dev/null +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt.202 @@ -0,0 +1,31 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.psi.stubs.impl + +import com.intellij.psi.PsiElement +import com.intellij.psi.stubs.StubElement +import com.intellij.util.io.StringRef +import org.jetbrains.kotlin.psi.KtImportAlias +import org.jetbrains.kotlin.psi.stubs.KotlinImportAliasStub +import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes + +class KotlinImportAliasStubImpl( + parent: StubElement?, + private val name: StringRef? +) : KotlinStubBaseImpl(parent, KtStubElementTypes.IMPORT_ALIAS), KotlinImportAliasStub { + override fun getName(): String? = StringRef.toString(name) +} diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt.203 b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt.203 deleted file mode 100644 index 10c5c49bc57..00000000000 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/impl/KotlinImportAliasStubImpl.kt.203 +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.psi.stubs.impl - -import com.intellij.psi.PsiElement -import com.intellij.psi.stubs.StubElement -import com.intellij.util.io.StringRef -import org.jetbrains.kotlin.psi.KtImportAlias -import org.jetbrains.kotlin.psi.stubs.KotlinImportAliasStub -import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes - -class KotlinImportAliasStubImpl( - parent: StubElement?, - private val name: StringRef? -) : KotlinStubBaseImpl(parent, KtStubElementTypes.IMPORT_ALIAS), KotlinImportAliasStub { - override fun getName(): String? = StringRef.toString(name) -} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java index 3362f53e07e..657ee289ec8 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java @@ -1,17 +1,6 @@ /* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.test.testFramework; @@ -19,14 +8,15 @@ package org.jetbrains.kotlin.test.testFramework; import com.intellij.codeInsight.CodeInsightSettings; import com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory; import com.intellij.diagnostic.PerformanceWatcher; -import com.intellij.ide.highlighter.JavaFileType; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.application.impl.ApplicationInfoImpl; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.util.io.FileUtil; @@ -319,7 +309,7 @@ public abstract class KtUsefulTestCase extends TestCase { } }) .append(() -> { - currentCodeStyleSettings.getIndentOptions(JavaFileType.INSTANCE); + currentCodeStyleSettings.getIndentOptions(StdFileTypes.JAVA); try { checkCodeStyleSettingsEqual(oldCodeStyleSettings, currentCodeStyleSettings); } @@ -869,7 +859,7 @@ public abstract class KtUsefulTestCase extends TestCase { } String expected = StringUtil.convertLineSeparators(trimBeforeComparing ? fileText.trim() : fileText); String actual = StringUtil.convertLineSeparators(trimBeforeComparing ? actualText.trim() : actualText); - if (!Objects.equals(expected, actual)) { + if (!Comparing.equal(expected, actual)) { throw new FileComparisonFailure(messageProducer == null ? null : messageProducer.get(), expected, actual, filePath); } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.203 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.202 similarity index 98% rename from compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.203 rename to compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.202 index 4d51c3383b7..197fa6919fb 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.203 +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.202 @@ -1,6 +1,17 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.jetbrains.kotlin.test.testFramework; @@ -8,15 +19,14 @@ package org.jetbrains.kotlin.test.testFramework; import com.intellij.codeInsight.CodeInsightSettings; import com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory; import com.intellij.diagnostic.PerformanceWatcher; +import com.intellij.ide.highlighter.JavaFileType; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.application.impl.ApplicationInfoImpl; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.util.JDOMUtil; @@ -337,7 +347,7 @@ public abstract class KtUsefulTestCase extends TestCase { } }) .append(() -> { - currentCodeStyleSettings.getIndentOptions(StdFileTypes.JAVA); + currentCodeStyleSettings.getIndentOptions(JavaFileType.INSTANCE); try { checkCodeStyleSettingsEqual(oldCodeStyleSettings, currentCodeStyleSettings); } @@ -491,7 +501,7 @@ public abstract class KtUsefulTestCase extends TestCase { /** * If you want a more shorter name than runInEdtAndWait. */ - protected void edt(@NotNull ThrowableRunnable runnable) throws Throwable { + protected void edt(@NotNull ThrowableRunnable runnable) { EdtTestUtil.runInEdtAndWait(runnable); } @@ -901,7 +911,7 @@ public abstract class KtUsefulTestCase extends TestCase { } String expected = StringUtil.convertLineSeparators(trimBeforeComparing ? fileText.trim() : fileText); String actual = StringUtil.convertLineSeparators(trimBeforeComparing ? actualText.trim() : actualText); - if (!Comparing.equal(expected, actual)) { + if (!Objects.equals(expected, actual)) { throw new FileComparisonFailure(messageProducer == null ? null : messageProducer.get(), expected, actual, filePath); } } @@ -1134,7 +1144,7 @@ public abstract class KtUsefulTestCase extends TestCase { return UIUtil.invokeAndWaitIfNeeded(() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file)); } - public static void waitForAppLeakingThreads(long timeout, @NotNull TimeUnit timeUnit) throws Exception { + public static void waitForAppLeakingThreads(long timeout, @NotNull TimeUnit timeUnit) { EdtTestUtil.runInEdtAndWait(() -> { Application app = ApplicationManager.getApplication(); if (app != null && !app.isDisposed()) { diff --git a/gradle/versions.properties b/gradle/versions.properties index c1a988bbb35..293fd4c5717 100644 --- a/gradle/versions.properties +++ b/gradle/versions.properties @@ -1,9 +1,9 @@ -versions.intellijSdk=202.7660.26 +versions.intellijSdk=203.6682.168 versions.intellijSdk.forIde.202=202.7660.26 versions.intellijSdk.forIde.203=203.6682.168 versions.intellijSdk.forIde.211=211.7442.40 versions.idea.NodeJS=193.6494.7 -versions.jar.asm-all=8.0.1 +versions.jar.asm-all=9.0 versions.jar.guava=29.0-jre versions.jar.groovy=2.5.11 versions.jar.groovy-xml=2.5.11 diff --git a/gradle/versions.properties.203 b/gradle/versions.properties.202 similarity index 72% rename from gradle/versions.properties.203 rename to gradle/versions.properties.202 index 732e2a421da..c1a988bbb35 100644 --- a/gradle/versions.properties.203 +++ b/gradle/versions.properties.202 @@ -1,6 +1,9 @@ -versions.intellijSdk=203.6682.168 +versions.intellijSdk=202.7660.26 +versions.intellijSdk.forIde.202=202.7660.26 +versions.intellijSdk.forIde.203=203.6682.168 +versions.intellijSdk.forIde.211=211.7442.40 versions.idea.NodeJS=193.6494.7 -versions.jar.asm-all=9.0 +versions.jar.asm-all=8.0.1 versions.jar.guava=29.0-jre versions.jar.groovy=2.5.11 versions.jar.groovy-xml=2.5.11