Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issues-1035] fix kotlion incrementalFilter createResource NPE #1037

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

gerenvip
Copy link

功能:修复 启用 doc 的场景下, RouteProcessor 基于 kotlion 增量编译Filter时 创建 docWriter 触发JavaNullPointerException

Issues[1035]: #1035

crash 原因:
https://github.com/JetBrains/kotlin/blob/master/plugins/kapt3/kapt3-base/src/org/jetbrains/kotlin/kapt3/base/incremental/incrementalProcessors.kt
override fun init(processingEnv: ProcessingEnvironment) {
if (!kind.canRunIncrementally) {
processor.init(processingEnv)
} else {
val originalFiler = processingEnv.filer
val incrementalFiler = IncrementalFiler(originalFiler)
val incProcEnvironment = IncrementalProcessingEnvironment(processingEnv, incrementalFiler)
processor.init(incProcEnvironment)
incrementalFiler.dependencyCollector = dependencyCollector.value
}
}

执行 processor.init(incProcEnvironment) 时 还没有给 dependencyCollector 赋值,RouteProcessor#init 时
mFiler.createResource 会调用 dependencyCollector 导致 空指针

解决方案:

  1. 不启用 generateDoc
  2. 延迟初始化 docWriter

@CLAassistant
Copy link

CLAassistant commented Feb 24, 2023

CLA assistant check
All committers have signed the CLA.

@gerenvip gerenvip force-pushed the feature/wayne/fix_incremental_filter_crash branch from 8c836ab to 9f6240a Compare February 24, 2023 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants