From 0fad8a66f43d89f0b34ad423f4b96b1bae327394 Mon Sep 17 00:00:00 2001 From: Alex Tkachman Date: Thu, 23 Aug 2012 14:38:11 +0300 Subject: [PATCH] weaken access as suggested by IDEA --- .../jet/cli/jvm/compiler/TipsManager.java | 29 +++++++++++-------- .../jet/codegen/ClosureAnnotator.java | 2 +- .../jetbrains/jet/codegen/CodegenContext.java | 3 +- .../codegen/ImplementationBodyCodegen.java | 4 +-- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/jet/cli/jvm/compiler/TipsManager.java b/compiler/backend/src/org/jetbrains/jet/cli/jvm/compiler/TipsManager.java index d1040cbefc1..e5252f6b26d 100644 --- a/compiler/backend/src/org/jetbrains/jet/cli/jvm/compiler/TipsManager.java +++ b/compiler/backend/src/org/jetbrains/jet/cli/jvm/compiler/TipsManager.java @@ -103,7 +103,7 @@ public final class TipsManager { else { Collection descriptorsSet = Sets.newHashSet(); - ArrayList result = new ArrayList(); + List result = new ArrayList(); resolutionScope.getImplicitReceiversHierarchy(result); for (ReceiverDescriptor receiverDescriptor : result) { @@ -119,7 +119,10 @@ public final class TipsManager { } @NotNull - public static Collection getPackageReferenceVariants(JetSimpleNameExpression expression, BindingContext context) { + public static Collection getPackageReferenceVariants( + JetSimpleNameExpression expression, + BindingContext context + ) { JetScope resolutionScope = context.get(BindingContext.RESOLUTION_SCOPE, expression); if (resolutionScope != null) { return excludeNonPackageDescriptors(resolutionScope.getAllDescriptors()); @@ -129,7 +132,8 @@ public final class TipsManager { } public static Collection excludePrivateDescriptors( - @NotNull Collection descriptors) { + @NotNull Collection descriptors + ) { return Collections2.filter(descriptors, new Predicate() { @Override @@ -148,7 +152,7 @@ public final class TipsManager { ) { final Set descriptorsSet = Sets.newHashSet(descriptors); - final ArrayList result = new ArrayList(); + final List result = new ArrayList(); scope.getImplicitReceiversHierarchy(result); descriptorsSet.removeAll( @@ -169,9 +173,10 @@ public final class TipsManager { return Lists.newArrayList(descriptorsSet); } - + private static Collection excludeNonPackageDescriptors( - @NotNull Collection descriptors) { + @NotNull Collection descriptors + ) { return Collections2.filter(descriptors, new Predicate() { @Override public boolean apply(DeclarationDescriptor declarationDescriptor) { @@ -195,12 +200,12 @@ public final class TipsManager { descriptorsSet.addAll( Collections2.filter(JetScopeUtils.getAllExtensions(externalScope), - new Predicate() { - @Override - public boolean apply(CallableDescriptor callableDescriptor) { - return ExpressionTypingUtils.checkIsExtensionCallable(receiverDescriptor, callableDescriptor); - } - })); + new Predicate() { + @Override + public boolean apply(CallableDescriptor callableDescriptor) { + return ExpressionTypingUtils.checkIsExtensionCallable(receiverDescriptor, callableDescriptor); + } + })); return descriptorsSet; } diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ClosureAnnotator.java b/compiler/backend/src/org/jetbrains/jet/codegen/ClosureAnnotator.java index 756cd2c1436..aba938743af 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ClosureAnnotator.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ClosureAnnotator.java @@ -173,7 +173,7 @@ public class ClosureAnnotator { jetFile.accept(visitor); } - ArrayList namespaceFiles = new ArrayList(); + Collection namespaceFiles = new ArrayList(); for (JetFile jetFile : entry.getValue()) { Collection fileFunctions = new ArrayList(); for (JetDeclaration declaration : jetFile.getDeclarations()) { diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/CodegenContext.java b/compiler/backend/src/org/jetbrains/jet/codegen/CodegenContext.java index ae16cb82a3f..9c85c8ad0be 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/CodegenContext.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/CodegenContext.java @@ -26,6 +26,7 @@ import org.jetbrains.jet.lang.resolve.java.JvmClassName; import java.util.Collections; import java.util.HashMap; +import java.util.Map; import static org.jetbrains.jet.codegen.JetTypeMapper.TYPE_OBJECT; @@ -223,7 +224,7 @@ public abstract class CodegenContext { public abstract boolean isStatic(); - public void copyAccessors(HashMap accessors) { + public void copyAccessors(Map accessors) { if (accessors != null) { if (this.accessors == null) { this.accessors = new HashMap(); diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java index 368e9c68974..2eb5e27fe8a 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java @@ -607,7 +607,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { ObjectOrClosureCodegen closure = context.closure; int firstSuperArgument = -1; - final LinkedList consArgTypes = + final List consArgTypes = new LinkedList(constructorMethod.getKotlinParameterTypes()); int insert = 0; @@ -737,7 +737,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { Type classType = typeMapper.mapType(descriptor.getDefaultType(), MapTypeMode.IMPL); JvmClassName classname = JvmClassName.byType(classType); - HashSet overridden = new HashSet(); + Collection overridden = new HashSet(); for (JetDeclaration declaration : myClass.getDeclarations()) { if (declaration instanceof JetNamedFunction) { SimpleFunctionDescriptor functionDescriptor = bindingContext.get(BindingContext.FUNCTION, declaration);