Create empty method for annotated properties w/o fields
There was no place in bytecode where annotations on properties without backing
fields could be stored to. Now they're written on a synthetic empty void method
with a special name ("propertyName$annotations").
(Annotations on properties cannot simply be written on getters in bytecode,
since a getter can have annotations of its own.)
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.jet.lang.resolve.java;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
@@ -38,11 +37,12 @@ public class JvmAbi {
|
||||
public static final String CLASS_OBJECT_CLASS_NAME = "object";
|
||||
public static final String CLASS_OBJECT_SUFFIX = "$" + CLASS_OBJECT_CLASS_NAME;
|
||||
|
||||
public static final String DELEGATED_PROPERTY_NAME_POSTFIX = "$delegate";
|
||||
public static final String DELEGATED_PROPERTY_NAME_SUFFIX = "$delegate";
|
||||
public static final String ANNOTATED_PROPERTY_METHOD_NAME_SUFFIX = "$annotations";
|
||||
public static final String ANNOTATED_PROPERTY_METHOD_SIGNATURE = "()V";
|
||||
|
||||
public static final String INSTANCE_FIELD = "instance$";
|
||||
public static final String CLASS_OBJECT_FIELD = "object$";
|
||||
public static final String RECEIVER_PARAMETER = "$receiver";
|
||||
|
||||
public static final JvmClassName JETBRAINS_NOT_NULL_ANNOTATION =
|
||||
JvmClassName.byFqNameWithoutInnerClasses("org.jetbrains.annotations.NotNull");
|
||||
@@ -56,12 +56,18 @@ public class JvmAbi {
|
||||
return fqName.lastSegmentIs(Name.identifier(CLASS_OBJECT_CLASS_NAME));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getPropertyDelegateName(@NotNull Name name) {
|
||||
return name.asString() + DELEGATED_PROPERTY_NAME_POSTFIX;
|
||||
return name.asString() + DELEGATED_PROPERTY_NAME_SUFFIX;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getSyntheticMethodNameForAnnotatedProperty(@NotNull Name propertyName) {
|
||||
return propertyName.asString() + ANNOTATED_PROPERTY_METHOD_NAME_SUFFIX;
|
||||
}
|
||||
|
||||
public static String getDefaultPropertyName(Name propertyName, boolean isDelegated, boolean isExtensionProperty) {
|
||||
@NotNull
|
||||
public static String getDefaultPropertyName(@NotNull Name propertyName, boolean isDelegated, boolean isExtensionProperty) {
|
||||
if (isDelegated) {
|
||||
return getPropertyDelegateName(propertyName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user