From 26864a44071f69617288a0cec06280ecf09e0fcb Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Tue, 9 Jun 2015 15:25:46 +0300 Subject: [PATCH] Get rid of annotation syntax deprecation related things --- .../jetbrains/kotlin/diagnostics/Errors.java | 1 - .../rendering/DefaultErrorMessages.java | 1 - .../jetbrains/kotlin/psi/JetAnnotation.java | 11 --- .../kotlin/resolve/AnnotationResolver.java | 14 ---- .../kotlin/resolve/DeclarationResolver.kt | 1 - .../kotlin/resolve/DeclarationsChecker.java | 2 - .../jetbrains/kotlin/resolve/TypeResolver.kt | 1 - .../BasicExpressionTypingVisitor.java | 1 - .../tests/annotations/bracketsDeprecation.kt | 45 ---------- .../tests/annotations/bracketsDeprecation.txt | 77 ----------------- .../checkers/JetDiagnosticsTestGenerated.java | 6 -- .../inspections/KotlinCleanupInspection.kt | 1 - .../quickfix/DeprecatedAnnotationSyntaxFix.kt | 82 ------------------- .../idea/quickfix/QuickFixRegistrar.java | 3 - idea/testData/inspections/cleanup/cleanup.kt | 3 - .../inspections/cleanup/cleanup.kt.after | 3 - .../migration/bracketsAnnotations/basic.kt | 5 -- .../bracketsAnnotations/basic.kt.after | 5 -- .../manyFilesMuitliple.after.Dependency.kt | 3 - .../manyFilesMuitliple.after.kt | 31 ------- .../manyFilesMuitliple.before.Dependency.kt | 3 - .../manyFilesMuitliple.before.Main.kt | 31 ------- .../QuickFixMultiFileTestGenerated.java | 15 ---- .../idea/quickfix/QuickFixTestGenerated.java | 15 ---- 24 files changed, 360 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.kt delete mode 100644 compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.txt delete mode 100644 idea/src/org/jetbrains/kotlin/idea/quickfix/DeprecatedAnnotationSyntaxFix.kt delete mode 100644 idea/testData/quickfix/migration/bracketsAnnotations/basic.kt delete mode 100644 idea/testData/quickfix/migration/bracketsAnnotations/basic.kt.after delete mode 100644 idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.after.Dependency.kt delete mode 100644 idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.after.kt delete mode 100644 idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.before.Dependency.kt delete mode 100644 idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.before.Main.kt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 0d3651d6399..90078926311 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -131,7 +131,6 @@ public interface Errors { DiagnosticFactory0 ANNOTATION_PARAMETER_MUST_BE_CLASS_LITERAL = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 ANNOTATION_PARAMETER_MUST_BE_KCLASS_LITERAL = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 ANNOTATION_PARAMETER_MUST_BE_ENUM_CONST = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 DEPRECATED_ANNOTATION_SYNTAX = DiagnosticFactory0.create(WARNING); DiagnosticFactory0 ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT = DiagnosticFactory0.create(ERROR); // Classes and traits diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 6cc5cf64a2e..3659f11337c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -609,7 +609,6 @@ public class DefaultErrorMessages { MAP.put(ANNOTATION_PARAMETER_MUST_BE_ENUM_CONST, "An enum annotation parameter must be a enum constant"); MAP.put(ANNOTATION_PARAMETER_MUST_BE_CLASS_LITERAL, "An annotation parameter must be a `javaClass()` call"); MAP.put(ANNOTATION_PARAMETER_MUST_BE_KCLASS_LITERAL, "An annotation parameter must be a class literal (T::class)"); - MAP.put(DEPRECATED_ANNOTATION_SYNTAX, "This syntax for annotations is deprecated. Use '@' before annotation identifier instead"); MAP.put(ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT, "Default value of annotation parameter must be a compile-time constant"); MAP.put(DEFAULT_VALUE_NOT_ALLOWED_IN_OVERRIDE, "An overriding function is not allowed to specify default values for its parameters"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetAnnotation.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetAnnotation.java index 0c2e11c727d..676abdbebad 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetAnnotation.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetAnnotation.java @@ -17,9 +17,7 @@ package org.jetbrains.kotlin.psi; import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.lexer.JetTokens; import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub; import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes; @@ -40,16 +38,7 @@ public class JetAnnotation extends JetElementImplStub getEntries() { return getStubOrPsiChildrenAsList(JetStubElementTypes.ANNOTATION_ENTRY); } - - public boolean hasFileKeyword() { - return findChildByType(JetTokens.FILE_KEYWORD) != null; - } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java index 6e10d89f9aa..a2e55785c3f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java @@ -62,7 +62,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.jetbrains.kotlin.diagnostics.Errors.DEPRECATED_ANNOTATION_SYNTAX; import static org.jetbrains.kotlin.diagnostics.Errors.NOT_AN_ANNOTATION_CLASS; import static org.jetbrains.kotlin.resolve.BindingContext.ANNOTATION_DESCRIPTOR_TO_PSI_ELEMENT; import static org.jetbrains.kotlin.types.TypeUtils.NO_EXPECTED_TYPE; @@ -133,7 +132,6 @@ public class AnnotationResolver { if (modifierList == null) { return Annotations.EMPTY; } - reportDeprecatedAnnotationSyntax(modifierList.getAnnotations(), trace); List annotationEntryElements = modifierList.getAnnotationEntries(); @@ -372,16 +370,4 @@ public class AnnotationResolver { trace.report(Errors.UNSUPPORTED.on(annotationEntry, "Annotations for type parameters are not supported yet")); } } - - public static void reportDeprecatedAnnotationSyntax(@NotNull List annotations, @NotNull BindingTrace trace) { - for (JetAnnotation annotation : annotations) { - reportDeprecatedAnnotationSyntax(annotation, trace); - } - } - - public static void reportDeprecatedAnnotationSyntax(@NotNull JetAnnotation annotation, @NotNull BindingTrace trace) { - if (annotation.isDeprecated()) { - trace.report(DEPRECATED_ANNOTATION_SYNTAX.on(annotation)); - } - } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationResolver.kt index 7ac418cda17..880909bc1f5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationResolver.kt @@ -53,7 +53,6 @@ public class DeclarationResolver { public fun resolveAnnotationsOnFiles(c: TopDownAnalysisContext, scopeProvider: FileScopeProvider) { val filesToScope = c.getFiles().keysToMap { scopeProvider.getFileScope(it) } for ((file, fileScope) in filesToScope) { - AnnotationResolver.reportDeprecatedAnnotationSyntax(file.getAnnotations(), _trace) _annotationResolver.resolveAnnotationsWithArguments(fileScope, file.getAnnotationEntries(), _trace) _annotationResolver.resolveAnnotationsWithArguments(fileScope, file.getDanglingAnnotations(), _trace) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java index d588ff1404c..52d9b6a8a51 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java @@ -236,7 +236,6 @@ public class DeclarationsChecker { } } private void checkObject(JetObjectDeclaration declaration, ClassDescriptor classDescriptor) { - AnnotationResolver.reportDeprecatedAnnotationSyntax(declaration.getAnnotations(), trace); reportErrorIfHasIllegalModifier(declaration); if (declaration.isLocal() && !declaration.isCompanion() && !declaration.isObjectLiteral()) { trace.report(LOCAL_OBJECT_NOT_ALLOWED.on(declaration, classDescriptor)); @@ -244,7 +243,6 @@ public class DeclarationsChecker { } private void checkClass(BodiesResolveContext c, JetClass aClass, ClassDescriptorWithResolutionScopes classDescriptor) { - AnnotationResolver.reportDeprecatedAnnotationSyntax(aClass.getAnnotations(), trace); checkOpenMembers(classDescriptor); checkTypeParameters(aClass); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt index f9b2706302e..8b2d1863b2e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt @@ -103,7 +103,6 @@ public class TypeResolver( } private fun doResolvePossiblyBareType(c: TypeResolutionContext, typeReference: JetTypeReference): PossiblyBareType { - AnnotationResolver.reportDeprecatedAnnotationSyntax(typeReference.getAnnotations(), c.trace); val annotations = annotationResolver.resolveAnnotationsWithoutArguments(c.scope, typeReference.getAnnotationEntries(), c.trace) val typeElement = typeReference.getTypeElement() diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java index ba8fb580732..0bd7542ccd8 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/BasicExpressionTypingVisitor.java @@ -1508,7 +1508,6 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { } public JetTypeInfo visitAnnotatedExpression(JetAnnotatedExpression expression, ExpressionTypingContext context, boolean isStatement) { - AnnotationResolver.reportDeprecatedAnnotationSyntax(expression.getAnnotations(), context.trace); components.annotationResolver.resolveAnnotationsWithArguments( context.scope, expression.getAnnotationEntries(), context.trace); diff --git a/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.kt b/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.kt deleted file mode 100644 index 44c9e486cea..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.kt +++ /dev/null @@ -1,45 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -[file: Ann] -@file:[Ann] -annotation class Ann(val arg: Int = 1) - -fun bar(block: () -> Int) = block() - -data class Q(val x: Int, val y: Int) - -fun bar2(): Array = null!! - -[Ann Ann] class A [Ann] constructor([Ann] val prop: Int) { - [Ann] val x = 1 - [Ann] fun foo([Ann] x: Int) { - [Ann] class B - - [Ann] fun local() {} - - 2 + [Ann Ann] 2 - - for ([Ann] (a, [Ann] b) in bar2()) {} - } - - fun x(): [Ann] String { - [Ann] val x: [Ann] String = "" - - val localVal = [Ann] object {} - - return "" - } - - [Ann] object O1 {} - [Ann] companion object O2 { - - } -} - -[Ann] object O3 {} - -val y: Array<[Ann] String?> = arrayOfNulls(1) -val block: ([Ann] x: [Ann] String) -> [Ann] String = { "" } -interface B -interface D : [Ann] B - -Ann([Ann] 1) class MyClass diff --git a/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.txt b/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.txt deleted file mode 100644 index 71449d46718..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.txt +++ /dev/null @@ -1,77 +0,0 @@ -package - -internal val block: (@[Ann()] kotlin.String) -> @[Ann()] kotlin.String -internal val y: kotlin.Array -internal fun bar(/*0*/ block: () -> kotlin.Int): kotlin.Int -internal fun bar2(): kotlin.Array - -Ann() Ann() internal final class A { - Ann() public constructor A(/*0*/ Ann() prop: kotlin.Int) - Ann() internal final val prop: kotlin.Int - Ann() internal final val x: kotlin.Int = 1 - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - Ann() internal final fun foo(/*0*/ Ann() x: kotlin.Int): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - internal final fun x(): @[Ann()] kotlin.String - - Ann() internal object O1 { - private constructor O1() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } - - Ann() public companion object O2 { - private constructor O2() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } -} - -internal final annotation class Ann : kotlin.Annotation { - public constructor Ann(/*0*/ arg: kotlin.Int = ...) - internal final val arg: kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal interface B { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal interface D : @[Ann()] B { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -Ann() internal final class MyClass { - public constructor MyClass() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -Ann() internal object O3 { - private constructor O3() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -kotlin.data() internal final class Q { - public constructor Q(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int) - internal final val x: kotlin.Int - internal final val y: kotlin.Int - internal final /*synthesized*/ fun component1(): kotlin.Int - internal final /*synthesized*/ fun component2(): kotlin.Int - public final /*synthesized*/ fun copy(/*0*/ x: kotlin.Int = ..., /*1*/ y: kotlin.Int = ...): Q - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index b581a80a1d2..e7c0e76daa0 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -711,12 +711,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } - @TestMetadata("bracketsDeprecation.kt") - public void testBracketsDeprecation() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/bracketsDeprecation.kt"); - doTest(fileName); - } - @TestMetadata("ConstructorCall.kt") public void testConstructorCall() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt"); diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt index 7342b7fd340..74a6b4061f4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCleanupInspection.kt @@ -82,7 +82,6 @@ public class KotlinCleanupInspection(): LocalInspectionTool(), CleanupLocalInspe private val cleanupDiagnosticsFactories = setOf( Errors.DEPRECATED_TRAIT_KEYWORD, - Errors.DEPRECATED_ANNOTATION_SYNTAX, Errors.ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER, Errors.ENUM_ENTRY_USES_DEPRECATED_SUPER_CONSTRUCTOR, Errors.DEPRECATED_LAMBDA_SYNTAX, diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/DeprecatedAnnotationSyntaxFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/DeprecatedAnnotationSyntaxFix.kt deleted file mode 100644 index 6e399138a59..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/DeprecatedAnnotationSyntaxFix.kt +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.idea.quickfix - -import com.intellij.codeInsight.intention.IntentionAction -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiWhiteSpace -import org.jetbrains.kotlin.diagnostics.Diagnostic -import org.jetbrains.kotlin.idea.quickfix.quickfixUtil.addConstructorKeyword -import org.jetbrains.kotlin.idea.quickfix.quickfixUtil.createIntentionFactory -import org.jetbrains.kotlin.idea.quickfix.quickfixUtil.createIntentionForFirstParentOfType -import org.jetbrains.kotlin.psi.JetAnnotation -import org.jetbrains.kotlin.psi.JetFile -import org.jetbrains.kotlin.psi.JetPrimaryConstructor -import org.jetbrains.kotlin.psi.JetPsiFactory - -public class DeprecatedAnnotationSyntaxFix(element: JetAnnotation) : JetIntentionAction(element), CleanupFix { - override fun getFamilyName(): String = "Replace with '@' annotations" - override fun getText(): String = "Replace with '@' annotations" - - override fun invoke(project: Project, editor: Editor?, file: JetFile?) = replaceWithAtAnnotationEntries(element) - - companion object : JetSingleIntentionActionFactory() { - override fun createAction(diagnostic: Diagnostic): IntentionAction? = - diagnostic.createIntentionForFirstParentOfType(::DeprecatedAnnotationSyntaxFix) - - public fun createWholeProjectFixFactory(): JetSingleIntentionActionFactory = createIntentionFactory { - JetWholeProjectForEachElementOfTypeFix.createByPredicate( - predicate = { it.isDeprecated() }, - taskProcessor = { replaceWithAtAnnotationEntries(it) }, - name = "Replace with '@' annotations in whole project" - ) - } - - private fun replaceWithAtAnnotationEntries(annotation: JetAnnotation) { - val psiFactory = JetPsiFactory(annotation) - - val hasFileKeyword = annotation.hasFileKeyword() - - val parent = annotation.getParent() - val owner = parent.getParent() - var prevElement: PsiElement = annotation - - for (entry in annotation.getEntries()) { - val newEntry = if (hasFileKeyword) createFileAnnotationEntry(psiFactory, entry.getText()) - else psiFactory.createAnnotationEntry("@" + entry.getText()) - val added = parent.addAfter(newEntry, prevElement) - - if (prevElement != annotation) { - parent.addBefore(psiFactory.createWhiteSpace(), added) - } - - prevElement = added - } - - if (owner is JetPrimaryConstructor) { - owner.addConstructorKeyword() - } - - annotation.delete() - } - - private fun createFileAnnotationEntry(psiFactory: JetPsiFactory, text: String) = - psiFactory.createFile("@file:$text").getAnnotationEntries().first() - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.java b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.java index 6faa887abdd..11a2eeabfbc 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.java +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.java @@ -325,9 +325,6 @@ public class QuickFixRegistrar { QuickFixes.factories.put(JAVA_LANG_CLASS_PARAMETER_IN_ANNOTATION, ReplaceJavaClassAsAnnotationParameterFix.Companion); QuickFixes.factories.put(JAVA_LANG_CLASS_PARAMETER_IN_ANNOTATION, ReplaceJavaClassAsAnnotationParameterFix.Companion.createWholeProjectFixFactory()); - QuickFixes.factories.put(DEPRECATED_ANNOTATION_SYNTAX, DeprecatedAnnotationSyntaxFix.Companion); - QuickFixes.factories.put(DEPRECATED_ANNOTATION_SYNTAX, DeprecatedAnnotationSyntaxFix.Companion.createWholeProjectFixFactory()); - QuickFixes.factories.put(ENUM_ENTRY_USES_DEPRECATED_SUPER_CONSTRUCTOR, DeprecatedEnumEntrySuperConstructorSyntaxFix.Companion); QuickFixes.factories.put(ENUM_ENTRY_USES_DEPRECATED_SUPER_CONSTRUCTOR, DeprecatedEnumEntrySuperConstructorSyntaxFix.Companion.createWholeProjectFixFactory()); diff --git a/idea/testData/inspections/cleanup/cleanup.kt b/idea/testData/inspections/cleanup/cleanup.kt index 67dc77c8dfe..14f276083d5 100644 --- a/idea/testData/inspections/cleanup/cleanup.kt +++ b/idea/testData/inspections/cleanup/cleanup.kt @@ -1,9 +1,6 @@ trait Foo { } - -[deprecated("boo")] fun bar() {} - enum class E { First Second } diff --git a/idea/testData/inspections/cleanup/cleanup.kt.after b/idea/testData/inspections/cleanup/cleanup.kt.after index 07c56ea7a60..04e11c33fc7 100644 --- a/idea/testData/inspections/cleanup/cleanup.kt.after +++ b/idea/testData/inspections/cleanup/cleanup.kt.after @@ -3,9 +3,6 @@ import kotlin.reflect.KClass interface Foo { } - -@deprecated("boo") fun bar() {} - enum class E { First, Second } diff --git a/idea/testData/quickfix/migration/bracketsAnnotations/basic.kt b/idea/testData/quickfix/migration/bracketsAnnotations/basic.kt deleted file mode 100644 index 2c019819e39..00000000000 --- a/idea/testData/quickfix/migration/bracketsAnnotations/basic.kt +++ /dev/null @@ -1,5 +0,0 @@ -// "Replace with '@' annotations" "true" - -annotation class Ann(val x: Int = 1) - -[Ann Ann(2)] class MyClass \ No newline at end of file diff --git a/idea/testData/quickfix/migration/bracketsAnnotations/basic.kt.after b/idea/testData/quickfix/migration/bracketsAnnotations/basic.kt.after deleted file mode 100644 index 331d7ef7e0e..00000000000 --- a/idea/testData/quickfix/migration/bracketsAnnotations/basic.kt.after +++ /dev/null @@ -1,5 +0,0 @@ -// "Replace with '@' annotations" "true" - -annotation class Ann(val x: Int = 1) - -@Ann @Ann(2) class MyClass \ No newline at end of file diff --git a/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.after.Dependency.kt b/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.after.Dependency.kt deleted file mode 100644 index bc154aa61c3..00000000000 --- a/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.after.Dependency.kt +++ /dev/null @@ -1,3 +0,0 @@ -@file:Ann - -@Ann class B @Ann(1) constructor() diff --git a/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.after.kt b/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.after.kt deleted file mode 100644 index eec78bf475d..00000000000 --- a/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.after.kt +++ /dev/null @@ -1,31 +0,0 @@ -// "Replace with '@' annotations in whole project" "true" - -annotation class Ann(val x: Int = 1) - -@Ann @Ann(2) class MyClass { - @Ann(3) @Ann /* abc */fun foo(x: @Ann Int) { - @Ann class Local { - @Ann init {} - - private @Ann @Ann(4) fun foo() {} - } - - @Ann var x = 1 - - 1+ @Ann(5) 2 - - 3+ @Ann(55)4 - - 5+ @Ann @Ann(6)/* cde */7 - - label@@Ann(7) @Ann for (i in 1..100) {} - } -} -@Ann(1) @Ann -class Q1 - -@Ann(2) - -@Ann(3) - -fun bar() {} diff --git a/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.before.Dependency.kt b/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.before.Dependency.kt deleted file mode 100644 index 888aa006c63..00000000000 --- a/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.before.Dependency.kt +++ /dev/null @@ -1,3 +0,0 @@ -[file: Ann] - -[Ann] class B [Ann(1)]() diff --git a/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.before.Main.kt b/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.before.Main.kt deleted file mode 100644 index 66556d1bf6c..00000000000 --- a/idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.before.Main.kt +++ /dev/null @@ -1,31 +0,0 @@ -// "Replace with '@' annotations in whole project" "true" - -annotation class Ann(val x: Int = 1) - -[Ann Ann(2)] class MyClass { - [Ann(3) Ann]/* abc */fun foo(x: [Ann] Int) { - [Ann] class Local { - [Ann] init {} - - private[Ann Ann(4)]fun foo() {} - } - - [Ann]var x = 1 - - 1+[Ann(5)] 2 - - 3+[Ann(55)]4 - - 5+[Ann Ann(6)]/* cde */7 - - label@[Ann(7) Ann] for (i in 1..100) {} - } -} -[Ann(1) Ann] -class Q1 - -[Ann(2)] - -[Ann(3)] - -fun bar() {} diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java index a31b4ea21e3..2087a51ac33 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java @@ -948,21 +948,6 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/migration"), Pattern.compile("^(\\w+)\\.before\\.Main\\.kt$"), true); } - @TestMetadata("idea/testData/quickfix/migration/bracketsAnnotations") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class BracketsAnnotations extends AbstractQuickFixMultiFileTest { - public void testAllFilesPresentInBracketsAnnotations() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/migration/bracketsAnnotations"), Pattern.compile("^(\\w+)\\.before\\.Main\\.kt$"), true); - } - - @TestMetadata("manyFilesMuitliple.before.Main.kt") - public void testManyFilesMuitliple() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/bracketsAnnotations/manyFilesMuitliple.before.Main.kt"); - doTestWithExtraFile(fileName); - } - } - @TestMetadata("idea/testData/quickfix/migration/javaAnnotationPositionedArguments") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index f6d15439259..6e20a3db983 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -3824,21 +3824,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/migration"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true); } - @TestMetadata("idea/testData/quickfix/migration/bracketsAnnotations") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class BracketsAnnotations extends AbstractQuickFixTest { - public void testAllFilesPresentInBracketsAnnotations() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/migration/bracketsAnnotations"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true); - } - - @TestMetadata("basic.kt") - public void testBasic() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/bracketsAnnotations/basic.kt"); - doTest(fileName); - } - } - @TestMetadata("idea/testData/quickfix/migration/enumConstructor") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)