question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression: Types no longer validating

See original GitHub issue

Consider the following class definition (taken from this file)

@Converter(
    names = ["j8Duration"],
    types = [ConverterType.DEFAULTING, ConverterType.OPTIONAL, ConverterType.SINGLE],
    imports = ["java.time.*"],

    builderFields = [
        "public var longHelp: Boolean = true",
        "public var positiveOnly: Boolean = true",
    ],
)
public class J8DurationConverter(
    public val longHelp: Boolean = true,
    public val positiveOnly: Boolean = true,
    override var validator: Validator<ChronoContainer> = null
) : SingleConverter<ChronoContainer>() {

KSP will happily parse this under Kotlin 1.6.10, using version 1.6.10-1.0.4. There are no issues.

Under Kotlin 1.6.20 and KSP 1.6.20-1.0.5, this class no longer validates - attempting to get the super types will result in a list with a single <Error object> entry. Even worse, this seems to sporadically only happens on a clean build - running build again right after will sometimes result in validation passing perfectly, and the output being generated correctly.

I have a bunch of classes that are structured the same way and are generally quite similar that parse just fine under 1.0.5. Some examples are below, but everything in the same directory works perfectly. Click here for the annotation processor code.

Working:

Broken:


This makes absolutely no sense to me whatsoever. I can’t see any significant differences, and I’m entirely out of ideas. For the time being, I’ve pushed a copy of the repo using last known working versions of Kotlin and KSP, simply updating them will cause this issue.

Since I really don’t know how to dig further, I’ve pushed a branch which exhibits this issue. Simply clone it and run gradlew build.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17

github_iconTop GitHub Comments

1reaction
gdude2002commented, Jul 8, 2022

I can confirm @DRSchlaubi’s fix. It doesn’t help regarding my TestPlugin report, and I believe that’s because that was in the test source set rather than main.

I’ve removed it in our codebase as our test bot is in a different module now, and things are working, but it’s worth considering whether this is intentional KSP behaviour.

1reaction
gdude2002commented, Apr 22, 2022

Huh, interesting - when I next have some spare time I’ll give that a go, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Regression validation - Wikipedia
In statistics, regression validation is the process of deciding whether the numerical results quantifying hypothesized relationships between variables, ...
Read more >
Validation of Regression Models: Methods and Examples
Methods to determine the validity of regression models include comparison of model predictions and coefficients with theory, collection of ...
Read more >
Assumptions Of Linear Regression – How to Validate and Fix
If the Residuals are not normally distributed, non–linear transformation of the dependent or independent variables can be tried. 1. 2. 3. 4. 5....
Read more >
Cross-validation pitfalls when selecting and assessing ...
Background. We address the problem of selecting and assessing classification and regression models using cross-validation.
Read more >
15 Types of Regression in Data Science - ListenData
Regression techniques are one of the most popular statistical techniques used for predictive modeling and data mining tasks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found