Get rid of annotation syntax deprecation related things

This commit is contained in:
Denis Zharkov
2015-06-09 15:25:46 +03:00
parent 200dee2761
commit 26864a4407
24 changed files with 0 additions and 360 deletions
@@ -131,7 +131,6 @@ public interface Errors {
DiagnosticFactory0<JetExpression> ANNOTATION_PARAMETER_MUST_BE_CLASS_LITERAL = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetExpression> ANNOTATION_PARAMETER_MUST_BE_KCLASS_LITERAL = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetExpression> ANNOTATION_PARAMETER_MUST_BE_ENUM_CONST = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetAnnotation> DEPRECATED_ANNOTATION_SYNTAX = DiagnosticFactory0.create(WARNING);
DiagnosticFactory0<JetExpression> ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT = DiagnosticFactory0.create(ERROR);
// Classes and traits
@@ -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<T>()` 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");
@@ -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<KotlinPlaceHolderStub<JetA
return visitor.visitAnnotation(this, data);
}
public boolean isDeprecated() {
if (getStub() != null) return false;
return findChildByType(JetTokens.AT) == null;
}
public List<JetAnnotationEntry> getEntries() {
return getStubOrPsiChildrenAsList(JetStubElementTypes.ANNOTATION_ENTRY);
}
public boolean hasFileKeyword() {
return findChildByType(JetTokens.FILE_KEYWORD) != null;
}
}
@@ -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<JetAnnotationEntry> 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<JetAnnotation> 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));
}
}
}
@@ -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)
}
@@ -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);
@@ -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()
@@ -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);
@@ -1,45 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
<!DEPRECATED_ANNOTATION_SYNTAX!>[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<Q> = null!!
<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann Ann]<!> class A <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> constructor(<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> val prop: Int) {
<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> val x = 1
<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> fun foo(<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> x: Int) {
<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> class B
<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> fun local() {}
2 + <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann Ann]<!> 2
for (<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> (a, <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> b) in bar2()) {}
}
fun x(): <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> String {
<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> val x: <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> String = ""
val localVal = <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> object {}
return ""
}
<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> object O1 {}
<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> companion object O2 {
}
}
<!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> object O3 {}
val y: Array<[<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!>] String?> = arrayOfNulls(1)
val block: ([<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!>] x: <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> String) -> <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> String = { "" }
interface B
interface D : <!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> B
Ann(<!ANNOTATION_PARAMETER_MUST_BE_CONST!><!DEPRECATED_ANNOTATION_SYNTAX!>[Ann]<!> 1<!>) class MyClass
@@ -1,77 +0,0 @@
package
internal val block: (@[Ann()] kotlin.String) -> @[Ann()] kotlin.String
internal val y: kotlin.Array<kotlin.String?>
internal fun bar(/*0*/ block: () -> kotlin.Int): kotlin.Int
internal fun bar2(): kotlin.Array<Q>
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
}
@@ -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");