weaken declaration access as suggested by IDEA

This commit is contained in:
Alex Tkachman
2012-08-23 14:41:33 +03:00
parent 0fad8a66f4
commit 179597156f
17 changed files with 42 additions and 42 deletions
@@ -131,7 +131,7 @@ public final class TipsManager {
return Collections.emptyList();
}
public static Collection<DeclarationDescriptor> excludePrivateDescriptors(
private static Collection<DeclarationDescriptor> excludePrivateDescriptors(
@NotNull Collection<DeclarationDescriptor> descriptors
) {
@@ -44,10 +44,10 @@ import java.util.Map;
* @author alex.tkachman
*/
public abstract class AnnotationCodegen {
final JetTypeMapper typeMapper;
final BindingContext bindingContext;
private final JetTypeMapper typeMapper;
private final BindingContext bindingContext;
protected AnnotationCodegen(JetTypeMapper mapper) {
private AnnotationCodegen(JetTypeMapper mapper) {
typeMapper = mapper;
bindingContext = typeMapper.bindingContext;
}
@@ -48,7 +48,7 @@ public abstract class ClassBodyCodegen {
protected final List<CodeChunk> staticInitializerChunks = new ArrayList<CodeChunk>();
public ClassBodyCodegen(JetClassOrObject aClass, CodegenContext context, ClassBuilder v, GenerationState state) {
protected ClassBodyCodegen(JetClassOrObject aClass, CodegenContext context, ClassBuilder v, GenerationState state) {
this.state = state;
descriptor = state.getBindingContext().get(BindingContext.CLASS, aClass);
myClass = aClass;
@@ -29,7 +29,7 @@ import java.util.*;
*/
public class ClassFileFactory {
private ClassBuilderFactory builderFactory;
public GenerationState state;
private GenerationState state;
private final Map<FqName, NamespaceCodegen> ns2codegen = new HashMap<FqName, NamespaceCodegen>();
@@ -61,7 +61,7 @@ public class ClosureCodegen extends ObjectOrClosureCodegen {
closureAnnotator = typeMapper.getClosureAnnotator();
}
public static JvmMethodSignature erasedInvokeSignature(FunctionDescriptor fd) {
private static JvmMethodSignature erasedInvokeSignature(FunctionDescriptor fd) {
BothSignatureWriter signatureWriter = new BothSignatureWriter(BothSignatureWriter.Mode.METHOD, false);
@@ -106,7 +106,7 @@ public class ClosureCodegen extends ObjectOrClosureCodegen {
getInternalClassName(fd), receiverParameterType, getInternalClassName(fd).getAsmType());
}
public JvmMethodSignature invokeSignature(FunctionDescriptor fd) {
protected JvmMethodSignature invokeSignature(FunctionDescriptor fd) {
return typeMapper.mapSignature(Name.identifier("invoke"), fd);
}
@@ -91,7 +91,7 @@ public class CodegenContexts {
return "ROOT";
}
};
protected static final StackValue local1 = StackValue.local(1, JetTypeMapper.TYPE_OBJECT);
private static final StackValue local1 = StackValue.local(1, JetTypeMapper.TYPE_OBJECT);
public abstract static class ReceiverContext extends CodegenContext {
final CallableDescriptor receiverDescriptor;
@@ -1287,7 +1287,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
return myFrameMap.getIndex(descriptor);
}
public void invokeFunctionNoParams(FunctionDescriptor functionDescriptor, Type expectedType, InstructionAdapter v) {
protected void invokeFunctionNoParams(FunctionDescriptor functionDescriptor, Type expectedType, InstructionAdapter v) {
DeclarationDescriptor containingDeclaration = functionDescriptor.getOriginal().getContainingDeclaration();
boolean isStatic = containingDeclaration instanceof NamespaceDescriptor;
functionDescriptor = functionDescriptor.getOriginal();
@@ -1449,7 +1449,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
return propertyDescriptor;
}
static boolean isOverrideForTrait(CallableMemberDescriptor propertyDescriptor) {
private static boolean isOverrideForTrait(CallableMemberDescriptor propertyDescriptor) {
if (propertyDescriptor.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
final Set<? extends CallableMemberDescriptor> overriddenDescriptors = propertyDescriptor.getOverriddenDescriptors();
for (CallableMemberDescriptor descriptor : overriddenDescriptors) {
@@ -1632,7 +1632,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
invokeMethodWithArguments(callableMethod, resolvedCall, call, receiver);
}
public void invokeMethodWithArguments(
protected void invokeMethodWithArguments(
@NotNull CallableMethod callableMethod,
@NotNull ResolvedCall<? extends CallableDescriptor> resolvedCall,
@NotNull Call call,
@@ -134,7 +134,7 @@ public class GenerationState {
return Pair.create(className, getFactory().forAnonymousSubclass(className));
}
public NamespaceCodegen forNamespace(FqName fqName, Collection<JetFile> jetFiles) {
protected NamespaceCodegen forNamespace(FqName fqName, Collection<JetFile> jetFiles) {
return getFactory().forNamespace(fqName, jetFiles);
}
@@ -55,7 +55,7 @@ import static org.jetbrains.jet.codegen.JetTypeMapper.TYPE_OBJECT;
* @author alex.tkachman
*/
public class ImplementationBodyCodegen extends ClassBodyCodegen {
public static final String VALUES = "$VALUES";
private static final String VALUES = "$VALUES";
private JetDelegationSpecifier superCall;
private String superClass;
@Nullable // null means java/lang/Object
@@ -1232,7 +1232,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
* Return pairs of descriptors. First is member of this that should be implemented by delegating to trait,
* second is member of trait that contain implementation.
*/
public static List<Pair<CallableMemberDescriptor, CallableMemberDescriptor>> getTraitImplementations(@NotNull ClassDescriptor classDescriptor) {
private static List<Pair<CallableMemberDescriptor, CallableMemberDescriptor>> getTraitImplementations(@NotNull ClassDescriptor classDescriptor) {
List<Pair<CallableMemberDescriptor, CallableMemberDescriptor>> r = Lists.newArrayList();
root:
@@ -64,8 +64,8 @@ public class JetTypeMapper {
public static final Type JL_NUMBER_TYPE = Type.getObjectType("java/lang/Number");
public static final Type JL_STRING_BUILDER = Type.getObjectType("java/lang/StringBuilder");
public static final Type JL_STRING_TYPE = Type.getObjectType("java/lang/String");
public static final Type JL_ENUM_TYPE = Type.getObjectType("java/lang/Enum");
public static final Type JL_CHAR_SEQUENCE_TYPE = Type.getObjectType("java/lang/CharSequence");
private static final Type JL_ENUM_TYPE = Type.getObjectType("java/lang/Enum");
private static final Type JL_CHAR_SEQUENCE_TYPE = Type.getObjectType("java/lang/CharSequence");
private static final Type JL_COMPARABLE_TYPE = Type.getObjectType("java/lang/Comparable");
private static final Type JL_ITERABLE_TYPE = Type.getObjectType("java/lang/Iterable");
private static final Type JL_ITERATOR_TYPE = Type.getObjectType("java/util/Iterator");
@@ -245,7 +245,7 @@ public class JetTypeMapper {
}
}
public static MapTypeMode ownerKindToMapTypeMode(OwnerKind kind) {
private static MapTypeMode ownerKindToMapTypeMode(OwnerKind kind) {
if (kind == OwnerKind.IMPLEMENTATION || kind == OwnerKind.NAMESPACE || kind instanceof OwnerKind.StaticDelegateKind) {
return MapTypeMode.IMPL;
}
@@ -561,7 +561,7 @@ public class JetTypeMapper {
return asmType;
}
public static void writeSimpleType(BothSignatureWriter visitor, Type asmType, boolean nullable) {
private static void writeSimpleType(BothSignatureWriter visitor, Type asmType, boolean nullable) {
visitor.writeAsmType(asmType, nullable);
}
@@ -1081,7 +1081,7 @@ public class JetTypeMapper {
|| className.getFqName().getFqName().equals("java.lang.Comparable");
}
public static boolean isGenericsArray(JetType type) {
private static boolean isGenericsArray(JetType type) {
return JetStandardLibraryNames.ARRAY.is(type) &&
type.getArguments().get(0).getType().getConstructor().getDeclarationDescriptor() instanceof TypeParameterDescriptor;
}
@@ -204,7 +204,7 @@ public class NamespaceCodegen {
return false;
}
public static void checkAllFilesHaveSameNamespace(Collection<JetFile> namespaceFiles) {
private static void checkAllFilesHaveSameNamespace(Collection<JetFile> namespaceFiles) {
FqName commonFqName = null;
for (JetFile file : namespaceFiles) {
FqName fqName = JetPsiUtil.getFQName(file);
@@ -36,7 +36,7 @@ public class ObjectOrClosureCodegen {
protected Type captureReceiver;
public final GenerationState state;
protected final ExpressionCodegen exprContext;
private final ExpressionCodegen exprContext;
protected final CodegenContext context;
protected ClassBuilder cv = null;
public JvmClassName name = null;
@@ -22,7 +22,7 @@ package org.jetbrains.jet.codegen;
public class OwnerKind {
private final String name;
public OwnerKind(String name) {
protected OwnerKind(String name) {
this.name = name;
}
@@ -243,7 +243,7 @@ public class ScriptCodegen {
this.earlierScripts = earlierScriptDescriptors;
}
public int getScriptIndex(@NotNull ScriptDescriptor scriptDescriptor) {
protected int getScriptIndex(@NotNull ScriptDescriptor scriptDescriptor) {
int index = earlierScripts.indexOf(scriptDescriptor);
if (index < 0) {
throw new IllegalStateException("Unregistered script: " + scriptDescriptor);
@@ -45,7 +45,7 @@ public abstract class StackValue {
@NotNull
public final Type type;
public StackValue(@NotNull Type type) {
protected StackValue(@NotNull Type type) {
this.type = type;
}
@@ -75,7 +75,7 @@ public abstract class StackValue {
* @param v the visitor used to generate the instructions
* @param depth the number of new values put onto the stack
*/
public void moveToTopOfStack(Type type, InstructionAdapter v, int depth) {
protected void moveToTopOfStack(Type type, InstructionAdapter v, int depth) {
put(type, v);
}
@@ -231,7 +231,7 @@ public abstract class StackValue {
}
}
protected static void pop(Type type, InstructionAdapter v) {
private static void pop(Type type, InstructionAdapter v) {
if (type.getSize() == 1) {
v.pop();
}
@@ -51,19 +51,19 @@ public class IntrinsicMethods {
private static final IntrinsicMethod DEC = new Increment(-1);
private static final IntrinsicMethod HASH_CODE = new HashCode();
public static final IntrinsicMethod ARRAY_SIZE = new ArraySize();
public static final IntrinsicMethod ARRAY_INDICES = new ArrayIndices();
public static final Equals EQUALS = new Equals();
public static final IdentityEquals IDENTITY_EQUALS = new IdentityEquals();
public static final IteratorNext ITERATOR_NEXT = new IteratorNext();
public static final ArraySet ARRAY_SET = new ArraySet();
public static final ArrayGet ARRAY_GET = new ArrayGet();
public static final StringPlus STRING_PLUS = new StringPlus();
private static final IntrinsicMethod ARRAY_SIZE = new ArraySize();
private static final IntrinsicMethod ARRAY_INDICES = new ArrayIndices();
private static final Equals EQUALS = new Equals();
private static final IdentityEquals IDENTITY_EQUALS = new IdentityEquals();
private static final IteratorNext ITERATOR_NEXT = new IteratorNext();
private static final ArraySet ARRAY_SET = new ArraySet();
private static final ArrayGet ARRAY_GET = new ArrayGet();
private static final StringPlus STRING_PLUS = new StringPlus();
public static final String KOTLIN_JAVA_CLASS_FUNCTION = "kotlin.javaClass.function";
public static final String KOTLIN_ARRAYS_ARRAY = "kotlin.arrays.array";
public static final String KOTLIN_JAVA_CLASS_PROPERTY = "kotlin.javaClass.property";
public static final EnumValues ENUM_VALUES = new EnumValues();
public static final EnumValueOf ENUM_VALUE_OF = new EnumValueOf();
private static final String KOTLIN_JAVA_CLASS_PROPERTY = "kotlin.javaClass.property";
private static final EnumValues ENUM_VALUES = new EnumValues();
private static final EnumValueOf ENUM_VALUE_OF = new EnumValueOf();
private final Map<String, IntrinsicMethod> namedMethods = new HashMap<String, IntrinsicMethod>();
private static final IntrinsicMethod ARRAY_ITERATOR = new ArrayIterator();
@@ -458,7 +458,7 @@ public class BothSignatureWriter {
@NotNull
public Method makeAsmMethod(String name) {
protected Method makeAsmMethod(String name) {
List<Type> jvmParameterTypes = new ArrayList<Type>(kotlinParameterTypes.size());
for (JvmMethodParameterSignature p : kotlinParameterTypes) {
jvmParameterTypes.add(p.getAsmType());
@@ -476,19 +476,19 @@ public class BothSignatureWriter {
}
@NotNull
public List<JvmMethodParameterSignature> makeKotlinParameterTypes() {
protected List<JvmMethodParameterSignature> makeKotlinParameterTypes() {
checkState(State.METHOD_END);
// TODO: return nulls if equal to #makeJavaString
return kotlinParameterTypes;
}
@NotNull
public String makeKotlinReturnTypeSignature() {
protected String makeKotlinReturnTypeSignature() {
checkState(State.METHOD_END);
return kotlinReturnType;
}
public String makeKotlinMethodTypeParameters() {
protected String makeKotlinMethodTypeParameters() {
checkState(State.METHOD_END);
return kotlinClassParameters;
}