Skip to content

v0.4.20 throws an exception when analyzing #396

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

Closed
recke96 opened this issue Dec 10, 2024 · 5 comments · Fixed by #397
Closed

v0.4.20 throws an exception when analyzing #396

recke96 opened this issue Dec 10, 2024 · 5 comments · Fixed by #397

Comments

@recke96
Copy link

recke96 commented Dec 10, 2024

The upgrade to v0.4.20 results in an exception when analyzing my project - failed run

* What went wrong:
Execution failed for task ':desktop-app:detekt'.
> java.lang.IllegalStateException: Analyzing /home/runner/work/HEMAtoma/HEMAtoma/desktop-app/src/main/kotlin/info/marozzo/hematoma/Main.kt led to an exception.
  Location: java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
  The original exception message was: java.lang.NoSuchFieldError: Class org.jetbrains.kotlin.name.FqName does not have member field 'org.jetbrains.kotlin.name.FqName$Companion Companion'
  Running detekt '1.23.7' on Java '21.0.5+11-LTS' on OS 'Linux'
@leinardi
Copy link

leinardi commented Dec 10, 2024

Same here but with a slightly different error:

* What went wrong:
Execution failed for task ':modules:core:library-ui-api:detektDebug'.
> java.lang.IllegalStateException: Analyzing /home/rleinardi/Workspace/link2-android/modules/core/library-ui-api/src/main/kotlin/com/link/library/ui/api/NightMode.kt led to an exception.
  Location: java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
  The original exception message was: java.lang.NoClassDefFoundError: Could not initialize class io.nlopez.compose.rules.Material2
  Running detekt '1.23.7' on Java '17.0.13+11-Ubuntu-2ubuntu124.04' on OS 'Linux'
  If the exception message does not help, please feel free to create an issue on our GitHub page.

These are the detekt.yml rules:

