Exception fix: more accurate type annotation parsing #EA-69124 Fixed
This commit is contained in:
@@ -105,6 +105,15 @@ public class AnnotationResolver {
|
||||
return resolveAnnotations(scope, modifierList, trace, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Annotations resolveAnnotationsWithoutArguments(
|
||||
@NotNull JetScope scope,
|
||||
@NotNull List<JetAnnotationEntry> annotationEntries,
|
||||
@NotNull BindingTrace trace
|
||||
) {
|
||||
return resolveAnnotationEntries(scope, annotationEntries, trace, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Annotations resolveAnnotationsWithArguments(
|
||||
@NotNull JetScope scope,
|
||||
|
||||
@@ -147,6 +147,7 @@ class FunctionDescriptorResolver(
|
||||
typeResolver.resolveType(innerScope, receiverTypeRef, trace, true)
|
||||
else
|
||||
expectedFunctionType.getReceiverType()
|
||||
receiverType?.let { AnnotationResolver.resolveAnnotationsArguments(it.getAnnotations()) }
|
||||
|
||||
|
||||
val valueParameterDescriptors = createValueParameterDescriptors(function, functionDescriptor, innerScope, trace, expectedFunctionType)
|
||||
@@ -166,6 +167,9 @@ class FunctionDescriptorResolver(
|
||||
modality,
|
||||
visibility
|
||||
)
|
||||
for (valueParameterDescriptor in valueParameterDescriptors) {
|
||||
AnnotationResolver.resolveAnnotationsArguments(valueParameterDescriptor.getType().getAnnotations())
|
||||
}
|
||||
}
|
||||
|
||||
private fun createValueParameterDescriptors(
|
||||
|
||||
@@ -104,7 +104,7 @@ public class TypeResolver(
|
||||
|
||||
private fun doResolvePossiblyBareType(c: TypeResolutionContext, typeReference: JetTypeReference): PossiblyBareType {
|
||||
AnnotationResolver.reportDeprecatedAnnotationSyntax(typeReference.getAnnotations(), c.trace);
|
||||
val annotations = annotationResolver.resolveAnnotationsWithArguments(c.scope, typeReference.getAnnotationEntries(), c.trace)
|
||||
val annotations = annotationResolver.resolveAnnotationsWithoutArguments(c.scope, typeReference.getAnnotationEntries(), c.trace)
|
||||
|
||||
val typeElement = typeReference.getTypeElement()
|
||||
|
||||
|
||||
+1
@@ -136,6 +136,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
|
||||
VariableDescriptor propertyDescriptor = components.descriptorResolver.
|
||||
resolveLocalVariableDescriptor(scope, property, context.dataFlowInfo, context.trace);
|
||||
AnnotationResolver.resolveAnnotationsArguments(propertyDescriptor.getType().getAnnotations());
|
||||
JetExpression initializer = property.getInitializer();
|
||||
JetTypeInfo typeInfo;
|
||||
if (initializer != null) {
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// Class constructor parameter type CAN be recursively annotated
|
||||
annotation class RecursivelyAnnotated(val x: @RecursivelyAnnotated(1) Int)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package
|
||||
|
||||
internal final annotation class RecursivelyAnnotated : kotlin.Annotation {
|
||||
public constructor RecursivelyAnnotated(/*0*/ x: @[RecursivelyAnnotated(x = IntegerValueType(1): IntegerValueType(1))] kotlin.Int)
|
||||
internal final val x: @[RecursivelyAnnotated(x = IntegerValueType(1): IntegerValueType(1))] 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
|
||||
}
|
||||
@@ -861,6 +861,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("RecursivelyAnnotatedParameterType.kt")
|
||||
public void testRecursivelyAnnotatedParameterType() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedParameterType.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("RecursivelyAnnotatedParameterWithAt.kt")
|
||||
public void testRecursivelyAnnotatedParameterWithAt() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedParameterWithAt.kt");
|
||||
|
||||
Reference in New Issue
Block a user