Add compiler flag to enable strict mode for improvements in the type enhancement
^KT-45674 Fixed
This commit is contained in:
+11
@@ -471,6 +471,14 @@ default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise""
|
||||
)
|
||||
var suppressDeprecatedJvmTargetWarning: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xtype-enhancement-improvements-strict-mode",
|
||||
description = "Enable strict mode for some improvements in the type enhancement for loaded Java types based on nullability annotations," +
|
||||
"including freshly supported reading of the type use annotations from class files. " +
|
||||
"See KT-45671 for more details"
|
||||
)
|
||||
var typeEnhancementImprovementsInStrictMode: Boolean by FreezableVar(false)
|
||||
|
||||
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
|
||||
val result = super.configureAnalysisFlags(collector)
|
||||
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics
|
||||
@@ -502,6 +510,9 @@ default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise""
|
||||
if (strictJavaNullabilityAssertions) {
|
||||
result[LanguageFeature.StrictJavaNullabilityAssertions] = LanguageFeature.State.ENABLED
|
||||
}
|
||||
if (typeEnhancementImprovementsInStrictMode) {
|
||||
result[LanguageFeature.TypeEnhancementImprovementsInStrictMode] = LanguageFeature.State.ENABLED
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -126,6 +126,8 @@ where advanced options include:
|
||||
Suppress deprecation warning about deprecated JVM target versions
|
||||
-Xsuppress-missing-builtins-error
|
||||
Suppress the "cannot access built-in declaration" error (useful with -no-stdlib)
|
||||
-Xtype-enhancement-improvements-strict-mode
|
||||
Enable strict mode for some improvements in the type enhancement for loaded Java types based on nullability annotations,including freshly supported reading of the type use annotations from class files. See KT-45671 for more details
|
||||
-Xuse-ir Use the IR backend. This option has no effect unless the language version less than 1.5 is used
|
||||
-Xuse-javac Use javac for Java source and class files analysis
|
||||
-Xuse-old-backend Use the old JVM backend
|
||||
|
||||
Reference in New Issue
Block a user