Fix synthetic method generation for extension properties

If several annotated extension properties with the same name were declared in
one class, JVM issued a ClassFormatError, since we generated a synthetic method
for each of them with the same name and signature. Make the signature of this
synthetic method depend on a receiver parameter, if a property has one
This commit is contained in:
Alexander Udalov
2013-10-09 23:09:17 +04:00
parent 806d264771
commit 2445d04338
11 changed files with 114 additions and 4 deletions
@@ -17,6 +17,7 @@
package org.jetbrains.jet.lang.resolve.java;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.asm4.Type;
import org.jetbrains.asm4.commons.Method;
import org.jetbrains.jet.lang.resolve.name.FqName;
@@ -57,11 +58,11 @@ public final class JvmAbi {
}
@NotNull
public static Method getSyntheticMethodSignatureForAnnotatedProperty(@NotNull Name propertyName) {
public static Method getSyntheticMethodSignatureForAnnotatedProperty(@NotNull Name propertyName, @Nullable Type receiver) {
return new Method(
propertyName.asString() + ANNOTATED_PROPERTY_METHOD_NAME_SUFFIX,
Type.VOID_TYPE,
new Type[0]
receiver == null ? new Type[0] : new Type[] {receiver}
);
}