Is this a bug in the compiler? If I uncomment the ...
# announcements
r
Is this a bug in the compiler? If I uncomment the two lines I get a compile error
Copy code
e: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: org.jetbrains.kotlin.codegen.AccessorForPropertyDescriptor cannot be cast to org.jetbrains.kotlin.codegen.AccessorForPropertyBackingField
Cause: org.jetbrains.kotlin.codegen.AccessorForPropertyDescriptor cannot be cast to org.jetbrains.kotlin.codegen.AccessorForPropertyBackingField
File being compiled and position: (48,33) in /Users/rwondratschek/dev/projects/evernote/evernote/libs/style/fonts/src/main/kotlin/com/evernote/android/font/EvernoteFont.kt
PsiElement: isInitialized
The root cause was thrown at: ExpressionCodegen.java:1974
Copy code
private lateinit var typeface: Typeface

    fun getTypeface(context: Context): Typeface {
        if (!::typeface.isInitialized) {
            synchronized(this) {
//                if (!::typeface.isInitialized) {
                    typeface = try {
                        if (fontRes >= 0) {
                            ResourcesCompat.getFont(context, fontRes) ?: Typeface.DEFAULT
                        } else {
                            Typeface.create(context.getString(stringFontRes), style)
                        }
                    } catch (t: Throwable) {
                        Log.e("Font", "Couldn't load font $this", t)
                        Typeface.DEFAULT
                    }
//                }
            }
        }

        return typeface
    }
youtrack 2