SYNTHETIC flag for internal members

This commit is contained in:
Michael Bogdanov
2015-10-07 09:18:05 +03:00
parent a2455aab7a
commit fa32aa2950
5 changed files with 10 additions and 6 deletions
@@ -212,7 +212,7 @@ public class AsmUtil {
flags |= ACC_ABSTRACT;
}
if (JetTypeMapper.isAccessor(functionDescriptor)) {
if (JetTypeMapper.isAccessor(functionDescriptor) || functionDescriptor.getVisibility() == Visibilities.INTERNAL) {
flags |= ACC_SYNTHETIC;
}
@@ -331,6 +331,10 @@ public class PropertyCodegen {
modifiers |= ACC_PRIVATE;
}
if (propertyDescriptor.getVisibility() == Visibilities.INTERNAL) {
modifiers |= ACC_SYNTHETIC;
}
if (AsmUtil.isPropertyWithBackingFieldCopyInOuterClass(propertyDescriptor)) {
ImplementationBodyCodegen parentBodyCodegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen();
parentBodyCodegen.addCompanionObjectPropertyToCopy(propertyDescriptor, defaultValue);
@@ -33,7 +33,7 @@ private fun createModifierList(text: String, owner: JetModifierListOwner): JetMo
return owner.addBefore(newModifierList, anchor) as JetModifierList
}
internal fun addModifier(owner: JetModifierListOwner, modifier: JetModifierKeywordToken) {
fun addModifier(owner: JetModifierListOwner, modifier: JetModifierKeywordToken) {
val modifierList = owner.modifierList
if (modifierList == null) {
createModifierList(modifier.value, owner)
@@ -43,7 +43,7 @@ internal fun addModifier(owner: JetModifierListOwner, modifier: JetModifierKeywo
}
}
internal fun addAnnotationEntry(owner: JetModifierListOwner, annotationEntry: JetAnnotationEntry): JetAnnotationEntry {
fun addAnnotationEntry(owner: JetModifierListOwner, annotationEntry: JetAnnotationEntry): JetAnnotationEntry {
val modifierList = owner.modifierList
return if (modifierList == null) {
createModifierList(annotationEntry.text, owner).annotationEntries.first()
@@ -90,7 +90,7 @@ internal fun addModifier(modifierList: JetModifierList, modifier: JetModifierKey
}
}
internal fun removeModifier(owner: JetModifierListOwner, modifier: JetModifierKeywordToken) {
fun removeModifier(owner: JetModifierListOwner, modifier: JetModifierKeywordToken) {
owner.getModifierList()?.let {
it.getModifier(modifier)?.delete()
if (it.firstChild == null) {
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.storage.StorageManager
public class FileBasedPackageMemberDeclarationProvider internal constructor(
public class FileBasedPackageMemberDeclarationProvider(
storageManager: StorageManager,
private val fqName: FqName,
private val factory: FileBasedDeclarationProviderFactory,
@@ -27,7 +27,7 @@ import kotlin.reflect.jvm.internal.pcollections.HashPMap
private var FOREIGN_K_CLASSES = HashPMap.empty<String, Any>()
// This function is invoked on each reflection access to Java classes, properties, etc. Performance is critical here.
internal fun <T : Any> foreignKotlinClass(jClass: Class<T>): KClassImpl<T> {
fun <T : Any> foreignKotlinClass(jClass: Class<T>): KClassImpl<T> {
val name = jClass.getName()
val cached = FOREIGN_K_CLASSES[name]
if (cached is WeakReference<*>) {