Stub infrastructure for enhancing platform signatures
This commit is contained in:
committed by
Denis Zharkov
parent
991f0fcf2e
commit
f376b2ba70
+7
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.load.java.components;
|
|||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.annotations.ReadOnly;
|
||||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
|
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor;
|
||||||
@@ -36,6 +37,7 @@ import org.jetbrains.kotlin.resolve.jvm.kotlinSignature.SignaturesPropagationDat
|
|||||||
import org.jetbrains.kotlin.types.JetType;
|
import org.jetbrains.kotlin.types.JetType;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -134,4 +136,9 @@ public class TraceBasedExternalSignatureResolver implements ExternalSignatureRes
|
|||||||
public void reportSignatureErrors(@NotNull CallableMemberDescriptor descriptor, @NotNull List<String> signatureErrors) {
|
public void reportSignatureErrors(@NotNull CallableMemberDescriptor descriptor, @NotNull List<String> signatureErrors) {
|
||||||
trace.record(JavaBindingContext.LOAD_FROM_JAVA_SIGNATURE_ERRORS, descriptor, signatureErrors);
|
trace.record(JavaBindingContext.LOAD_FROM_JAVA_SIGNATURE_ERRORS, descriptor, signatureErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <D extends CallableMemberDescriptor> Collection<D> enhanceSignatures(@NotNull @ReadOnly Collection<D> platformSignatures) {
|
||||||
|
return ComponentsPackage.enhanceSignatures(platformSignatures);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2015 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.load.java.components
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||||
|
|
||||||
|
fun <D : CallableMemberDescriptor> enhanceSignatures(platformSignatures: Collection<D>): Collection<D> {
|
||||||
|
// TODO: implement
|
||||||
|
return platformSignatures
|
||||||
|
}
|
||||||
+13
@@ -18,12 +18,14 @@ package org.jetbrains.kotlin.load.java.components;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.annotations.ReadOnly;
|
||||||
import org.jetbrains.kotlin.descriptors.*;
|
import org.jetbrains.kotlin.descriptors.*;
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaField;
|
import org.jetbrains.kotlin.load.java.structure.JavaField;
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaMember;
|
import org.jetbrains.kotlin.load.java.structure.JavaMember;
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaMethod;
|
import org.jetbrains.kotlin.load.java.structure.JavaMethod;
|
||||||
import org.jetbrains.kotlin.types.JetType;
|
import org.jetbrains.kotlin.types.JetType;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -73,6 +75,11 @@ public interface ExternalSignatureResolver {
|
|||||||
public void reportSignatureErrors(@NotNull CallableMemberDescriptor descriptor, @NotNull List<String> signatureErrors) {
|
public void reportSignatureErrors(@NotNull CallableMemberDescriptor descriptor, @NotNull List<String> signatureErrors) {
|
||||||
throw new UnsupportedOperationException("Should not be called");
|
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 {
|
abstract class MemberSignature {
|
||||||
@@ -201,4 +208,10 @@ public interface ExternalSignatureResolver {
|
|||||||
);
|
);
|
||||||
|
|
||||||
void reportSignatureErrors(@NotNull CallableMemberDescriptor descriptor, @NotNull List<String> signatureErrors);
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -86,14 +86,16 @@ public abstract class LazyJavaMemberScope(
|
|||||||
|
|
||||||
computeNonDeclaredFunctions(result, name)
|
computeNonDeclaredFunctions(result, name)
|
||||||
|
|
||||||
|
val enhancedResult = c.externalSignatureResolver.enhanceSignatures(result)
|
||||||
|
|
||||||
// Make sure that lazy things are computed before we release the lock
|
// 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()) {
|
for (p in f.getValueParameters()) {
|
||||||
p.hasDefaultValue()
|
p.hasDefaultValue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.toReadOnlyList()
|
enhancedResult.toReadOnlyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected data class MethodSignatureData(
|
protected data class MethodSignatureData(
|
||||||
|
|||||||
Reference in New Issue
Block a user