https://kotlinlang.org logo
Title
d

dvdandroid

08/15/2022, 7:16 AM
i'm using gradle version catalogs and to remove the warning about libs accessors in build.gradle.kts i use
@Suppress("DSL_SCOPE_VIOLATION")
(issue KTIJ-19369), but after sync project it errors with:
Line 1: @Suppress("DSL_SCOPE_VIOLATION")
                                          ^ Expecting an expression
ScriptCompilationException(errors=[ScriptCompilationError(message=Expecting an expression, location=C:\Users\me\.gradle\.tmp\gradle-kotlin-dsl-2485107686268774832.tmp\build.gradle.kts (1:33))])
how to fix this issue? cannot always reproduce
v

Vampire

08/15/2022, 7:48 AM
Hard to say without a reproducer. Never seen it. One work-around would of course be to not use the annotation but just look away. :-)
c

Chrimaeon

08/15/2022, 12:52 PM
Where do you put the annotation? on the
alias
, the
plugins
or the “file”?
d

dvdandroid

08/15/2022, 12:54 PM
First line of build file (I had no imports), above the plugins block
c

Chrimaeon

08/15/2022, 12:56 PM
if you want it to have a file scope you’ll need
@file:Suppress(...)
. Maybe thats the issue. I use it on the
alias
itself and it works without issues.
d

dvdandroid

08/15/2022, 12:58 PM
I'll try, but for me it always worked on top the plugins block, idk why sometimes it breaks
v

Vampire

08/15/2022, 1:20 PM
For me too when I used it. Probably better to find a way to reproduce it so that someone can fix it. 🙂
d

dvdandroid

08/15/2022, 1:31 PM
ok, annotation with file scope works fine; ty all