Skip to content

Comments

Experimental Java analysis using SymbolsTranslator#4445

Open
yuriioliinyk4 wants to merge 23 commits intoKotlin:masterfrom
yuriioliinyk4:yuriioliinyk4/experimental-java-analysis-symbols
Open

Experimental Java analysis using SymbolsTranslator#4445
yuriioliinyk4 wants to merge 23 commits intoKotlin:masterfrom
yuriioliinyk4:yuriioliinyk4/experimental-java-analysis-symbols

Conversation

@yuriioliinyk4
Copy link
Contributor

Partially implements #4246

New experimental flag org.jetbrains.dokka.analysis.enableExperimentalSymbolsJavaAnalysis is introduced to analyze java using SymbolsTranslator instead of PsiTranslator.

There are ~60 unit tests left that are failing under new experimental flag. Most of them are related to problems with annotations, type conversion in AA (e.g. java's Object become kotlin's Any, int[] into IntArray, etc), modifiers.

classpath = symbolsTestImplementationResolver.incoming.files + classpath

// Enable experimental symbols java analysis
systemProperty("org.jetbrains.dokka.analysis.enableExperimentalSymbolsJavaAnalysis", "true")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, @AbdullinAM, I think it might make sense to convert the current logic regarding new KDoc resolution based on org.jetbrains.dokka.analysis.enableExperimentalKDocResolution to also use this approach, to check all tests with new resolution, and not just some of them, to be sure, that we will be able to safely enable the flag by default (#4425)


Also, for both those flags, we might want to support enabling them for IT, like we do for K2 -

val useK2 = dokkaBuild.integrationTestUseK2
systemProperty.inputProperty("org.jetbrains.dokka.experimental.tryK2", useK2)
.optional(true)
useJUnitPlatform {
if (useK2.get()) excludeTags("onlyDescriptors", "onlyDescriptorsMPP")
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I will create a PR

Copy link
Collaborator

@whyoleg whyoleg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!
Now, we need to rebase it and support a lot of tests :)

SO MUCH CODE we will be able to remove after this and K1 removal...

@vmishenev
Copy link
Contributor

@yuriioliinyk4 Could you resolve merge conflicts, please?

…ymbols

# Conflicts:
#	build-logic/src/main/kotlin/dokkabuild.test-k2.gradle.kts
#	dokka-subprojects/analysis-kotlin-symbols/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/translators/DefaultSymbolToDocumentableTranslator.kt
#	dokka-subprojects/plugin-base/src/test/kotlin/utils/TagsAnnotations.kt
@yuriioliinyk4
Copy link
Contributor Author

I resolved conflicts, review pls last 3 commits.

Note that there are few failing tests outside the plugin-base ( @OnlyJavaPsi cant be applied to those tests because it is defined in the plugin-base)

> Task :dokka-subprojects:plugin-javadoc:testJavaSymbols

JavadocDeprecatedTest > should be sorted by position() FAILED
    org.opentest4j.AssertionFailedError at JavadocDeprecatedTest.kt:181

JavadocDeprecatedTest > finds correct number of element for removal() FAILED
    java.util.NoSuchElementException at JavadocDeprecatedTest.kt:195

JavadocDeprecatedTest > generates correct number of sections() FAILED
    org.opentest4j.AssertionFailedError at JavadocDeprecatedTest.kt:181

JavadocClasslikeTemplateMapTest > documented function parameters() FAILED
    java.lang.AssertionError at JavadocClasslikeTemplateMapTest.kt:242
        Caused by: org.opentest4j.AssertionFailedError at JavadocClasslikeTemplateMapTest.kt:476
        
> Task :dokka-subprojects:plugin-kotlin-as-java:testJavaSymbols

KotlinAsJavaPluginTest > Java function should keep its access modifier() FAILED
    java.lang.AssertionError at KotlinAsJavaPluginTest.kt:506

KotlinAsJavaPluginTest > java properties should keep its modifiers() FAILED
    java.lang.AssertionError at KotlinAsJavaPluginTest.kt:215

@vmishenev
Copy link
Contributor

@OnlyJavaPsi cant be applied to those tests because it is defined in the plugin-base

Can you duplicate this annotation in kotlin-as-java and other plugins?

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.

4 participants