Report UNSUPPORTED on annotations on type parameters of classes

This commit is contained in:
Andrey Breslav
2014-02-26 19:00:04 +04:00
parent 5251b3286e
commit c3c769194d
3 changed files with 17 additions and 5 deletions
@@ -345,8 +345,8 @@ public class AnnotationResolver {
return new AnnotationsImpl(result);
}
public static void reportUnsupportedAnnotationForTypeParameter(@NotNull JetModifierListOwner modifierListOwner, BindingTrace trace) {
JetModifierList modifierList = modifierListOwner.getModifierList();
public static void reportUnsupportedAnnotationForTypeParameter(@NotNull JetTypeParameter jetTypeParameter, @NotNull BindingTrace trace) {
JetModifierList modifierList = jetTypeParameter.getModifierList();
if (modifierList == null) return;
for (JetAnnotationEntry annotationEntry : modifierList.getAnnotationEntries()) {
@@ -206,6 +206,9 @@ public class DeclarationsChecker {
private void checkClass(JetClass aClass, ClassDescriptorWithResolutionScopes classDescriptor) {
checkOpenMembers(classDescriptor);
if (TopDownAnalyzer.LAZY) {
checkTypeParameters(aClass);
}
if (aClass.isTrait()) {
checkTraitModifiers(aClass);
checkConstructorInTrait(aClass);
@@ -222,6 +225,13 @@ public class DeclarationsChecker {
}
}
private void checkTypeParameters(JetTypeParameterListOwner typeParameterListOwner) {
// TODO: Support annotation for type parameters
for (JetTypeParameter typeParameter : typeParameterListOwner.getTypeParameters()) {
AnnotationResolver.reportUnsupportedAnnotationForTypeParameter(typeParameter, trace);
}
}
private void checkConstructorInTrait(JetClass klass) {
JetParameterList primaryConstructorParameterList = klass.getPrimaryConstructorParameterList();
if (primaryConstructorParameterList != null) {
@@ -111,8 +111,10 @@ public class DescriptorResolver {
List<TypeParameterDescriptor> typeParameters = Lists.newArrayList();
int index = 0;
for (JetTypeParameter typeParameter : classElement.getTypeParameters()) {
// TODO: Support
AnnotationResolver.reportUnsupportedAnnotationForTypeParameter(typeParameter, trace);
if (!TopDownAnalyzer.LAZY) {
// TODO: Support
AnnotationResolver.reportUnsupportedAnnotationForTypeParameter(typeParameter, trace);
}
TypeParameterDescriptor typeParameterDescriptor = TypeParameterDescriptorImpl.createForFurtherModification(
descriptor,
@@ -1429,4 +1431,4 @@ public class DescriptorResolver {
trace.record(RESOLUTION_SCOPE, nameExpression, parentPackageView.getMemberScope());
}
}
}
}