mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
fix(tooling-api): project initialization failure when the project contains a Java library module
This happens due to the use of relocated packages in AndroidIDE's Java Compiler API. The 'JavaModuleCompilerSettings' class references the 'javax.lang.model.SourceVersion.RELEASE_11' enum. However, in AndroidIDE, the SourceVersion class has the package name 'jdkx.lang.model'. The project compiles successfully as the ':subprojects:tooling-api-model' module is a Java library due to which, 'javax.lang.model.SourceVersion' can be referenced without any errors. However at runtime, there is no such class and hence the 'NoClassDefFoundError' is thrown. This exception is silently logged to the error stream by the JSONRpc protocol and hence it cannot be seen in the IDE logs. This closes #875.
This commit is contained in:
Binary file not shown.
+7
-3
@@ -18,7 +18,6 @@
|
||||
package com.itsaky.androidide.tooling.api.model
|
||||
|
||||
import com.itsaky.androidide.builder.model.IJavaCompilerSettings
|
||||
import javax.lang.model.SourceVersion
|
||||
|
||||
/**
|
||||
* Compiler settings for [JavaModule].
|
||||
@@ -29,8 +28,13 @@ class JavaModuleCompilerSettings(
|
||||
override val javaSourceVersion: String,
|
||||
override val javaBytecodeVersion: String
|
||||
) : IJavaCompilerSettings(), java.io.Serializable {
|
||||
|
||||
|
||||
private val serialVersionUID = 1L
|
||||
|
||||
internal constructor() : this(SourceVersion.RELEASE_11.name, SourceVersion.RELEASE_11.name)
|
||||
// IMPORTANT
|
||||
// Do not use javax.lang.model.SourceVersion reference here
|
||||
// When running on Android, this class is preset as jdkx.lang.model.SourceVersion
|
||||
// Using the 'javax' reference will result a 'ClassNotFoundException' while deserializing the
|
||||
// JSONRpc data received from the Tooling API server
|
||||
internal constructor() : this("RELEASE_11", "RELEASE_11")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user