Stub infrastructure for enhancing platform signatures

This commit is contained in:
Andrey Breslav
2015-04-17 13:15:06 +03:00
committed by Denis Zharkov
parent 991f0fcf2e
commit f376b2ba70
4 changed files with 49 additions and 3 deletions
@@ -18,12 +18,14 @@ package org.jetbrains.kotlin.load.java.components;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.ReadOnly;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.load.java.structure.JavaField;
import org.jetbrains.kotlin.load.java.structure.JavaMember;
import org.jetbrains.kotlin.load.java.structure.JavaMethod;
import org.jetbrains.kotlin.types.JetType;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -73,6 +75,11 @@ public interface ExternalSignatureResolver {
public void reportSignatureErrors(@NotNull CallableMemberDescriptor descriptor, @NotNull List<String> signatureErrors) {
throw new UnsupportedOperationException("Should not be called");
}
@Override
public <D extends CallableMemberDescriptor> Collection<D> enhanceSignatures(@NotNull @ReadOnly Collection<D> platformSignatures) {
return platformSignatures;
}
};
abstract class MemberSignature {
@@ -201,4 +208,10 @@ public interface ExternalSignatureResolver {
);
void reportSignatureErrors(@NotNull CallableMemberDescriptor descriptor, @NotNull List<String> signatureErrors);
/**
* Replaces some items in the {@code platformSignatures} collection with enhanced signatures.
* Is called after binding overrides, so the implementation is allowed to inspect contents of getOverriddenDescriptors()
*/
<D extends CallableMemberDescriptor> Collection<D> enhanceSignatures(@NotNull @ReadOnly Collection<D> platformSignatures);
}
@@ -86,14 +86,16 @@ public abstract class LazyJavaMemberScope(
computeNonDeclaredFunctions(result, name)
val enhancedResult = c.externalSignatureResolver.enhanceSignatures(result)
// Make sure that lazy things are computed before we release the lock
for (f in result) {
for (f in enhancedResult) {
for (p in f.getValueParameters()) {
p.hasDefaultValue()
}
}
result.toReadOnlyList()
enhancedResult.toReadOnlyList()
}
protected data class MethodSignatureData(