Remove redundant type arguments for Java 8+ in compiler modules
This commit is contained in:
@@ -208,11 +208,7 @@ public class FunctionCodegen {
|
||||
getThrownExceptions(functionDescriptor, typeMapper));
|
||||
|
||||
if (CodegenContextUtil.isImplClassOwner(owner)) {
|
||||
v.getSerializationBindings().put(
|
||||
METHOD_FOR_FUNCTION,
|
||||
CodegenUtilKt.<FunctionDescriptor>unwrapFrontendVersion(functionDescriptor),
|
||||
asmMethod
|
||||
);
|
||||
v.getSerializationBindings().put(METHOD_FOR_FUNCTION, CodegenUtilKt.unwrapFrontendVersion(functionDescriptor), asmMethod);
|
||||
}
|
||||
|
||||
generateMethodAnnotations(functionDescriptor, asmMethod, mv);
|
||||
|
||||
@@ -1031,7 +1031,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
else if (constructor.hasBody() && !(constructor instanceof KtSecondaryConstructor && !((KtSecondaryConstructor) constructor).hasImplicitDelegationCall())) {
|
||||
KtBlockExpression bodyExpression = constructor.getBodyExpression();
|
||||
List<KtExpression> statements = bodyExpression != null ? bodyExpression.getStatements() : Collections.<KtExpression>emptyList();
|
||||
List<KtExpression> statements = bodyExpression != null ? bodyExpression.getStatements() : Collections.emptyList();
|
||||
if (!statements.isEmpty()) {
|
||||
codegen.markStartLineNumber(statements.iterator().next());
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.CodegenUtil;
|
||||
@@ -60,7 +59,10 @@ import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
import org.jetbrains.kotlin.storage.NotNullLazyValue;
|
||||
import org.jetbrains.kotlin.types.ErrorUtils;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
import org.jetbrains.org.objectweb.asm.Label;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
|
||||
@@ -450,8 +452,7 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
|
||||
private SimpleFunctionDescriptorImpl createClInitFunctionDescriptor(@NotNull DeclarationDescriptor descriptor) {
|
||||
SimpleFunctionDescriptorImpl clInit = SimpleFunctionDescriptorImpl.create(descriptor, Annotations.Companion.getEMPTY(),
|
||||
Name.special("<clinit>"), SYNTHESIZED, KotlinSourceElementKt.toSourceElement(element));
|
||||
clInit.initialize(null, null, Collections.<TypeParameterDescriptor>emptyList(),
|
||||
Collections.<ValueParameterDescriptor>emptyList(),
|
||||
clInit.initialize(null, null, Collections.emptyList(), Collections.emptyList(),
|
||||
DescriptorUtilsKt.getModule(descriptor).getBuiltIns().getUnitType(),
|
||||
null, Visibilities.PRIVATE);
|
||||
return clInit;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ScriptCodegen extends MemberCodegen<KtScript> {
|
||||
List<ScriptDescriptor> earlierScripts = state.getReplSpecific().getEarlierScriptsForReplInterpreter();
|
||||
ScriptContext scriptContext = parentContext.intoScript(
|
||||
scriptDescriptor,
|
||||
earlierScripts == null ? Collections.<ScriptDescriptor>emptyList() : earlierScripts,
|
||||
earlierScripts == null ? Collections.emptyList() : earlierScripts,
|
||||
scriptDescriptor,
|
||||
state.getTypeMapper()
|
||||
);
|
||||
|
||||
@@ -106,7 +106,7 @@ public final class MutableClosure implements CalculatedClosure {
|
||||
@NotNull
|
||||
@Override
|
||||
public Map<DeclarationDescriptor, EnclosedValueDescriptor> getCaptureVariables() {
|
||||
return captureVariables != null ? captureVariables : Collections.<DeclarationDescriptor, EnclosedValueDescriptor>emptyMap();
|
||||
return captureVariables != null ? captureVariables : Collections.emptyMap();
|
||||
}
|
||||
|
||||
public void setCaptureReceiverType(@NotNull KotlinType type) {
|
||||
@@ -116,7 +116,7 @@ public final class MutableClosure implements CalculatedClosure {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<Pair<String, Type>> getRecordedFields() {
|
||||
return recordedFields != null ? recordedFields : Collections.<Pair<String, Type>>emptyList();
|
||||
return recordedFields != null ? recordedFields : Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -590,7 +590,7 @@ public class InlineCodegen extends CallGenerator {
|
||||
strategy =
|
||||
new SuspendFunctionGenerationStrategy(
|
||||
state,
|
||||
CoroutineCodegenUtilKt.<FunctionDescriptor>unwrapInitialDescriptorForSuspendFunction(descriptor),
|
||||
CoroutineCodegenUtilKt.unwrapInitialDescriptorForSuspendFunction(descriptor),
|
||||
(KtFunction) expression
|
||||
);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class InliningContext {
|
||||
|
||||
@NotNull
|
||||
public InliningContext subInline(@NotNull NameGenerator generator) {
|
||||
return subInline(generator, Collections.<String, String>emptyMap(), isInliningLambda);
|
||||
return subInline(generator, Collections.emptyMap(), isInliningLambda);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ModuleScriptData {
|
||||
public static final ModuleScriptData EMPTY = new ModuleScriptData(Collections.<Module>emptyList());
|
||||
public static final ModuleScriptData EMPTY = new ModuleScriptData(Collections.emptyList());
|
||||
|
||||
private final List<Module> modules;
|
||||
|
||||
|
||||
@@ -387,10 +387,7 @@ public class CheckerTestUtil {
|
||||
}
|
||||
|
||||
public static StringBuffer addDiagnosticMarkersToText(@NotNull PsiFile psiFile, @NotNull Collection<ActualDiagnostic> diagnostics) {
|
||||
return addDiagnosticMarkersToText(
|
||||
psiFile, diagnostics, Collections.<ActualDiagnostic, TextDiagnostic>emptyMap(),
|
||||
PsiElement::getText
|
||||
);
|
||||
return addDiagnosticMarkersToText(psiFile, diagnostics, Collections.emptyMap(), PsiElement::getText);
|
||||
}
|
||||
|
||||
public static StringBuffer addDiagnosticMarkersToText(
|
||||
|
||||
@@ -59,13 +59,13 @@ public class CompilerConfiguration {
|
||||
@NotNull
|
||||
public <T> List<T> getList(@NotNull CompilerConfigurationKey<List<T>> key) {
|
||||
List<T> data = get(key);
|
||||
return data == null ? Collections.<T>emptyList() : data;
|
||||
return data == null ? Collections.emptyList() : data;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public <K, V> Map<K, V> getMap(@NotNull CompilerConfigurationKey<Map<K, V>> key) {
|
||||
Map<K, V> data = get(key);
|
||||
return data == null ? Collections.<K, V>emptyMap() : data;
|
||||
return data == null ? Collections.emptyMap() : data;
|
||||
}
|
||||
|
||||
public <T> void put(@NotNull CompilerConfigurationKey<T> key, @NotNull T value) {
|
||||
|
||||
@@ -68,7 +68,7 @@ public class KtCallExpression extends KtExpressionImpl implements KtCallElement,
|
||||
@NotNull
|
||||
public List<KtValueArgument> getValueArguments() {
|
||||
KtValueArgumentList list = getValueArgumentList();
|
||||
List<KtValueArgument> valueArgumentsInParentheses = list != null ? list.getArguments() : Collections.<KtValueArgument>emptyList();
|
||||
List<KtValueArgument> valueArgumentsInParentheses = list != null ? list.getArguments() : Collections.emptyList();
|
||||
List<KtLambdaArgument> functionLiteralArguments = getLambdaArguments();
|
||||
if (functionLiteralArguments.isEmpty()) {
|
||||
return valueArgumentsInParentheses;
|
||||
@@ -83,6 +83,6 @@ public class KtCallExpression extends KtExpressionImpl implements KtCallElement,
|
||||
@NotNull
|
||||
public List<KtTypeProjection> getTypeArguments() {
|
||||
KtTypeArgumentList list = getTypeArgumentList();
|
||||
return list != null ? list.getArguments() : Collections.<KtTypeProjection>emptyList();
|
||||
return list != null ? list.getArguments() : Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class KtFile extends PsiFileBase implements KtDeclarationContainer, KtAnn
|
||||
@NotNull
|
||||
public List<KtImportDirective> getImportDirectives() {
|
||||
KtImportList importList = getImportList();
|
||||
return importList != null ? importList.getImports() : Collections.<KtImportDirective>emptyList();
|
||||
return importList != null ? importList.getImports() : Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class KtFunctionNotStubbed extends KtTypeParameterListOwnerNotSt
|
||||
@NotNull
|
||||
public List<KtParameter> getValueParameters() {
|
||||
KtParameterList list = getValueParameterList();
|
||||
return list != null ? list.getParameters() : Collections.<KtParameter>emptyList();
|
||||
return list != null ? list.getParameters() : Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -72,7 +72,7 @@ public class KtFunctionType extends KtElementImplStub<KotlinPlaceHolderStub<KtFu
|
||||
@NotNull
|
||||
public List<KtParameter> getParameters() {
|
||||
KtParameterList list = getParameterList();
|
||||
return list != null ? list.getParameters() : Collections.<KtParameter>emptyList();
|
||||
return list != null ? list.getParameters() : Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -115,7 +115,7 @@ public class KtNamedFunction extends KtTypeParameterListOwnerStub<KotlinFunction
|
||||
@NotNull
|
||||
public List<KtParameter> getValueParameters() {
|
||||
KtParameterList list = getValueParameterList();
|
||||
return list != null ? list.getParameters() : Collections.<KtParameter>emptyList();
|
||||
return list != null ? list.getParameters() : Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@ public class KtNullableType extends KtElementImplStub<KotlinPlaceHolderStub<KtNu
|
||||
@Override
|
||||
public List<KtTypeReference> getTypeArgumentsAsTypes() {
|
||||
KtTypeElement innerType = getInnerType();
|
||||
return innerType == null ? Collections.<KtTypeReference>emptyList() : innerType.getTypeArgumentsAsTypes();
|
||||
return innerType == null ? Collections.emptyList() : innerType.getTypeArgumentsAsTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,7 +66,6 @@ public class KtNullableType extends KtElementImplStub<KotlinPlaceHolderStub<KtNu
|
||||
@NotNull
|
||||
public List<KtAnnotationEntry> getAnnotationEntries() {
|
||||
KtModifierList modifierList = getModifierList();
|
||||
return modifierList != null ? modifierList.getAnnotationEntries()
|
||||
: Collections.<KtAnnotationEntry>emptyList();
|
||||
return modifierList != null ? modifierList.getAnnotationEntries() : Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class KtUserType extends KtElementImplStub<KotlinUserTypeStub> implements
|
||||
public List<KtTypeProjection> getTypeArguments() {
|
||||
// TODO: empty elements in PSI
|
||||
KtTypeArgumentList typeArgumentList = getTypeArgumentList();
|
||||
return typeArgumentList == null ? Collections.<KtTypeProjection>emptyList() : typeArgumentList.getArguments();
|
||||
return typeArgumentList == null ? Collections.emptyList() : typeArgumentList.getArguments();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -125,8 +125,8 @@ public class DescriptorResolver {
|
||||
BindingTrace trace
|
||||
) {
|
||||
List<KotlinType> supertypes = Lists.newArrayList();
|
||||
List<KtSuperTypeListEntry> delegationSpecifiers = correspondingClassOrObject == null ? Collections.<KtSuperTypeListEntry>emptyList() :
|
||||
correspondingClassOrObject.getSuperTypeListEntries();
|
||||
List<KtSuperTypeListEntry> delegationSpecifiers =
|
||||
correspondingClassOrObject == null ? Collections.emptyList() : correspondingClassOrObject.getSuperTypeListEntries();
|
||||
Collection<KotlinType> declaredSupertypes = resolveSuperTypeListEntries(
|
||||
scope,
|
||||
delegationSpecifiers,
|
||||
@@ -1151,8 +1151,9 @@ public class DescriptorResolver {
|
||||
false
|
||||
);
|
||||
propertyWrapper.setDescriptor(propertyDescriptor);
|
||||
propertyDescriptor.setType(type, Collections.<TypeParameterDescriptor>emptyList(),
|
||||
getDispatchReceiverParameterIfNeeded(classDescriptor), (ReceiverParameterDescriptor) null);
|
||||
propertyDescriptor.setType(
|
||||
type, Collections.emptyList(), getDispatchReceiverParameterIfNeeded(classDescriptor), (ReceiverParameterDescriptor) null
|
||||
);
|
||||
|
||||
Annotations setterAnnotations = annotationSplitter.getAnnotationsForTarget(PROPERTY_SETTER);
|
||||
Annotations getterAnnotations = new CompositeAnnotations(CollectionsKt.listOf(
|
||||
|
||||
@@ -276,11 +276,11 @@ public class ArgumentTypeResolver {
|
||||
}
|
||||
|
||||
if (expectedTypeIsUnknown) {
|
||||
return functionPlaceholders.createFunctionPlaceholderType(Collections.<KotlinType>emptyList(), false);
|
||||
return functionPlaceholders.createFunctionPlaceholderType(Collections.emptyList(), false);
|
||||
}
|
||||
|
||||
return FunctionTypesKt.createFunctionType(
|
||||
builtIns, Annotations.Companion.getEMPTY(), null, Collections.<KotlinType>emptyList(), null, TypeUtils.DONT_CARE
|
||||
builtIns, Annotations.Companion.getEMPTY(), null, Collections.emptyList(), null, TypeUtils.DONT_CARE
|
||||
);
|
||||
}
|
||||
|
||||
@@ -308,10 +308,9 @@ public class ArgumentTypeResolver {
|
||||
boolean isFunctionLiteral = function instanceof KtFunctionLiteral;
|
||||
if (function.getValueParameterList() == null && isFunctionLiteral) {
|
||||
return expectedTypeIsUnknown
|
||||
? functionPlaceholders
|
||||
.createFunctionPlaceholderType(Collections.<KotlinType>emptyList(), /* hasDeclaredArguments = */ false)
|
||||
? functionPlaceholders.createFunctionPlaceholderType(Collections.emptyList(), /* hasDeclaredArguments = */ false)
|
||||
: FunctionTypesKt.createFunctionType(
|
||||
builtIns, Annotations.Companion.getEMPTY(), null, Collections.<KotlinType>emptyList(), null, DONT_CARE
|
||||
builtIns, Annotations.Companion.getEMPTY(), null, Collections.emptyList(), null, DONT_CARE
|
||||
);
|
||||
}
|
||||
List<KtParameter> valueParameters = function.getValueParameters();
|
||||
|
||||
+3
-9
@@ -127,23 +127,17 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements MutableRe
|
||||
|
||||
@NotNull
|
||||
private static Map<ValueParameterDescriptor, ResolvedValueArgument> createValueArgumentsMap(CallableDescriptor descriptor) {
|
||||
return descriptor.getValueParameters().isEmpty()
|
||||
? Collections.<ValueParameterDescriptor, ResolvedValueArgument>emptyMap()
|
||||
: Maps.<ValueParameterDescriptor, ResolvedValueArgument>newLinkedHashMap();
|
||||
return descriptor.getValueParameters().isEmpty() ? Collections.emptyMap() : Maps.newLinkedHashMap();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Map<ValueArgument, ArgumentMatchImpl> createArgumentsToParameterMap(CallableDescriptor descriptor) {
|
||||
return descriptor.getValueParameters().isEmpty()
|
||||
? Collections.<ValueArgument, ArgumentMatchImpl>emptyMap()
|
||||
: Maps.<ValueArgument, ArgumentMatchImpl>newHashMap();
|
||||
return descriptor.getValueParameters().isEmpty() ? Collections.emptyMap() : Maps.newHashMap();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Map<TypeParameterDescriptor, KotlinType> createTypeArgumentsMap(CallableDescriptor descriptor) {
|
||||
return descriptor.getTypeParameters().isEmpty()
|
||||
? Collections.<TypeParameterDescriptor, KotlinType>emptyMap()
|
||||
: Maps.<TypeParameterDescriptor, KotlinType>newLinkedHashMap();
|
||||
return descriptor.getTypeParameters().isEmpty() ? Collections.emptyMap() : Maps.newLinkedHashMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public class OverloadResolutionResultsImpl<D extends CallableDescriptor> impleme
|
||||
public static <D extends CallableDescriptor> OverloadResolutionResultsImpl<D> nameNotFound() {
|
||||
OverloadResolutionResultsImpl<D> results = new OverloadResolutionResultsImpl<>(
|
||||
Code.NAME_NOT_FOUND, Collections.<MutableResolvedCall<D>>emptyList());
|
||||
results.setAllCandidates(Collections.<ResolvedCall<D>>emptyList());
|
||||
results.setAllCandidates(Collections.emptyList());
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ public class CallMaker {
|
||||
|
||||
@NotNull
|
||||
public static Call makeCall(@NotNull ReceiverValue baseAsReceiver, KtUnaryExpression expression) {
|
||||
return makeCall(expression, baseAsReceiver, null, expression.getOperationReference(), Collections.<ValueArgument>emptyList());
|
||||
return makeCall(expression, baseAsReceiver, null, expression.getOperationReference(), Collections.emptyList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -277,7 +277,7 @@ public class CallMaker {
|
||||
|
||||
@NotNull
|
||||
public static Call makePropertyCall(@Nullable Receiver explicitReceiver, @Nullable ASTNode callOperationNode, @NotNull KtSimpleNameExpression nameExpression) {
|
||||
return makeCallWithExpressions(nameExpression, explicitReceiver, callOperationNode, nameExpression, Collections.<KtExpression>emptyList());
|
||||
return makeCallWithExpressions(nameExpression, explicitReceiver, callOperationNode, nameExpression, Collections.emptyList());
|
||||
}
|
||||
|
||||
|
||||
@@ -446,6 +446,6 @@ public class CallMaker {
|
||||
|
||||
@NotNull
|
||||
public static Call makeCall(@NotNull KtElement callElement, @NotNull ReceiverValue explicitReceiver) {
|
||||
return new CallImpl(callElement, explicitReceiver, null, null, Collections.<ValueArgument>emptyList());
|
||||
return new CallImpl(callElement, explicitReceiver, null, null, Collections.emptyList());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -40,7 +39,7 @@ import static org.jetbrains.kotlin.diagnostics.Errors.*;
|
||||
|
||||
public class CompileTimeConstantChecker {
|
||||
private static final Set<DiagnosticFactory<?>> errorsThatDependOnExpectedType =
|
||||
Sets.<DiagnosticFactory<?>>newHashSet(CONSTANT_EXPECTED_TYPE_MISMATCH, NULL_FOR_NONNULL_TYPE);
|
||||
Sets.newHashSet(CONSTANT_EXPECTED_TYPE_MISMATCH, NULL_FOR_NONNULL_TYPE);
|
||||
|
||||
private final KotlinBuiltIns builtIns;
|
||||
private final BindingTrace trace;
|
||||
|
||||
@@ -171,7 +171,7 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<PackageFragmentDescriptor> getPackageFragments(@NotNull FqName fqName) {
|
||||
return ContainerUtil.<PackageFragmentDescriptor>createMaybeSingletonList(getPackageFragment(fqName));
|
||||
return ContainerUtil.createMaybeSingletonList(getPackageFragment(fqName));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -339,7 +339,7 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext {
|
||||
LazyPackageDescriptor rootPackage = getPackageFragment(FqName.ROOT);
|
||||
assert rootPackage != null : "Root package must be initialized";
|
||||
|
||||
return collectAllPackages(Lists.<LazyPackageDescriptor>newArrayList(), rootPackage);
|
||||
return collectAllPackages(Lists.newArrayList(), rootPackage);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ public abstract class KtClassOrObjectInfo<E extends KtClassOrObject> implements
|
||||
@Override
|
||||
public List<KtAnnotationEntry> getDanglingAnnotations() {
|
||||
KtClassBody body = element.getBody();
|
||||
return body == null ? Collections.<KtAnnotationEntry>emptyList() : body.getDanglingAnnotations();
|
||||
return body == null ? Collections.emptyList() : body.getDanglingAnnotations();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-2
@@ -26,8 +26,7 @@ import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
import java.util.Collections;
|
||||
|
||||
public interface DeclarationProviderFactory {
|
||||
DeclarationProviderFactory EMPTY =
|
||||
new FileBasedDeclarationProviderFactory(LockBasedStorageManager.NO_LOCKS, Collections.<KtFile>emptyList());
|
||||
DeclarationProviderFactory EMPTY = new FileBasedDeclarationProviderFactory(LockBasedStorageManager.NO_LOCKS, Collections.emptyList());
|
||||
|
||||
@NotNull
|
||||
ClassMemberDeclarationProvider getClassMemberDeclarationProvider(@NotNull KtClassLikeInfo classLikeInfo);
|
||||
|
||||
+3
-5
@@ -270,7 +270,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE
|
||||
) {
|
||||
{
|
||||
initialize(null, null, Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(),
|
||||
initialize(null, null, Collections.emptyList(), Collections.emptyList(),
|
||||
null, Modality.FINAL, Visibilities.PRIVATE);
|
||||
}
|
||||
|
||||
@@ -665,13 +665,11 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
|
||||
KtClassOrObject classOrObject = declarationProvider.getOwnerInfo().getCorrespondingClassOrObject();
|
||||
if (classOrObject == null) {
|
||||
return Collections.<KotlinType>singleton(c.getModuleDescriptor().getBuiltIns().getAnyType());
|
||||
return Collections.singleton(c.getModuleDescriptor().getBuiltIns().getAnyType());
|
||||
}
|
||||
|
||||
List<KotlinType> allSupertypes =
|
||||
c.getDescriptorResolver()
|
||||
.resolveSupertypes(getScopeForClassHeaderResolution(), this, classOrObject,
|
||||
c.getTrace());
|
||||
c.getDescriptorResolver().resolveSupertypes(getScopeForClassHeaderResolution(), this, classOrObject, c.getTrace());
|
||||
|
||||
return new ArrayList<>(CollectionsKt.filter(allSupertypes, VALID_SUPERTYPE));
|
||||
}
|
||||
|
||||
+1
-2
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.resolve.lazy.descriptors;
|
||||
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.SupertypeLoopChecker;
|
||||
import org.jetbrains.kotlin.descriptors.impl.AbstractLazyTypeParameterDescriptor;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
@@ -93,7 +92,7 @@ public class LazyTypeParameterDescriptor extends AbstractLazyTypeParameterDescri
|
||||
return CollectionsKt.plus(
|
||||
typeParameter.getExtendsBound() != null
|
||||
? Collections.singletonList(typeParameter.getExtendsBound())
|
||||
: Collections.<KtTypeReference>emptyList(),
|
||||
: Collections.emptyList(),
|
||||
getUpperBoundsFromWhereClause()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public class TypeIntersector {
|
||||
return KotlinTypeFactory.simpleType(
|
||||
Annotations.Companion.getEMPTY(),
|
||||
constructor,
|
||||
Collections.<TypeProjection>emptyList(),
|
||||
Collections.emptyList(),
|
||||
allNullable,
|
||||
constructor.createScopeForKotlinType()
|
||||
);
|
||||
|
||||
+1
-1
@@ -667,7 +667,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
KtExpression expression
|
||||
) {
|
||||
BindingTrace trace = context.trace;
|
||||
Call call = CallMaker.makeCall(expression, null, null, expression, Collections.<ValueArgument>emptyList());
|
||||
Call call = CallMaker.makeCall(expression, null, null, expression, Collections.emptyList());
|
||||
ResolutionCandidate<ReceiverParameterDescriptor> resolutionCandidate =
|
||||
ResolutionCandidate.create(
|
||||
call, descriptor, null, ExplicitReceiverKind.NO_EXPLICIT_RECEIVER, null);
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ public class ControlStructureTypingUtils {
|
||||
TracingStrategy tracing = createTracingForSpecialConstruction(call, construct.getName(), context);
|
||||
TypeSubstitutor knownTypeParameterSubstitutor = createKnownTypeParameterSubstitutorForSpecialCall(construct, function, context.expectedType);
|
||||
ResolutionCandidate<FunctionDescriptor> resolutionCandidate =
|
||||
ResolutionCandidate.<FunctionDescriptor>create(call, function, knownTypeParameterSubstitutor);
|
||||
ResolutionCandidate.create(call, function, knownTypeParameterSubstitutor);
|
||||
OverloadResolutionResults<FunctionDescriptor> results = callResolver.resolveCallWithKnownCandidate(
|
||||
call, tracing, context, resolutionCandidate, dataFlowInfoForArguments);
|
||||
assert results.isSingleResult() : "Not single result after resolving one known candidate";
|
||||
|
||||
+1
-3
@@ -304,9 +304,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
|
||||
newOuterLoops.add(loopExpression);
|
||||
return super.visitLoopExpression(loopExpression, newOuterLoops);
|
||||
}
|
||||
}, expression instanceof KtLoopExpression
|
||||
? Lists.newArrayList((KtLoopExpression) expression)
|
||||
: Lists.<KtLoopExpression>newArrayList());
|
||||
}, expression instanceof KtLoopExpression ? Lists.newArrayList((KtLoopExpression) expression) : Lists.newArrayList());
|
||||
|
||||
return result[0];
|
||||
}
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ public class ForLoopConventionsChecker {
|
||||
// Make a fake call loopRange.iterator(), and try to resolve it
|
||||
OverloadResolutionResults<FunctionDescriptor> iteratorResolutionResults = fakeCallResolver.resolveFakeCall(
|
||||
context, loopRange, OperatorNameConventions.ITERATOR, loopRangeExpression,
|
||||
loopRangeExpression, FakeCallKind.ITERATOR, Collections.<KtExpression>emptyList()
|
||||
loopRangeExpression, FakeCallKind.ITERATOR, Collections.emptyList()
|
||||
);
|
||||
if (!iteratorResolutionResults.isSuccess()) return null;
|
||||
|
||||
@@ -108,7 +108,7 @@ public class ForLoopConventionsChecker {
|
||||
) {
|
||||
OverloadResolutionResults<FunctionDescriptor> nextResolutionResults = fakeCallResolver.resolveFakeCall(
|
||||
context, new TransientReceiver(iteratorType), name, loopRangeExpression, loopRangeExpression, FakeCallKind.OTHER,
|
||||
Collections.<KtExpression>emptyList()
|
||||
Collections.emptyList()
|
||||
);
|
||||
if (nextResolutionResults.isAmbiguity()) {
|
||||
context.trace.report(ambiguity.on(loopRangeExpression, iteratorType));
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ public class OperatorConventions {
|
||||
ImmutableSet.of(KtTokens.EQEQEQ, KtTokens.EXCLEQEQEQ);
|
||||
|
||||
public static final ImmutableSet<KtSingleValueToken> IN_OPERATIONS =
|
||||
ImmutableSet.<KtSingleValueToken>of(KtTokens.IN_KEYWORD, KtTokens.NOT_IN);
|
||||
ImmutableSet.of(KtTokens.IN_KEYWORD, KtTokens.NOT_IN);
|
||||
|
||||
public static final ImmutableBiMap<KtSingleValueToken, Name> ASSIGNMENT_OPERATIONS = ImmutableBiMap.<KtSingleValueToken, Name>builder()
|
||||
.put(KtTokens.MULTEQ, TIMES_ASSIGN)
|
||||
|
||||
+1
-2
@@ -20,11 +20,10 @@ import java.io.PrintStream;
|
||||
import java.util.Collections;
|
||||
|
||||
public abstract class InterceptionInstrumenterAdaptor implements Instrumenter {
|
||||
|
||||
private final InterceptionInstrumenter instrumenter;
|
||||
|
||||
public InterceptionInstrumenterAdaptor() {
|
||||
this.instrumenter = new InterceptionInstrumenter(Collections.<Class<?>>singletonList(getClass()));
|
||||
this.instrumenter = new InterceptionInstrumenter(Collections.singletonList(getClass()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -106,7 +106,7 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest
|
||||
CompilerConfiguration configuration =
|
||||
createConfiguration(ConfigurationKind.ALL, getJdkKind(files),
|
||||
Collections.singletonList(KotlinTestUtils.getAnnotationsJar()),
|
||||
Collections.<File>emptyList(), Collections.singletonList(testFile));
|
||||
Collections.emptyList(), Collections.singletonList(testFile));
|
||||
|
||||
KotlinCoreEnvironment environment = KotlinCoreEnvironment.createForTests(
|
||||
compileDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
@@ -119,7 +119,7 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest
|
||||
CompilerConfiguration configurationWithADirInClasspath =
|
||||
createConfiguration(ConfigurationKind.ALL, getJdkKind(files),
|
||||
Lists.newArrayList(KotlinTestUtils.getAnnotationsJar(), aDir),
|
||||
Collections.<File>emptyList(), Collections.singletonList(testFile));
|
||||
Collections.emptyList(), Collections.singletonList(testFile));
|
||||
|
||||
Disposable compileDisposable = createDisposable("compileB");
|
||||
KotlinCoreEnvironment environment = KotlinCoreEnvironment.createForTests(
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public abstract class AbstractTopLevelMembersInvocationTest extends AbstractByte
|
||||
File library = new File(root, LIBRARY);
|
||||
List<File> classPath = library.exists() ?
|
||||
Collections.singletonList(MockLibraryUtil.compileLibraryToJar(library.getPath(), LIBRARY, false, false)) :
|
||||
Collections.<File>emptyList();
|
||||
Collections.emptyList();
|
||||
|
||||
assert !sourceFiles.isEmpty() : getTestName(true) + " should contain at least one .kt file";
|
||||
Collections.sort(sourceFiles);
|
||||
|
||||
@@ -89,7 +89,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
@NotNull ConfigurationKind configurationKind,
|
||||
@Nullable File... javaSourceRoots
|
||||
) {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(configurationKind, Collections.<TestFile>emptyList(), javaSourceRoots);
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(configurationKind, Collections.emptyList(), javaSourceRoots);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -79,7 +79,7 @@ public class CodegenTestFiles {
|
||||
@NotNull
|
||||
public static CodegenTestFiles create(@NotNull List<KtFile> ktFiles) {
|
||||
assert !ktFiles.isEmpty() : "List should have at least one file";
|
||||
return new CodegenTestFiles(ktFiles, Collections.<Pair<String, String>>emptyList(), Collections.emptyList());
|
||||
return new CodegenTestFiles(ktFiles, Collections.emptyList(), Collections.emptyList());
|
||||
}
|
||||
|
||||
public static CodegenTestFiles create(Project project, String[] names) {
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public abstract class AbstractWriteFlagsTest extends CodegenTestCase {
|
||||
protected void doMultiFileTest(
|
||||
@NotNull File wholeFile, @NotNull List<TestFile> files, @Nullable File javaFilesDir
|
||||
) throws Exception {
|
||||
compile(files, null, ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, Collections.<String>emptyList());
|
||||
compile(files, null, ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, Collections.emptyList());
|
||||
|
||||
String fileText = FileUtil.loadFile(wholeFile, true);
|
||||
|
||||
|
||||
+5
-7
@@ -42,7 +42,6 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment;
|
||||
import org.jetbrains.kotlin.types.TypeProjection;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -173,7 +172,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends KotlinTest
|
||||
@NotNull
|
||||
private static FunctionDescriptor getFunctionDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
||||
Name functionName = Name.identifier(name);
|
||||
MemberScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||
MemberScope memberScope = classDescriptor.getMemberScope(Collections.emptyList());
|
||||
Collection<SimpleFunctionDescriptor> functions = memberScope.getContributedFunctions(functionName, NoLookupLocation.FROM_TEST);
|
||||
assert functions.size() == 1 : "Failed to find function " + functionName + " in class" + "." + classDescriptor.getName();
|
||||
return functions.iterator().next();
|
||||
@@ -187,9 +186,8 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends KotlinTest
|
||||
if (properties.isEmpty()) {
|
||||
for (DeclarationDescriptor descriptor : DescriptorUtils.getAllDescriptors(memberScope)) {
|
||||
if (descriptor instanceof ClassDescriptor) {
|
||||
Collection<PropertyDescriptor> classProperties =
|
||||
((ClassDescriptor) descriptor).getMemberScope(Collections.<TypeProjection>emptyList())
|
||||
.getContributedVariables(propertyName, NoLookupLocation.FROM_TEST);
|
||||
Collection<PropertyDescriptor> classProperties = ((ClassDescriptor) descriptor).getMemberScope(Collections.emptyList())
|
||||
.getContributedVariables(propertyName, NoLookupLocation.FROM_TEST);
|
||||
if (!classProperties.isEmpty()) {
|
||||
properties = classProperties;
|
||||
break;
|
||||
@@ -209,7 +207,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends KotlinTest
|
||||
@NotNull
|
||||
private static PropertyDescriptor getPropertyDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
||||
Name propertyName = Name.identifier(name);
|
||||
MemberScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||
MemberScope memberScope = classDescriptor.getMemberScope(Collections.emptyList());
|
||||
Collection<PropertyDescriptor> properties = memberScope.getContributedVariables(propertyName, NoLookupLocation.FROM_TEST);
|
||||
assert properties.size() == 1 : "Failed to find property " + propertyName + " in class " + classDescriptor.getName();
|
||||
return properties.iterator().next();
|
||||
@@ -227,7 +225,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends KotlinTest
|
||||
@NotNull
|
||||
private static ClassDescriptor getInnerClassDescriptor(@NotNull ClassDescriptor classDescriptor, @NotNull String name) {
|
||||
Name propertyName = Name.identifier(name);
|
||||
MemberScope memberScope = classDescriptor.getMemberScope(Collections.<TypeProjection>emptyList());
|
||||
MemberScope memberScope = classDescriptor.getMemberScope(Collections.emptyList());
|
||||
ClassifierDescriptor innerClass = memberScope.getContributedClassifier(propertyName, NoLookupLocation.FROM_TEST);
|
||||
assert innerClass instanceof ClassDescriptor : "Failed to find inner class " +
|
||||
propertyName +
|
||||
|
||||
@@ -437,7 +437,7 @@ public class KotlinTestUtils {
|
||||
@NotNull TestJdkKind jdkKind,
|
||||
@NotNull File... extraClasspath
|
||||
) {
|
||||
return newConfiguration(configurationKind, jdkKind, Arrays.asList(extraClasspath), Collections.<File>emptyList());
|
||||
return newConfiguration(configurationKind, jdkKind, Arrays.asList(extraClasspath), Collections.emptyList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -636,7 +636,7 @@ public class KotlinTestUtils {
|
||||
}
|
||||
|
||||
if (isDirectiveDefined(expectedText, "WITH_COROUTINES")) {
|
||||
M supportModule = hasModules ? factory.createModule("support", Collections.<String>emptyList()) : null;
|
||||
M supportModule = hasModules ? factory.createModule("support", Collections.emptyList()) : null;
|
||||
testFiles.add(factory.createFile(supportModule,
|
||||
"CoroutineUtil.kt",
|
||||
"import kotlin.coroutines.experimental.*\n" +
|
||||
|
||||
+3
-3
@@ -128,18 +128,18 @@ public class RecursiveDescriptorComparator {
|
||||
if (!DescriptorUtils.getAllDescriptors(staticScope).isEmpty()) {
|
||||
printer.println();
|
||||
printer.println("// Static members");
|
||||
appendSubDescriptors(descriptor, module, staticScope, Collections.<DeclarationDescriptor>emptyList(), printer);
|
||||
appendSubDescriptors(descriptor, module, staticScope, Collections.emptyList(), printer);
|
||||
}
|
||||
}
|
||||
else if (descriptor instanceof PackageFragmentDescriptor) {
|
||||
appendSubDescriptors(descriptor, module,
|
||||
((PackageFragmentDescriptor) descriptor).getMemberScope(),
|
||||
Collections.<DeclarationDescriptor>emptyList(), printer);
|
||||
Collections.emptyList(), printer);
|
||||
}
|
||||
else if (descriptor instanceof PackageViewDescriptor) {
|
||||
appendSubDescriptors(descriptor, module,
|
||||
getPackageScopeInModule((PackageViewDescriptor) descriptor, module),
|
||||
Collections.<DeclarationDescriptor>emptyList(), printer);
|
||||
Collections.emptyList(), printer);
|
||||
}
|
||||
|
||||
if (!topLevel) {
|
||||
|
||||
@@ -66,8 +66,8 @@ public class GenerateNotNullAssertionsTest extends CodegenTestCase {
|
||||
private File compileJava0(@NotNull String fileName) {
|
||||
return CodegenTestUtil.compileJava(
|
||||
Collections.singletonList(KotlinTestUtils.getTestDataPathBase() + "/codegen/" + getPrefix() + "/" + fileName),
|
||||
Collections.<String>emptyList(),
|
||||
Collections.<String>emptyList()
|
||||
Collections.emptyList(),
|
||||
Collections.emptyList()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -157,8 +157,8 @@ public class OuterClassGenTest extends CodegenTestCase {
|
||||
private void doTest(@NotNull String classFqName, @NotNull String javaClassName, @NotNull String testDataFile) throws Exception {
|
||||
File javaOut = CodegenTestUtil.compileJava(
|
||||
Collections.singletonList(KotlinTestUtils.getTestDataPathBase() + "/codegen/" + getPrefix() + "/" + testDataFile + ".java"),
|
||||
Collections.<String>emptyList(),
|
||||
Collections.<String>emptyList()
|
||||
Collections.emptyList(),
|
||||
Collections.emptyList()
|
||||
);
|
||||
|
||||
String javaClassPath = javaClassName.replace('.', File.separatorChar) + ".class";
|
||||
|
||||
+4
-4
@@ -90,7 +90,7 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
|
||||
|
||||
@NotNull
|
||||
private File compileLibrary(@NotNull String sourcePath, @NotNull File... extraClassPath) {
|
||||
return compileLibrary(sourcePath, Collections.<String>emptyList(), extraClassPath);
|
||||
return compileLibrary(sourcePath, Collections.emptyList(), extraClassPath);
|
||||
}
|
||||
|
||||
private File compileLibrary(@NotNull String sourcePath, List<String> additionalOptions, @NotNull File... extraClassPath) {
|
||||
@@ -212,7 +212,7 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
|
||||
@NotNull File output,
|
||||
@NotNull File... classpath
|
||||
) {
|
||||
return compileKotlin(fileName, output, Collections.<String>emptyList(), classpath);
|
||||
return compileKotlin(fileName, output, Collections.emptyList(), classpath);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -301,7 +301,7 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
|
||||
}
|
||||
|
||||
private void doTestKotlinLibraryWithWrongMetadataVersionJs(@NotNull String libraryName, @NotNull String... additionalOptions) {
|
||||
compileLibrary(new K2JSCompiler(), libraryName, new File(tmpdir, "library.js"), Collections.<String>emptyList());
|
||||
compileLibrary(new K2JSCompiler(), libraryName, new File(tmpdir, "library.js"), Collections.emptyList());
|
||||
|
||||
File library = new File(tmpdir, "library.meta.js");
|
||||
FilesKt.writeText(library, FilesKt.readText(library, Charsets.UTF_8).replace(
|
||||
@@ -327,7 +327,7 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
|
||||
|
||||
try {
|
||||
System.setProperty(TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY, "true");
|
||||
compileLibrary(compiler, libraryName, destination, Collections.<String>emptyList());
|
||||
compileLibrary(compiler, libraryName, destination, Collections.emptyList());
|
||||
}
|
||||
finally {
|
||||
System.clearProperty(TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY);
|
||||
|
||||
+3
-3
@@ -139,9 +139,9 @@ public class SimpleTestClassModel implements TestClassModel {
|
||||
public Collection<MethodModel> getMethods() {
|
||||
if (testMethods == null) {
|
||||
if (!rootFile.isDirectory()) {
|
||||
testMethods = Collections.<MethodModel>singletonList(new SimpleTestMethodModel(rootFile, rootFile, doTestMethodName,
|
||||
filenamePattern, checkFilenameStartsLowerCase,
|
||||
targetBackend));
|
||||
testMethods = Collections.singletonList(new SimpleTestMethodModel(
|
||||
rootFile, rootFile, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend
|
||||
));
|
||||
}
|
||||
else {
|
||||
List<MethodModel> result = Lists.newArrayList();
|
||||
|
||||
+5
-5
@@ -88,17 +88,17 @@ public class SingleClassTestModel implements TestClassModel {
|
||||
|
||||
ContainerUtil.sort(result, (o1, o2) -> StringUtil.compare(o1.getName(), o2.getName(), true));
|
||||
|
||||
methods = Lists.<MethodModel>newArrayList(result);
|
||||
methods = Lists.newArrayList(result);
|
||||
}
|
||||
|
||||
return methods;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Collection<TestMethodModel> getTestMethodsFromFile(File file) {
|
||||
return Collections.<TestMethodModel>singletonList(new SimpleTestMethodModel(rootFile, file, doTestMethodName,
|
||||
filenamePattern, checkFilenameStartsLowerCase,
|
||||
targetBackend));
|
||||
private Collection<TestMethodModel> getTestMethodsFromFile(File file) {
|
||||
return Collections.singletonList(new SimpleTestMethodModel(
|
||||
rootFile, file, doTestMethodName, filenamePattern, checkFilenameStartsLowerCase, targetBackend
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -125,7 +125,7 @@ public final class RhinoUtils {
|
||||
@Nullable Map<String, Object> variables,
|
||||
@NotNull EcmaVersion ecmaVersion)
|
||||
throws Exception {
|
||||
runRhinoTest(fileNames, checker, variables, ecmaVersion, Collections.<String>emptyList());
|
||||
runRhinoTest(fileNames, checker, variables, ecmaVersion, Collections.emptyList());
|
||||
}
|
||||
|
||||
public static void runRhinoTest(@NotNull List<String> fileNames,
|
||||
|
||||
@@ -35,12 +35,12 @@ public class CallCounter extends RecursiveJsVisitor {
|
||||
|
||||
@NotNull
|
||||
public static CallCounter countCalls(@NotNull JsNode node) {
|
||||
return countCalls(node, Collections.<String>emptySet());
|
||||
return countCalls(node, Collections.emptySet());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static CallCounter countCalls(@NotNull JsNode node, @NotNull Set<String> exceptFunctionNames) {
|
||||
CallCounter visitor = new CallCounter(new HashSet<>(exceptFunctionNames), Collections.<String>emptySet());
|
||||
CallCounter visitor = new CallCounter(new HashSet<>(exceptFunctionNames), Collections.emptySet());
|
||||
node.accept(visitor);
|
||||
|
||||
return visitor;
|
||||
@@ -48,7 +48,7 @@ public class CallCounter extends RecursiveJsVisitor {
|
||||
|
||||
@NotNull
|
||||
public static CallCounter countCallsWithExcludedScopes(@NotNull JsNode node, @NotNull Set<String> exceptScopes) {
|
||||
CallCounter visitor = new CallCounter(Collections.<String>emptySet(), new HashSet<>(exceptScopes));
|
||||
CallCounter visitor = new CallCounter(Collections.emptySet(), new HashSet<>(exceptScopes));
|
||||
node.accept(visitor);
|
||||
|
||||
return visitor;
|
||||
|
||||
@@ -335,7 +335,7 @@ public class DirectiveTestUtils {
|
||||
|
||||
public static void checkFunctionNotCalled(@NotNull JsNode node, @NotNull String functionName, @Nullable String exceptFunction)
|
||||
throws Exception {
|
||||
Set<String> excludedScopes = exceptFunction != null ? Collections.singleton(exceptFunction) : Collections.<String>emptySet();
|
||||
Set<String> excludedScopes = exceptFunction != null ? Collections.singleton(exceptFunction) : Collections.emptySet();
|
||||
|
||||
CallCounter counter = CallCounter.countCallsWithExcludedScopes(node, excludedScopes);
|
||||
int functionCalledCount = counter.getQualifiedCallsCount(functionName);
|
||||
|
||||
@@ -300,7 +300,7 @@ public final class Namer {
|
||||
@Nullable JsExpression argument,
|
||||
@NotNull TypeCheck metadata
|
||||
) {
|
||||
List<JsExpression> arguments = argument != null ? Collections.singletonList(argument) : Collections.<JsExpression>emptyList();
|
||||
List<JsExpression> arguments = argument != null ? Collections.singletonList(argument) : Collections.emptyList();
|
||||
return invokeFunctionAndSetTypeCheckMetadata(functionName, arguments, metadata);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ public final class ClassInitializerTranslator extends AbstractTranslator {
|
||||
|
||||
private void mayBeAddCallToSuperMethod(JsFunction initializer) {
|
||||
if (classDeclaration.hasModifier(KtTokens.ENUM_KEYWORD)) {
|
||||
addCallToSuperMethod(Collections.<JsExpression>emptyList(), initializer);
|
||||
addCallToSuperMethod(Collections.emptyList(), initializer);
|
||||
}
|
||||
else if (hasAncestorClass(bindingContext(), classDeclaration)) {
|
||||
ResolvedCall<FunctionDescriptor> superCall = getSuperCall(bindingContext(), classDeclaration);
|
||||
|
||||
+1
-1
@@ -314,7 +314,7 @@ public enum PrimitiveBinaryOperationFIF implements FunctionIntrinsicFactory {
|
||||
@NotNull
|
||||
@Override
|
||||
public JsExpression doApply(@NotNull JsExpression left, @NotNull JsExpression right, @NotNull TranslationContext context) {
|
||||
return functionIntrinsic.doApply(left, TopLevelFIF.TO_STRING.apply(right, Collections.<JsExpression>emptyList(), context), context);
|
||||
return functionIntrinsic.doApply(left, TopLevelFIF.TO_STRING.apply(right, Collections.emptyList(), context), context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -29,7 +29,6 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
|
||||
public final class IntrinsicIncrementTranslator extends IncrementTranslator {
|
||||
@NotNull
|
||||
private final ResolvedCall<? extends FunctionDescriptor> resolvedCall;
|
||||
@@ -44,6 +43,6 @@ public final class IntrinsicIncrementTranslator extends IncrementTranslator {
|
||||
protected JsExpression operationExpression(@NotNull TranslationContext context, @NotNull JsExpression receiver) {
|
||||
FunctionIntrinsic intrinsic = context.intrinsics().getFunctionIntrinsic(resolvedCall.getResultingDescriptor());
|
||||
CallInfo callInfo = CallInfoKt.getCallInfo(context, resolvedCall, receiver);
|
||||
return intrinsic.apply(callInfo, Collections.<JsExpression>emptyList(), context);
|
||||
return intrinsic.apply(callInfo, Collections.emptyList(), context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.js.translate.test;
|
||||
|
||||
import org.jetbrains.kotlin.js.backend.ast.JsExpression;
|
||||
import org.jetbrains.kotlin.js.backend.ast.JsNew;
|
||||
import org.jetbrains.kotlin.js.backend.ast.JsStringLiteral;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.kotlin.js.backend.ast.JsExpression;
|
||||
import org.jetbrains.kotlin.js.backend.ast.JsNew;
|
||||
import org.jetbrains.kotlin.js.backend.ast.JsStringLiteral;
|
||||
import org.jetbrains.kotlin.js.translate.callTranslator.CallTranslator;
|
||||
import org.jetbrains.kotlin.js.translate.context.TranslationContext;
|
||||
import org.jetbrains.kotlin.js.translate.general.JetTestFunctionDetector;
|
||||
@@ -60,8 +60,8 @@ public final class JSTestGenerator {
|
||||
@NotNull ClassDescriptor classDescriptor, @NotNull JSTester tester) {
|
||||
JsExpression expression = ReferenceTranslator.translateAsValueReference(classDescriptor, context);
|
||||
JsNew testClass = new JsNew(expression);
|
||||
JsExpression functionToTestCall = CallTranslator.INSTANCE.buildCall(context, functionDescriptor,
|
||||
Collections.<JsExpression>emptyList(), testClass);
|
||||
JsExpression functionToTestCall =
|
||||
CallTranslator.INSTANCE.buildCall(context, functionDescriptor, Collections.emptyList(), testClass);
|
||||
JsStringLiteral testName = context.program().getStringLiteral(classDescriptor.getName() + "." + functionDescriptor.getName());
|
||||
tester.constructTestMethodInvocation(functionToTestCall, testName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user