kotlin.reflect.jvm.internal.impl.load.java.components.SignaturePropagator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-reflect Show documentation
Show all versions of kotlin-reflect Show documentation
Kotlin Full Reflection Library
/*
* 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 kotlin.reflect.jvm.internal.impl.load.java.components;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import kotlin.reflect.jvm.internal.impl.descriptors.CallableMemberDescriptor;
import kotlin.reflect.jvm.internal.impl.descriptors.ClassDescriptor;
import kotlin.reflect.jvm.internal.impl.descriptors.TypeParameterDescriptor;
import kotlin.reflect.jvm.internal.impl.descriptors.ValueParameterDescriptor;
import kotlin.reflect.jvm.internal.impl.load.java.structure.JavaMethod;
import kotlin.reflect.jvm.internal.impl.types.KotlinType;
import java.util.Collections;
import java.util.List;
public interface SignaturePropagator {
SignaturePropagator DO_NOTHING = new SignaturePropagator() {
@NotNull
@Override
public PropagatedSignature resolvePropagatedSignature(
@NotNull JavaMethod method,
@NotNull ClassDescriptor owner,
@NotNull KotlinType returnType,
@Nullable KotlinType receiverType,
@NotNull List valueParameters,
@NotNull List typeParameters
) {
return new PropagatedSignature(
returnType, receiverType, valueParameters, typeParameters, Collections.emptyList(), false
);
}
@Override
public void reportSignatureErrors(@NotNull CallableMemberDescriptor descriptor, @NotNull List signatureErrors) {
throw new UnsupportedOperationException("Should not be called");
}
};
class PropagatedSignature {
private final KotlinType returnType;
private final KotlinType receiverType;
private final List valueParameters;
private final List typeParameters;
private final List signatureErrors;
private final boolean hasStableParameterNames;
public PropagatedSignature(
@NotNull KotlinType returnType,
@Nullable KotlinType receiverType,
@NotNull List valueParameters,
@NotNull List typeParameters,
@NotNull List signatureErrors,
boolean hasStableParameterNames
) {
this.returnType = returnType;
this.receiverType = receiverType;
this.valueParameters = valueParameters;
this.typeParameters = typeParameters;
this.signatureErrors = signatureErrors;
this.hasStableParameterNames = hasStableParameterNames;
}
@NotNull
public KotlinType getReturnType() {
return returnType;
}
@Nullable
public KotlinType getReceiverType() {
return receiverType;
}
@NotNull
public List getValueParameters() {
return valueParameters;
}
@NotNull
public List getTypeParameters() {
return typeParameters;
}
public boolean hasStableParameterNames() {
return hasStableParameterNames;
}
@NotNull
public List getErrors() {
return signatureErrors;
}
}
@NotNull
PropagatedSignature resolvePropagatedSignature(
@NotNull JavaMethod method,
@NotNull ClassDescriptor owner,
@NotNull KotlinType returnType,
@Nullable KotlinType receiverType,
@NotNull List valueParameters,
@NotNull List typeParameters
);
void reportSignatureErrors(@NotNull CallableMemberDescriptor descriptor, @NotNull List signatureErrors);
}