Weird Javac compilation problem fixed

This commit is contained in:
Andrey Breslav
2011-09-06 14:01:00 +04:00
parent 3242c70c6f
commit 533574368f
@@ -16,7 +16,7 @@ import java.util.List;
/** /**
* @author abreslav * @author abreslav
*/ */
/*package*/ abstract class TaskPrioritizer<Descriptor extends CallableDescriptor> { /*package*/ abstract class TaskPrioritizer<D extends CallableDescriptor> {
public static <T extends DeclarationDescriptor> void splitLexicallyLocalDescriptors( public static <T extends DeclarationDescriptor> void splitLexicallyLocalDescriptors(
Collection<? extends T> allDescriptors, DeclarationDescriptor containerOfTheCurrentLocality, List<? super T> local, List<? super T> nonlocal) { Collection<? extends T> allDescriptors, DeclarationDescriptor containerOfTheCurrentLocality, List<? super T> local, List<? super T> nonlocal) {
@@ -59,27 +59,29 @@ import java.util.List;
return false; return false;
} }
public List<ResolutionTask<Descriptor>> computePrioritizedTasks(JetScope scope, JetType receiverType, Call call, String name) { public List<ResolutionTask<D>> computePrioritizedTasks(JetScope scope, JetType receiverType, Call call, String name) {
List<ResolutionTask<Descriptor>> result = Lists.newArrayList(); List<ResolutionTask<D>> result = Lists.newArrayList();
if (receiverType != null) { if (receiverType != null) {
Collection<Descriptor> extensionFunctions = getExtensionsByName(scope, name); Collection<D> extensionFunctions = getExtensionsByName(scope, name);
List<Descriptor> nonlocals = Lists.newArrayList(); List<D> nonlocals = Lists.newArrayList();
List<Descriptor> locals = Lists.newArrayList(); List<D> locals = Lists.newArrayList();
splitLexicallyLocalDescriptors(extensionFunctions, scope.getContainingDeclaration(), locals, nonlocals); //noinspection unchecked,RedundantTypeArguments
TaskPrioritizer.<D>splitLexicallyLocalDescriptors(extensionFunctions, scope.getContainingDeclaration(), locals, nonlocals);
Collection<Descriptor> members = getMembersByName(receiverType, name); Collection<D> members = getMembersByName(receiverType, name);
addTask(result, receiverType, call, locals); addTask(result, receiverType, call, locals);
addTask(result, null, call, members); addTask(result, null, call, members);
addTask(result, receiverType, call, nonlocals); addTask(result, receiverType, call, nonlocals);
} }
else { else {
Collection<Descriptor> functions = getNonExtensionsByName(scope, name); Collection<D> functions = getNonExtensionsByName(scope, name);
List<Descriptor> nonlocals = Lists.newArrayList(); List<D> nonlocals = Lists.newArrayList();
List<Descriptor> locals = Lists.newArrayList(); List<D> locals = Lists.newArrayList();
splitLexicallyLocalDescriptors(functions, scope.getContainingDeclaration(), locals, nonlocals); //noinspection unchecked,RedundantTypeArguments
TaskPrioritizer.<D>splitLexicallyLocalDescriptors(functions, scope.getContainingDeclaration(), locals, nonlocals);
addTask(result, receiverType, call, locals); addTask(result, receiverType, call, locals);
@@ -89,20 +91,20 @@ import java.util.List;
} }
@NotNull @NotNull
protected abstract Collection<Descriptor> getNonExtensionsByName(JetScope scope, String name); protected abstract Collection<D> getNonExtensionsByName(JetScope scope, String name);
@NotNull @NotNull
protected abstract Collection<Descriptor> getMembersByName(@NotNull JetType receiverType, String name); protected abstract Collection<D> getMembersByName(@NotNull JetType receiverType, String name);
@NotNull @NotNull
protected abstract Collection<Descriptor> getExtensionsByName(JetScope scope, String name); protected abstract Collection<D> getExtensionsByName(JetScope scope, String name);
private void addTask(@NotNull List<ResolutionTask<Descriptor>> result, @Nullable JetType receiverType, @NotNull Call call, @NotNull Collection<Descriptor> candidates) { private void addTask(@NotNull List<ResolutionTask<D>> result, @Nullable JetType receiverType, @NotNull Call call, @NotNull Collection<D> candidates) {
if (candidates.isEmpty()) return; if (candidates.isEmpty()) return;
result.add(createTask(receiverType, call, candidates)); result.add(createTask(receiverType, call, candidates));
} }
@NotNull @NotNull
protected abstract ResolutionTask<Descriptor> createTask(JetType receiverType, Call call, Collection<Descriptor> candidates); protected abstract ResolutionTask<D> createTask(JetType receiverType, Call call, Collection<D> candidates);
} }