rename StdlibNames
This commit is contained in:
@@ -6,7 +6,7 @@ import org.jetbrains.jet.lang.descriptors.*;
|
|||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
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.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
||||||
import org.objectweb.asm.AnnotationVisitor;
|
import org.objectweb.asm.AnnotationVisitor;
|
||||||
import org.objectweb.asm.Label;
|
import org.objectweb.asm.Label;
|
||||||
@@ -92,48 +92,48 @@ public class FunctionCodegen {
|
|||||||
if(kind != OwnerKind.TRAIT_IMPL) {
|
if(kind != OwnerKind.TRAIT_IMPL) {
|
||||||
AnnotationVisitor av = mv.visitAnnotation(JetTypeMapper.JET_METHOD_TYPE.getDescriptor(), true);
|
AnnotationVisitor av = mv.visitAnnotation(JetTypeMapper.JET_METHOD_TYPE.getDescriptor(), true);
|
||||||
if(functionDescriptor.getReturnType().isNullable()) {
|
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) {
|
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) {
|
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();
|
av.visitEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(kind == OwnerKind.TRAIT_IMPL) {
|
if(kind == OwnerKind.TRAIT_IMPL) {
|
||||||
AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true);
|
AnnotationVisitor av = mv.visitParameterAnnotation(start++, JvmStdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true);
|
||||||
av.visit(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$self");
|
av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$self");
|
||||||
av.visitEnd();
|
av.visitEnd();
|
||||||
}
|
}
|
||||||
if(receiverParameter.exists()) {
|
if(receiverParameter.exists()) {
|
||||||
AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true);
|
AnnotationVisitor av = mv.visitParameterAnnotation(start++, JvmStdlibNames.JET_VALUE_PARAMETER.getDescriptor(), true);
|
||||||
av.visit(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$receiver");
|
av.visit(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "this$receiver");
|
||||||
if(receiverParameter.getType().isNullable()) {
|
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();
|
av.visitEnd();
|
||||||
}
|
}
|
||||||
for (final TypeParameterDescriptor typeParameterDescriptor : typeParameters) {
|
for (final TypeParameterDescriptor typeParameterDescriptor : typeParameters) {
|
||||||
AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_TYPE_PARAMETER.getDescriptor(), true);
|
AnnotationVisitor av = mv.visitParameterAnnotation(start++, JvmStdlibNames.JET_TYPE_PARAMETER.getDescriptor(), true);
|
||||||
av.visit(StdlibNames.JET_TYPE_PARAMETER_NAME_FIELD, typeParameterDescriptor.getName());
|
av.visit(JvmStdlibNames.JET_TYPE_PARAMETER_NAME_FIELD, typeParameterDescriptor.getName());
|
||||||
av.visitEnd();
|
av.visitEnd();
|
||||||
}
|
}
|
||||||
for(int i = 0; i != paramDescrs.size(); ++i) {
|
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);
|
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()) {
|
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()) {
|
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) {
|
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();
|
av.visitEnd();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import org.jetbrains.jet.lang.descriptors.*;
|
|||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
import org.jetbrains.jet.lang.resolve.OverridingUtil;
|
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.resolve.constants.CompileTimeConstant;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
import org.jetbrains.jet.lang.types.TypeProjection;
|
import org.jetbrains.jet.lang.types.TypeProjection;
|
||||||
@@ -86,8 +86,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(myClass instanceof JetClass && signature.getKotlinGenericSignature() != null) {
|
if(myClass instanceof JetClass && signature.getKotlinGenericSignature() != null) {
|
||||||
AnnotationVisitor annotationVisitor = v.newAnnotation(myClass, StdlibNames.JET_CLASS.getDescriptor(), true);
|
AnnotationVisitor annotationVisitor = v.newAnnotation(myClass, JvmStdlibNames.JET_CLASS.getDescriptor(), true);
|
||||||
annotationVisitor.visit(StdlibNames.JET_CLASS_SIGNATURE, signature.getKotlinGenericSignature());
|
annotationVisitor.visit(JvmStdlibNames.JET_CLASS_SIGNATURE, signature.getKotlinGenericSignature());
|
||||||
annotationVisitor.visitEnd();
|
annotationVisitor.visitEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
|
|
||||||
|
|
||||||
{ // superinterfaces
|
{ // superinterfaces
|
||||||
superInterfacesLinkedHashSet.add(StdlibNames.JET_OBJECT.getInternalName());
|
superInterfacesLinkedHashSet.add(JvmStdlibNames.JET_OBJECT.getInternalName());
|
||||||
|
|
||||||
for (JetDelegationSpecifier specifier : myClass.getDelegationSpecifiers()) {
|
for (JetDelegationSpecifier specifier : myClass.getDelegationSpecifiers()) {
|
||||||
JetType superType = bindingContext.get(BindingContext.TYPE, specifier.getTypeReference());
|
JetType superType = bindingContext.get(BindingContext.TYPE, specifier.getTypeReference());
|
||||||
|
|||||||
+14
-15
@@ -9,7 +9,6 @@ import com.intellij.psi.*;
|
|||||||
import com.intellij.psi.search.DelegatingGlobalSearchScope;
|
import com.intellij.psi.search.DelegatingGlobalSearchScope;
|
||||||
import com.intellij.psi.search.GlobalSearchScope;
|
import com.intellij.psi.search.GlobalSearchScope;
|
||||||
import jet.typeinfo.TypeInfoVariance;
|
import jet.typeinfo.TypeInfoVariance;
|
||||||
import org.eclipse.jdt.internal.core.JavaModelManager;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
@@ -234,8 +233,8 @@ public class JavaDescriptorResolver {
|
|||||||
|
|
||||||
private List<TypeParameterDescriptor> resolveClassTypeParameters(PsiClass psiClass, JavaClassDescriptor classDescriptor) {
|
private List<TypeParameterDescriptor> resolveClassTypeParameters(PsiClass psiClass, JavaClassDescriptor classDescriptor) {
|
||||||
for (PsiAnnotation annotation : psiClass.getModifierList().getAnnotations()) {
|
for (PsiAnnotation annotation : psiClass.getModifierList().getAnnotations()) {
|
||||||
if (annotation.getQualifiedName().equals(StdlibNames.JET_CLASS.getFqName())) {
|
if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_CLASS.getFqName())) {
|
||||||
PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_CLASS_SIGNATURE);
|
PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_CLASS_SIGNATURE);
|
||||||
if (attributeValue != null) {
|
if (attributeValue != null) {
|
||||||
String typeParametersString = (String) attributeValue.getValue();
|
String typeParametersString = (String) attributeValue.getValue();
|
||||||
if (typeParametersString != null) {
|
if (typeParametersString != null) {
|
||||||
@@ -614,13 +613,13 @@ public class JavaDescriptorResolver {
|
|||||||
String name = parameter.getName() != null ? parameter.getName() : "p" + i;
|
String name = parameter.getName() != null ? parameter.getName() : "p" + i;
|
||||||
for (PsiAnnotation annotation : parameter.getModifierList().getAnnotations()) {
|
for (PsiAnnotation annotation : parameter.getModifierList().getAnnotations()) {
|
||||||
|
|
||||||
if (annotation.getQualifiedName().equals(StdlibNames.JET_VALUE_PARAMETER.getFqName())) {
|
if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_VALUE_PARAMETER.getFqName())) {
|
||||||
PsiLiteralExpression nameExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD);
|
PsiLiteralExpression nameExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD);
|
||||||
if (nameExpression != null) {
|
if (nameExpression != null) {
|
||||||
name = (String) nameExpression.getValue();
|
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) {
|
if (nullableExpression != null) {
|
||||||
nullable = (Boolean) nullableExpression.getValue();
|
nullable = (Boolean) nullableExpression.getValue();
|
||||||
} else {
|
} else {
|
||||||
@@ -629,24 +628,24 @@ public class JavaDescriptorResolver {
|
|||||||
changeNullable = true;
|
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) {
|
if (signatureExpression != null) {
|
||||||
typeFromAnnotation = (String) signatureExpression.getValue();
|
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) {
|
if (receiverExpression != null) {
|
||||||
receiver = (Boolean) receiverExpression.getValue();
|
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) {
|
if (hasDefaultValueExpression != null) {
|
||||||
hasDefaultValue = (Boolean) hasDefaultValueExpression.getValue();
|
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());
|
return JvmMethodParameterMeaning.typeInfo(new Object());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -782,8 +781,8 @@ public class JavaDescriptorResolver {
|
|||||||
|
|
||||||
private List<TypeParameterDescriptor> resolveMethodTypeParameters(PsiMethod method, FunctionDescriptorImpl functionDescriptorImpl) {
|
private List<TypeParameterDescriptor> resolveMethodTypeParameters(PsiMethod method, FunctionDescriptorImpl functionDescriptorImpl) {
|
||||||
for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) {
|
for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) {
|
||||||
if (annotation.getQualifiedName().equals(StdlibNames.JET_METHOD.getFqName())) {
|
if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_METHOD.getFqName())) {
|
||||||
PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD);
|
PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD);
|
||||||
if (attributeValue != null) {
|
if (attributeValue != null) {
|
||||||
String typeParametersString = (String) attributeValue.getValue();
|
String typeParametersString = (String) attributeValue.getValue();
|
||||||
if (typeParametersString != null) {
|
if (typeParametersString != null) {
|
||||||
@@ -828,8 +827,8 @@ public class JavaDescriptorResolver {
|
|||||||
String returnTypeFromAnnotation = null;
|
String returnTypeFromAnnotation = null;
|
||||||
|
|
||||||
for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) {
|
for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) {
|
||||||
if (annotation.getQualifiedName().equals(StdlibNames.JET_METHOD.getFqName())) {
|
if (annotation.getQualifiedName().equals(JvmStdlibNames.JET_METHOD.getFqName())) {
|
||||||
PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD);
|
PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(JvmStdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD);
|
||||||
if (nullableExpression != null) {
|
if (nullableExpression != null) {
|
||||||
nullable = (Boolean) nullableExpression.getValue();
|
nullable = (Boolean) nullableExpression.getValue();
|
||||||
} else {
|
} else {
|
||||||
@@ -838,7 +837,7 @@ public class JavaDescriptorResolver {
|
|||||||
changeNullable = true;
|
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) {
|
if (returnTypeExpression != null) {
|
||||||
returnTypeFromAnnotation = (String) returnTypeExpression.getValue();
|
returnTypeFromAnnotation = (String) returnTypeExpression.getValue();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ import org.objectweb.asm.Type;
|
|||||||
/**
|
/**
|
||||||
* @author Stepan Koltsov
|
* @author Stepan Koltsov
|
||||||
*/
|
*/
|
||||||
public class StdlibNames {
|
public class JvmStdlibNames {
|
||||||
|
|
||||||
public static final JvmClassName JET_VALUE_PARAMETER = new JvmClassName("jet.typeinfo.JetValueParameter");
|
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");
|
public static final JvmClassName JET_OBJECT = new JvmClassName("jet.JetObject");
|
||||||
|
|
||||||
|
|
||||||
private StdlibNames() {
|
private JvmStdlibNames() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user