Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

constructor detection forcom.google.gson.Gson is working but tests unable to detect #96

Open
@theapache64

Description

@theapache64

Code: Modified avoid AvoidDateDetector.kt

overridefungetApplicableConstructorTypes():List<String>=listOf("com.google.gson.Gson")overridefunvisitConstructor(context:JavaContext,node:UCallExpression,constructor:PsiMethod,  ) {    context.report(ISSUE,      node,      context.getLocation(node),"Don't use `Gson`;",    )  }

Test

funtestDocumentationExample() {    lint()      .files(        kotlin("""              package test.pkg              import com.google.gson.Gson              fun test() {                val gson = Gson()              }"""          )          .indented(),      )        .allowCompilationErrors()      .run()      .expectErrorCount(1)  }

Result

  • ./gradlew lint is detecting this but test can't and the above test fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp