rename @JetSignature to @JetClass, better constants in StdlibNames
This commit is contained in:
committed by
Nikolay Krasko
parent
c90a6263a1
commit
08647b4ae7
+4
-4
@@ -381,7 +381,7 @@ public class JavaDescriptorResolver {
|
||||
PsiNameValuePair[] attributes = annotation.getParameterList().getAttributes();
|
||||
attributes.toString();
|
||||
|
||||
if (annotation.getQualifiedName().equals(StdlibNames.JET_VALUE_PARAMETER_CLASS)) {
|
||||
if (annotation.getQualifiedName().equals(StdlibNames.JET_VALUE_PARAMETER.getFqName())) {
|
||||
PsiLiteralExpression nameExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_VALUE_PARAMETER_NAME_FIELD);
|
||||
if (nameExpression != null) {
|
||||
name = (String) nameExpression.getValue();
|
||||
@@ -400,7 +400,7 @@ public class JavaDescriptorResolver {
|
||||
if (signatureExpression != null) {
|
||||
typeFromAnnotation = (String) signatureExpression.getValue();
|
||||
}
|
||||
} else if (annotation.getQualifiedName().equals(StdlibNames.JET_TYPE_PARAMETER_CLASS)) {
|
||||
} else if (annotation.getQualifiedName().equals(StdlibNames.JET_TYPE_PARAMETER.getFqName())) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -531,7 +531,7 @@ public class JavaDescriptorResolver {
|
||||
|
||||
private List<TypeParameterDescriptor> resolveMethodTypeParameters(PsiMethod method, FunctionDescriptorImpl functionDescriptorImpl) {
|
||||
for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) {
|
||||
if (annotation.getQualifiedName().equals(StdlibNames.JET_METHOD_CLASS)) {
|
||||
if (annotation.getQualifiedName().equals(StdlibNames.JET_METHOD.getFqName())) {
|
||||
PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_METHOD_TYPE_PARAMETERS_FIELD);
|
||||
if (attributeValue != null) {
|
||||
String typeParametersString = (String) attributeValue.getValue();
|
||||
@@ -600,7 +600,7 @@ public class JavaDescriptorResolver {
|
||||
String returnTypeFromAnnotation = null;
|
||||
|
||||
for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) {
|
||||
if (annotation.getQualifiedName().equals(StdlibNames.JET_METHOD_CLASS)) {
|
||||
if (annotation.getQualifiedName().equals(StdlibNames.JET_METHOD.getFqName())) {
|
||||
PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD);
|
||||
if (nullableExpression != null) {
|
||||
nullable = (Boolean) nullableExpression.getValue();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.jetbrains.jet.lang.resolve.java;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class JvmClassName {
|
||||
|
||||
private final String fqName;
|
||||
|
||||
public JvmClassName(@NotNull String fqName) {
|
||||
this.fqName = fqName;
|
||||
}
|
||||
|
||||
public String getFqName() {
|
||||
return fqName;
|
||||
}
|
||||
|
||||
private String internalName;
|
||||
|
||||
public String getInternalName() {
|
||||
if (internalName == null) {
|
||||
String descriptor = getDescriptor();
|
||||
internalName = descriptor.substring(1, descriptor.length() - 1);
|
||||
}
|
||||
return internalName;
|
||||
}
|
||||
|
||||
private String descriptor;
|
||||
|
||||
public String getDescriptor() {
|
||||
if (descriptor == null) {
|
||||
StringBuilder sb = new StringBuilder(fqName.length() + 2);
|
||||
sb.append('L');
|
||||
sb.append(fqName.replace('.', '/'));
|
||||
sb.append(';');
|
||||
descriptor = sb.toString();
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
}
|
||||
@@ -7,32 +7,33 @@ import org.objectweb.asm.Type;
|
||||
*/
|
||||
public class StdlibNames {
|
||||
|
||||
public static final String JET_VALUE_PARAMETER_CLASS = "jet.typeinfo.JetValueParameter";
|
||||
public static final String JET_VALUE_PARAMETER_DESCRIPTOR = "Ljet/typeinfo/JetValueParameter;";
|
||||
|
||||
public static final JvmClassName JET_VALUE_PARAMETER = new JvmClassName("jet.typeinfo.JetValueParameter");
|
||||
|
||||
public static final String JET_VALUE_PARAMETER_NAME_FIELD = "name";
|
||||
public static final String JET_VALUE_PARAMETER_HAS_DEFAULT_VALUE_FIELD = "hasDefaultValue";
|
||||
public static final String JET_VALUE_PARAMETER_NULLABLE_FIELD = "nullable";
|
||||
public static final String JET_VALUE_PARAMETER_TYPE_FIELD = "type";
|
||||
|
||||
|
||||
public static final String JET_TYPE_PARAMETER_CLASS = "jet.typeinfo.JetTypeParameter";
|
||||
public static final String JET_TYPE_PARAMETER_DESCRIPTOR = "Ljet/typeinfo/JetTypeParameter;";
|
||||
|
||||
public static final JvmClassName JET_TYPE_PARAMETER = new JvmClassName("jet.typeinfo.JetTypeParameter");
|
||||
|
||||
public static final String JET_TYPE_PARAMETER_NAME_FIELD = "name";
|
||||
|
||||
|
||||
public static final String JET_METHOD_CLASS = "jet.typeinfo.JetMethod";
|
||||
public static final String JET_METHOD_DESCRIPTOR = "Ljet/typeinfo/JetMethod;";
|
||||
|
||||
public static final JvmClassName JET_METHOD = new JvmClassName("jet.typeinfo.JetMethod");
|
||||
|
||||
public static final String JET_METHOD_NULLABLE_RETURN_TYPE_FIELD = "nullableReturnType";
|
||||
public static final String JET_METHOD_RETURN_TYPE_FIELD = "returnType";
|
||||
public static final String JET_METHOD_TYPE_PARAMETERS_FIELD = "typeParameters";
|
||||
|
||||
|
||||
public static final String JET_OBJECT_INTERNAL = "jet/JetObject";
|
||||
public static final String JET_OBJECT_CLASS = "jet.JetObject";
|
||||
public static final String JET_OBJECT_DESCRIPTOR = "Ljet/JetObject;";
|
||||
public static final JvmClassName JET_CLASS = new JvmClassName("jet.typeinfo.JetClass");
|
||||
|
||||
public static final String JET_CLASS_SIGNATURE = "signature";
|
||||
|
||||
|
||||
public static final JvmClassName JET_OBJECT = new JvmClassName("jet.JetObject");
|
||||
|
||||
|
||||
private StdlibNames() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user