As far as I understand, I’m supposed to call com.intellij.openapi.project.ex.ProjectManagerEx#openProjectAsync in openProjectAsync. This needs a OpenProjectTask, but pretty much everything of OpenProjectTask is internal or restricted.
intellij-community is invoking a builder closure, which is @Internal, too:
It has rather different meaning in Kotlin, it does not mean it is public API but enables some inline fun visibility tricks:
/**
* When applied to a class or a member with internal visibility allows using it from public inline functions and
* makes it effectively public.
*
* Public inline functions cannot use non-public API, since if they are inlined, those non-public API references
* would violate access restrictions at a call site
* (see [restrictions for public API inline functions](https://kotlinlang.org/docs/inline-functions.html#restrictions-for-public-api-inline-functions)).
*
* To overcome this restriction an `internal` declaration can be annotated with the `@PublishedApi` annotation:
* - this allows calling that declaration from public inline functions;
* - the declaration becomes effectively public, and this should be considered with respect to binary compatibility maintaining.
*/
@Target(AnnotationTarget.CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
@Retention(AnnotationRetention.BINARY)
@MustBeDocumented
@SinceKotlin("1.1")
public annotation class PublishedApi
I’m implementing a com.intellij.projectImport.ProjectOpenProcessor.
The implementation of openProjectAsync needs to return a Project and I couldn’t find any other way to create a new instance of a Project except with OpenProjectTask. As far as I can tell intellij-community is using the task for its own implementations of openProjectAsync.
If there’s a better way to create a project, please let me know