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.

Infinite loop in Annotation Processor?

See original GitHub issue

Hi,

I use the Carousel feature in Epoxy in one of my RecyclerView. Since I wanted to extend it with multiple features, I decided to extend the Carousel class.

@ModelView(autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT)
class NonSnappingCarousel(context: Context) : Carousel(context) {
    // Some ModelProp properties
}

This example works fine. However, since I began having more features in that extended Carousel class, I decided to write myself a BaseCarousel class, containing many of features that other carousel subclasses could need.

I therefore decided to rewrite the exact same code as such, only moving @ModelProp properties from one file to the other:

@ModelView(autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT)
open class BaseCarousel(context: Context) : Carousel(context) {
    // Some moved ModelProp properties
}

class NonSnappingCarousel(context: Context) : BaseCarousel(context) {
    // Some non-moved ModelProp properties
}

However, the above code fails to compile without any build error. Gradle gets stuck at 7% at kaptAlphaDebugKotlin. And what is even weirder is that once I try to build that code, even if I revert my changes, Gradle would get stuck at this exact same place. To fix this, I need to kill the gradle java process running in background. After that, I’m able to build my project again, except when I bring back the specific changes mentioned above.

I tried and encountered this issue with Gradle 4.4 up to 4.8 (released this morning).

Edit:

Here is a basic example that reproduce the issue in a brand new Android project:

package com.example.test.myapplication

import android.content.Context
import android.util.AttributeSet
import com.airbnb.epoxy.Carousel
import com.airbnb.epoxy.ModelView
import com.airbnb.epoxy.TextProp

@ModelView(autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT)
open class BaseCarousel : Carousel {

    var propertyOne: CharSequence? = null
        @TextProp set

    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle)
}

// If you remove this class declaration, everything compiles correctly
@ModelView(autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT)
class NonSnappingCarousel : BaseCarousel {

    var propertyTwo: CharSequence? = null
        @TextProp set

    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle)
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
elihartcommented, Jun 7, 2018

Thanks a lot! I’m still traveling for the next week, but I’ll fix it after that

1reaction
elihartcommented, Jun 14, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Infinite loop at compile time? - java - Stack Overflow
If you code an annotation processor that contains an infinite loop and add this to your compiler classpath, javac could loop forever too...
Read more >
188843 – Endless loop in AnnotationView.paintComponent
1 after the IDE froze and the process used all available CPU as if in an infinite loop. Appears it gets into a...
Read more >
Infinite Loop Question - should be simple - Page 3 — oracle-tech
"error: Class names, 'Infiniteloop', are only accepted if annotation processing is explicitly requested" Any idea what might be causing this?
Read more >
unclosed @code annotation in doc block causes infinite loop
I have created a merge request that resolves this issue. The Sniff is updated to not cause an infinite loop in the case...
Read more >
[Checkers] [Fwd: hg: jdk7/tl/langtools: 6663588: Compiler goes into ...
Here's another infinite loop that we should check for in the framework once JSR 308 ... javac gets caught in the loop before...
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