Compose:
  ComposableAnnotationNaming:
    active: true
  ComposableNaming:
    active: true
    # -- You can optionally disable the checks in this rule for regex matches against the composable name (e.g. molecule presenters)
    # allowedComposableFunctionNames: .*Presenter,.*MoleculePresenter
  ComposableParamOrder:
    active: true
    # -- You can optionally have a list of types to be treated as lambdas (e.g. typedefs or fun interfaces not picked up automatically)
    # treatAsLambda: MyLambdaType
  CompositionLocalAllowlist:
    active: false # Custom
    # -- You can optionally define a list of CompositionLocals that are allowed here
    # allowedCompositionLocals: LocalSomething,LocalSomethingElse
  CompositionLocalNaming:
    active: true
  ContentEmitterReturningValues:
    active: true
    # -- You can optionally add your own composables here
    # contentEmitters: MyComposable,MyOtherComposable
  ContentTrailingLambda:
    active: true
    # -- You can optionally have a list of types to be treated as lambdas (e.g. typedefs or fun interfaces not picked up automatically)
    # treatAsLambda: MyLambdaType
    # -- You can optionally have a list of types to be treated as composable lambdas (e.g. typedefs or fun interfaces not picked up automatically).
    # -- The difference with treatAsLambda is that those need `@Composable` MyLambdaType in the definition, while these won't.
    # treatAsComposableLambda: MyComposableLambdaType
  ContentSlotReused:
      active: true
      # -- You can optionally have a list of types to be treated as composable lambdas (e.g. typedefs or fun interfaces not picked up automatically).
      # -- The difference with treatAsLambda is that those need `@Composable` MyLambdaType in the definition, while these won't.
      # treatAsComposableLambda: MyComposableLambdaType
  DefaultsVisibility:
    active: true
  LambdaParameterEventTrailing:
    active: true
    # -- You can optionally add your own composables here
    # contentEmitters: MyComposable,MyOtherComposable
    # -- You can add composables here that you don't want to count as content emitters (e.g. custom dialogs or modals)
    # contentEmittersDenylist: MyNonEmitterComposable
  LambdaParameterInRestartableEffect:
    active: false # Custom
    # -- You can optionally have a list of types to be treated as lambdas (e.g. typedefs or fun interfaces not picked up automatically)
    # treatAsLambda: MyLambdaType
  Material2:
    active: true #Custom # Opt-in, disabled by default. Turn on if you want to disallow Material 2 usages.
    # -- You can optionally allow parts of it, if you are in the middle of a migration.
    allowedFromM2:
      - 'icons.Icons0'
      - 'navigation'
  ModifierClickableOrder:
    active: true
    # -- You can optionally add your own Modifier types
    # customModifiers: BananaModifier,PotatoModifier
  ModifierComposed:
    active: true
    # -- You can optionally add your own Modifier types
    # customModifiers: BananaModifier,PotatoModifier
  ModifierMissing:
    active: true
    # -- You can optionally control the visibility of which composables to check for here
    # -- Possible values are: `only_public`, `public_and_internal` and `all` (default is `only_public`)
    # checkModifiersForVisibility: only_public
    # -- You can optionally add your own Modifier types
    # customModifiers: BananaModifier,PotatoModifier
    # -- You can suppress this check in functions annotated with these annotations
    # ignoreAnnotated: ['Potato', 'Banana']
  ModifierNaming:
    active: true
    # -- You can optionally add your own Modifier types
    # customModifiers: BananaModifier,PotatoModifier
  ModifierNotUsedAtRoot:
    active: true
    # -- You can optionally add your own composables here
    # contentEmitters: MyComposable,MyOtherComposable
    # -- You can optionally add your own Modifier types
    # customModifiers: BananaModifier,PotatoModifier
  ModifierReused:
    active: true
    # -- You can optionally add your own Modifier types
    # customModifiers: BananaModifier,PotatoModifier
  ModifierWithoutDefault:
    active: true
  MultipleEmitters:
    active: false # Custom
    # -- You can optionally add your own composables here that will count as content emitters
    # contentEmitters: MyComposable,MyOtherComposable
    # -- You can add composables here that you don't want to count as content emitters (e.g. custom dialogs or modals)
    # contentEmittersDenylist: MyNonEmitterComposable
  MutableParams:
    active: true
  MutableStateAutoboxing:
    active: true
  MutableStateParam:
    active: false # Custom https://github.com/mrmans0n/compose-rules/issues/133
  ParameterNaming:
    active: true
    # -- You can optionally have a list of types to be treated as lambdas (e.g. typedefs or fun interfaces not picked up automatically)
    # treatAsLambda: MyLambdaType
  PreviewAnnotationNaming:
    active: true
  PreviewNaming:
    active: false # Opt-in, disabled by default.
    # -- You can optionally configure the naming strategy for previews.
    # -- Possible values are: `suffix`, `prefix`, `anywhere`. By default, it will be `suffix`.
    # previewNamingStrategy: suffix
  PreviewPublic:
    active: true
  RememberMissing:
    active: true
  RememberContentMissing:
    active: true
  UnstableCollections:
    active: true # Custom # Opt-in, disabled by default. Turn on if you want to enforce this (e.g. you have strong skipping disabled)
  ViewModelForwarding:
    active: true
    # -- You can optionally use this rule on things other than types ending in "ViewModel" or "Presenter" (which are the defaults). You can add your own via a regex here:
    # allowedStateHolderNames: .*ViewModel,.*Presenter
    # -- You can optionally add an allowlist for Composable names that won't be affected by this rule
    # allowedForwarding: .*Content,.*FancyStuff
    # -- You can optionally add an allowlist for ViewModel/StateHolder names that won't be affected by this rule
    # allowedForwardingOfTypes: PotatoViewModel,(Apple|Banana)ViewModel,.*FancyViewModel
  ViewModelInjection:
    active: true
    # -- You can optionally add your own ViewModel factories here
    # viewModelFactories: hiltViewModel,potatoViewModel

0.4.19 still works fine.

@mrmans0n
Copy link
Owner

Yeah that looks like it will be the Kotlin 2.1.0 update, from the looks of it.

@mrmans0n
Copy link
Owner

Gonna make a release for this, will keep it open until then.

@mrmans0n
Copy link
Owner

Released v0.4.22, should hit maven central in a few minutes. That should fix it.

@recke96
Copy link
Author

recke96 commented Dec 10, 2024

Works! Thanks for the quick fix.

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 a pull request may close this issue.

3 participants