Proper resolution order for annotation constructors
This commit is contained in:
@@ -2,7 +2,6 @@ package org.jetbrains.jet.lang.resolve;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
|
||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
|
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
|
||||||
@@ -11,7 +10,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.jetbrains.jet.lang.diagnostics.Errors.CONSTRUCTOR_IN_TRAIT;
|
import static org.jetbrains.jet.lang.diagnostics.Errors.CONSTRUCTOR_IN_TRAIT;
|
||||||
import static org.jetbrains.jet.lang.resolve.BindingContext.ANNOTATION;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author abreslav
|
* @author abreslav
|
||||||
@@ -45,20 +43,23 @@ public class DeclarationResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void resolveAnnotationStubsOnClassesAndConstructors() {
|
private void resolveAnnotationStubsOnClassesAndConstructors() {
|
||||||
|
AnnotationResolver annotationResolver = new AnnotationResolver(context.getSemanticServices(), context.getTrace());
|
||||||
for (Map.Entry<JetClass, MutableClassDescriptor> entry : context.getClasses().entrySet()) {
|
for (Map.Entry<JetClass, MutableClassDescriptor> entry : context.getClasses().entrySet()) {
|
||||||
JetClass jetClass = entry.getKey();
|
JetClass jetClass = entry.getKey();
|
||||||
MutableClassDescriptor mutableClassDescriptor = entry.getValue();
|
MutableClassDescriptor descriptor = entry.getValue();
|
||||||
|
resolveAnnotationsForClassOrObject(annotationResolver, jetClass, descriptor);
|
||||||
|
}
|
||||||
|
for (Map.Entry<JetObjectDeclaration, MutableClassDescriptor> entry : context.getObjects().entrySet()) {
|
||||||
|
JetObjectDeclaration objectDeclaration = entry.getKey();
|
||||||
|
MutableClassDescriptor descriptor = entry.getValue();
|
||||||
|
resolveAnnotationsForClassOrObject(annotationResolver, objectDeclaration, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
JetModifierList modifierList = jetClass.getModifierList();
|
private void resolveAnnotationsForClassOrObject(AnnotationResolver annotationResolver, JetClassOrObject jetClass, MutableClassDescriptor descriptor) {
|
||||||
if (modifierList != null) {
|
JetModifierList modifierList = jetClass.getModifierList();
|
||||||
List<JetAnnotationEntry> annotationEntries = modifierList.getAnnotationEntries();
|
if (modifierList != null) {
|
||||||
for (JetAnnotationEntry annotationEntry : annotationEntries) {
|
descriptor.getAnnotations().addAll(annotationResolver.resolveAnnotations(descriptor.getScopeForSupertypeResolution(), modifierList.getAnnotationEntries()));
|
||||||
AnnotationDescriptor annotationDescriptor = context.getTrace().get(ANNOTATION, annotationEntry);
|
|
||||||
if (annotationDescriptor != null) {
|
|
||||||
annotationResolver.resolveAnnotationStub(mutableClassDescriptor.getScopeForSupertypeResolution(), annotationEntry, annotationDescriptor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,6 @@ public class TypeHierarchyResolver {
|
|||||||
|
|
||||||
// At this point, there are no loops in the type hierarchy
|
// At this point, there are no loops in the type hierarchy
|
||||||
|
|
||||||
resolveAnnotations();
|
|
||||||
|
|
||||||
checkSupertypesForConsistency();
|
checkSupertypesForConsistency();
|
||||||
// computeSuperclasses();
|
// computeSuperclasses();
|
||||||
|
|
||||||
@@ -366,22 +364,6 @@ public class TypeHierarchyResolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resolveAnnotations() {
|
|
||||||
AnnotationResolver annotationResolver = new AnnotationResolver(context.getSemanticServices(), context.getTrace());
|
|
||||||
for (Map.Entry<JetClass, MutableClassDescriptor> entry : context.getClasses().entrySet()) {
|
|
||||||
JetClass jetClass = entry.getKey();
|
|
||||||
MutableClassDescriptor descriptor = entry.getValue();
|
|
||||||
JetModifierList modifierList = jetClass.getModifierList();
|
|
||||||
if (modifierList != null) {
|
|
||||||
descriptor.getAnnotations().addAll(annotationResolver.resolveAnnotations(descriptor.getScopeForSupertypeResolution(), modifierList.getAnnotationEntries()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Map.Entry<JetObjectDeclaration, MutableClassDescriptor> entry : context.getObjects().entrySet()) {
|
|
||||||
JetObjectDeclaration objectDeclaration = entry.getKey();
|
|
||||||
MutableClassDescriptor descriptor = entry.getValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkSupertypesForConsistency() {
|
private void checkSupertypesForConsistency() {
|
||||||
for (MutableClassDescriptor mutableClassDescriptor : topologicalOrder) {
|
for (MutableClassDescriptor mutableClassDescriptor : topologicalOrder) {
|
||||||
Multimap<TypeConstructor, TypeProjection> multimap = TypeUtils.buildDeepSubstitutionMultimap(mutableClassDescriptor.getDefaultType());
|
Multimap<TypeConstructor, TypeProjection> multimap = TypeUtils.buildDeepSubstitutionMultimap(mutableClassDescriptor.getDefaultType());
|
||||||
|
|||||||
Reference in New Issue
Block a user