diff --git a/app/src/main/kotlin/org/cosmicide/adapter/EditorAdapter.kt b/app/src/main/kotlin/org/cosmicide/adapter/EditorAdapter.kt index 8f336e237..6beb1c32c 100644 --- a/app/src/main/kotlin/org/cosmicide/adapter/EditorAdapter.kt +++ b/app/src/main/kotlin/org/cosmicide/adapter/EditorAdapter.kt @@ -12,6 +12,13 @@ * You should have received a copy of the GNU General Public License along with Cosmic IDE. If not, see . */ +/* + * This file is part of Cosmic IDE. + * Cosmic IDE is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * Cosmic IDE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with Cosmic IDE. If not, see . + */ + package org.cosmicide.adapter import android.content.res.Configuration @@ -28,7 +35,6 @@ import io.github.rosemoe.sora.event.ContentChangeEvent import io.github.rosemoe.sora.event.SubscriptionReceipt import io.github.rosemoe.sora.lang.EmptyLanguage import io.github.rosemoe.sora.langs.textmate.TextMateColorScheme -import io.github.rosemoe.sora.langs.textmate.TextMateLanguage import io.github.rosemoe.sora.langs.textmate.registry.ThemeRegistry import io.github.rosemoe.sora.widget.subscribeEvent import kotlinx.coroutines.Dispatchers @@ -215,7 +221,13 @@ class EditorAdapter(val fragment: Fragment, val fileViewModel: FileViewModel) : } "class" -> { - editor.setEditorLanguage(TextMateLanguage.create("source.java", true)) + editor.setEditorLanguage( + TsLanguageJava.getInstance( + editor, + project, + file + ) + ) } else -> { diff --git a/app/src/main/kotlin/org/cosmicide/fragment/ProjectOutputFragment.kt b/app/src/main/kotlin/org/cosmicide/fragment/ProjectOutputFragment.kt index e2c49d714..add91aed7 100644 --- a/app/src/main/kotlin/org/cosmicide/fragment/ProjectOutputFragment.kt +++ b/app/src/main/kotlin/org/cosmicide/fragment/ProjectOutputFragment.kt @@ -19,6 +19,13 @@ * You should have received a copy of the GNU General Public License along with Cosmic IDE. If not, see . */ +/* + * This file is part of Cosmic IDE. + * Cosmic IDE is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * Cosmic IDE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with Cosmic IDE. If not, see . + */ + package org.cosmicide.fragment import android.os.Bundle @@ -91,7 +98,8 @@ class ProjectOutputFragment : BaseBindingFragment() setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE) } } - checkClasses() + + binding.infoEditor.postDelayed(::checkClasses, 250) } fun checkClasses() { @@ -126,7 +134,6 @@ class ProjectOutputFragment : BaseBindingFragment() text.getColumnCount(text.lineCount - 1), p0.toChar().toString() ) - binding.infoEditor.invalidate() } } }) diff --git a/kotlinc/src/main/java/org/jetbrains/kotlin/cli/jvm/compiler/jarfs/FastJarFileSystem.kt b/kotlinc/src/main/java/org/jetbrains/kotlin/cli/jvm/compiler/jarfs/FastJarFileSystem.kt index 7beb7cdbc..80fcced19 100644 --- a/kotlinc/src/main/java/org/jetbrains/kotlin/cli/jvm/compiler/jarfs/FastJarFileSystem.kt +++ b/kotlinc/src/main/java/org/jetbrains/kotlin/cli/jvm/compiler/jarfs/FastJarFileSystem.kt @@ -5,6 +5,13 @@ * You should have received a copy of the GNU General Public License along with Cosmic IDE. If not, see . */ +/* + * This file is part of Cosmic IDE. + * Cosmic IDE is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * Cosmic IDE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with Cosmic IDE. If not, see . + */ + /* * This file is part of Cosmic IDE. * Cosmic IDE is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. @@ -106,7 +113,11 @@ private fun prepareCleanerCallback(): ((ByteBuffer) -> Unit)? { return try { // API 26+ already allow using these methods // if (IS_PRIOR_9_JRE) { - val cleaner = Class.forName("java.nio.DirectByteBuffer").getMethod("cleaner") + val directByteBuffer = Class.forName("java.nio.DirectByteBuffer") + if (directByteBuffer.declaredMethods.any { it.name == "cleaner" }.not()) { + return null + } + val cleaner = directByteBuffer.getMethod("cleaner") cleaner.isAccessible = true val clean = Class.forName("sun.misc.Cleaner").getMethod("clean")