From f04e470f03c44082e0d50b7a85181da58b07ee9f Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Wed, 21 Dec 2011 00:34:43 +0400 Subject: [PATCH] rename StdlibNames --- .../jet/codegen/FunctionCodegen.java | 34 +++++++++---------- .../codegen/ImplementationBodyCodegen.java | 8 ++--- .../resolve/java/JavaDescriptorResolver.java | 29 ++++++++-------- .../{StdlibNames.java => JvmStdlibNames.java} | 4 +-- 4 files changed, 37 insertions(+), 38 deletions(-) rename compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/{StdlibNames.java => JvmStdlibNames.java} (95%) diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java index 8ea5e7fd350..43e49fa233b 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java @@ -6,7 +6,7 @@ import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.DescriptorUtils; -import org.jetbrains.jet.lang.resolve.java.StdlibNames; +import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames; import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.Label; @@ -92,48 +92,48 @@ public class FunctionCodegen { if(kind != OwnerKind.TRAIT_IMPL) { AnnotationVisitor av = mv.visitAnnotation(JetTypeMapper.JET_METHOD_TYPE.getDescriptor(), true); if(functionDescriptor.getReturnType().isNullable()) { - av.visit(StdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD, true); + av.visit(JvmStdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD, true); } if (jvmSignature.getKotlinReturnType() != null) { - av.visit(StdlibNames.JET_METHOD_RETURN_TYPE_FIELD, jvmSignature.getKotlinReturnType()); + av.visit(JvmStdlibNames.JET_METHOD_RETURN_TYPE_FIELD, jvmSignature.getKotlinReturnType()); } if (jvmSignature.getKotlinTypeParameter() != null) { - av.visit(StdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD, jvmSignature.getKotlinTypeParameter()); + av.visit(JvmStdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD, jvmSignature.getKotlinTypeParameter()); } av.visitEnd(); } if(kind == OwnerKind.TRAIT_IMPL) { - AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); - av.visit(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$self"); + AnnotationVisitor av = mv.visitParameterAnnotation(start++, JvmStdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$self"); av.visitEnd(); } if(receiverParameter.exists()) { - AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); - av.visit(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$receiver"); + AnnotationVisitor av = mv.visitParameterAnnotation(start++, JvmStdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$receiver"); if(receiverParameter.getType().isNullable()) { - av.visit(StdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD, true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD, true); } - av.visit(StdlibNames.JET_VALUE_PARAMETER_RECEIVER_FIELD, true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_RECEIVER_FIELD, true); av.visitEnd(); } for (final TypeParameterDescriptor typeParameterDescriptor : typeParameters) { - AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_TYPE_PARAMETER.getDescriptor(), true); - av.visit(StdlibNames.JET_TYPE_PARAMETER_NAME_FIELD, typeParameterDescriptor.getName()); + AnnotationVisitor av = mv.visitParameterAnnotation(start++, JvmStdlibNames.JET_TYPE_PARAMETER.getDescriptor(), true); + av.visit(JvmStdlibNames.JET_TYPE_PARAMETER_NAME_FIELD, typeParameterDescriptor.getName()); av.visitEnd(); } for(int i = 0; i != paramDescrs.size(); ++i) { - AnnotationVisitor av = mv.visitParameterAnnotation(i + start, StdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); + AnnotationVisitor av = mv.visitParameterAnnotation(i + start, JvmStdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true); ValueParameterDescriptor parameterDescriptor = paramDescrs.get(i); - av.visit(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, parameterDescriptor.getName()); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, parameterDescriptor.getName()); if(parameterDescriptor.hasDefaultValue()) { - av.visit(StdlibNames.JET_VALUE_PARAMETER_HAS_DEFAULT_VALUE_FIELD, true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_HAS_DEFAULT_VALUE_FIELD, true); } if(parameterDescriptor.getOutType().isNullable()) { - av.visit(StdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD, true); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD, true); } if (jvmSignature.getKotlinParameterTypes() != null && jvmSignature.getKotlinParameterTypes().get(i) != null) { - av.visit(StdlibNames.JET_VALUE_PARAMETER_TYPE_FIELD, jvmSignature.getKotlinParameterTypes().get(i)); + av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_TYPE_FIELD, jvmSignature.getKotlinParameterTypes().get(i)); } av.visitEnd(); } diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java index f1535c8f16a..494742a8192 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java @@ -6,7 +6,7 @@ import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.OverridingUtil; -import org.jetbrains.jet.lang.resolve.java.StdlibNames; +import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames; import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant; import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lang.types.TypeProjection; @@ -86,8 +86,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { } if(myClass instanceof JetClass && signature.getKotlinGenericSignature() != null) { - AnnotationVisitor annotationVisitor = v.newAnnotation(myClass, StdlibNames.JET_CLASS.getDescriptor(), true); - annotationVisitor.visit(StdlibNames.JET_CLASS_SIGNATURE, signature.getKotlinGenericSignature()); + AnnotationVisitor annotationVisitor = v.newAnnotation(myClass, JvmStdlibNames.JET_CLASS.getDescriptor(), true); + annotationVisitor.visit(JvmStdlibNames.JET_CLASS_SIGNATURE, signature.getKotlinGenericSignature()); annotationVisitor.visitEnd(); } } @@ -120,7 +120,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { { // superinterfaces - superInterfacesLinkedHashSet.add(StdlibNames.JET_OBJECT.getInternalName()); + superInterfacesLinkedHashSet.add(JvmStdlibNames.JET_OBJECT.getInternalName()); for (JetDelegationSpecifier specifier : myClass.getDelegationSpecifiers()) { JetType superType = bindingContext.get(BindingContext.TYPE, specifier.getTypeReference()); diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java index ef308c3f8d3..44a39908bee 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java @@ -9,7 +9,6 @@ import com.intellij.psi.*; import com.intellij.psi.search.DelegatingGlobalSearchScope; import com.intellij.psi.search.GlobalSearchScope; import jet.typeinfo.TypeInfoVariance; -import org.eclipse.jdt.internal.core.JavaModelManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.descriptors.*; @@ -234,8 +233,8 @@ public class JavaDescriptorResolver { private List resolveClassTypeParameters(PsiClass psiClass, JavaClassDescriptor classDescriptor) { for (PsiAnnotation annotation : psiClass.getModifierList().getAnnotations()) { - if (annotation.getQualifiedName().equals(StdlibNames.JET_CLASS.getFqName())) { - PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_CLASS_SIGNATURE); + if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_CLASS.getFqName())) { + PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_CLASS_SIGNATURE); if (attributeValue != null) { String typeParametersString = (String) attributeValue.getValue(); if (typeParametersString != null) { @@ -614,13 +613,13 @@ public class JavaDescriptorResolver { String name = parameter.getName() != null ? parameter.getName() : "p" + i; for (PsiAnnotation annotation : parameter.getModifierList().getAnnotations()) { - if (annotation.getQualifiedName().equals(StdlibNames.JET_VALUE_PARAMETER.getFqName())) { - PsiLiteralExpression nameExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD); + if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_VALUE_PARAMETER.getFqName())) { + PsiLiteralExpression nameExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD); if (nameExpression != null) { name = (String) nameExpression.getValue(); } - PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD); + PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_VALUE_PARAMETER_NULLABLE_FIELD); if (nullableExpression != null) { nullable = (Boolean) nullableExpression.getValue(); } else { @@ -629,24 +628,24 @@ public class JavaDescriptorResolver { changeNullable = true; } - PsiLiteralExpression signatureExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_VALUE_PARAMETER_TYPE_FIELD); + PsiLiteralExpression signatureExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_VALUE_PARAMETER_TYPE_FIELD); if (signatureExpression != null) { typeFromAnnotation = (String) signatureExpression.getValue(); } - PsiLiteralExpression receiverExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_VALUE_PARAMETER_RECEIVER_FIELD); + PsiLiteralExpression receiverExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_VALUE_PARAMETER_RECEIVER_FIELD); if (receiverExpression != null) { receiver = (Boolean) receiverExpression.getValue(); } - PsiLiteralExpression hasDefaultValueExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_VALUE_PARAMETER_HAS_DEFAULT_VALUE_FIELD); + PsiLiteralExpression hasDefaultValueExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_VALUE_PARAMETER_HAS_DEFAULT_VALUE_FIELD); if (hasDefaultValueExpression != null) { hasDefaultValue = (Boolean) hasDefaultValueExpression.getValue(); } - } else if (annotation.getQualifiedName().equals(StdlibNames.JET_TYPE_PARAMETER.getFqName())) { + } else if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_TYPE_PARAMETER.getFqName())) { return JvmMethodParameterMeaning.typeInfo(new Object()); } } @@ -782,8 +781,8 @@ public class JavaDescriptorResolver { private List resolveMethodTypeParameters(PsiMethod method, FunctionDescriptorImpl functionDescriptorImpl) { for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) { - if (annotation.getQualifiedName().equals(StdlibNames.JET_METHOD.getFqName())) { - PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD); + if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_METHOD.getFqName())) { + PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD); if (attributeValue != null) { String typeParametersString = (String) attributeValue.getValue(); if (typeParametersString != null) { @@ -828,8 +827,8 @@ public class JavaDescriptorResolver { String returnTypeFromAnnotation = null; for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) { - if (annotation.getQualifiedName().equals(StdlibNames.JET_METHOD.getFqName())) { - PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD); + if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_METHOD.getFqName())) { + PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD); if (nullableExpression != null) { nullable = (Boolean) nullableExpression.getValue(); } else { @@ -838,7 +837,7 @@ public class JavaDescriptorResolver { changeNullable = true; } - PsiLiteralExpression returnTypeExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_METHOD_RETURN_TYPE_FIELD); + PsiLiteralExpression returnTypeExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_METHOD_RETURN_TYPE_FIELD); if (returnTypeExpression != null) { returnTypeFromAnnotation = (String) returnTypeExpression.getValue(); } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/StdlibNames.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java similarity index 95% rename from compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/StdlibNames.java rename to compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java index 285ffe54b3c..f94405a8214 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/StdlibNames.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JvmStdlibNames.java @@ -5,7 +5,7 @@ import org.objectweb.asm.Type; /** * @author Stepan Koltsov */ -public class StdlibNames { +public class JvmStdlibNames { public static final JvmClassName JET_VALUE_PARAMETER = new JvmClassName("jet.typeinfo.JetValueParameter"); @@ -36,6 +36,6 @@ public class StdlibNames { public static final JvmClassName JET_OBJECT = new JvmClassName("jet.JetObject"); - private StdlibNames() { + private JvmStdlibNames() { } }