Skip to content
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

feat: rewrite the implementation into Kotlin #924

Merged
merged 45 commits into from
Aug 13, 2023
Merged

feat: rewrite the implementation into Kotlin #924

merged 45 commits into from
Aug 13, 2023

Conversation

KengoTODA
Copy link
Member

@KengoTODA KengoTODA commented Jul 31, 2023

Translate codes in src/main/groovy into Kotlin.

BREAKING CHANGE: This plugin has been rewritten in Kotlin, and it may break the binary compatibility of public API. Intentional changes are listed as follows:

Changes for Groovy buildscripts

About effort and reportLevel properties of SpotBugsTask and SpotBugsExtension, Groovy buildscripts should use use valueOf(String) method explicitly. This limitation is caused by a known issue of the Groovy language:

// before (v5)
spotbugs {
    effort = 'default'
    reportLevel = 'default'
}

// after (v6)
spotbugs {
    effort = Effort.valueOf('DEFAULT')
    reportLevel = Confidence.valueOf('DEFAULT')
}

Changes for Kotlin buildscripts

It is recommended to use Gradle 8.2 or later, then you can enjoy the simple property assignment feature by default:

// legacy (Gradle 8.1 and older)
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort

spotbugs {
    effort.set(Effort.DEFAULT)
    reportLevel.set(Confidence.DEFAULT)
}

// new (Gradle 8.2 and later)
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort

spotbugs {
    effort = Effort.DEFAULT
    reportLevel = Confidence.DEFAULT
}

It is also possible to use string values, however, it is not recommended due to lack of type-safety:

// new (Gradle 8.2 and later)
import com.github.spotbugs.snom.assign

spotbugs {
    effort = "DEFAULT"
    reportLevel = "DEFAULT"
}

Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
@KengoTODA KengoTODA self-assigned this Jul 31, 2023
@KengoTODA KengoTODA changed the base branch from master to v6 July 31, 2023 21:34
@KengoTODA KengoTODA changed the title Introduce kotlin feat: rewrite the implementation into Kotlin Aug 1, 2023
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
@KengoTODA
Copy link
Member Author

Illegal bytecode found from my local build:

* What went wrong:
A problem occurred evaluating root project '1691283557801-0'.
> Could not create task ':spotbugsMain'.
   > Could not create task of type 'SpotBugsTask'.
      > Bad type on operand stack
        Exception Details:
          Location:
            com/github/spotbugs/snom/SpotBugsTask_Decorated.getIgnoreFailures()Z @36: ireturn
          Reason:
            Type 'org/gradle/api/provider/Property' (current frame, stack[0]) is not assignable to integer
          Current Frame:
            bci: @36
            flags: { }
            locals: { 'com/github/spotbugs/snom/SpotBugsTask_Decorated', 'org/gradle/api/provider/Property' }
            stack: { 'org/gradle/api/provider/Property' }
          Bytecode:
            0x0000000: 2ab4 01fc 4c2b c700 1d2a b601 d02a 1301
            0x0000010: 0413 01ec 1301 feb6 01f1 c001 ec4c 2a2b
            0x0000020: b501 fc2b ac                           
          Stackmap Table:
            append_frame(@35,Object[#492])

Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
@KengoTODA
Copy link
Member Author

refs #640

Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
…he-able

Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
Signed-off-by: Kengo TODA <skypencil@gmail.com>
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Signed-off-by: Kengo TODA <skypencil@gmail.com>
@KengoTODA KengoTODA marked this pull request as ready for review August 12, 2023 05:32
Signed-off-by: Kengo TODA <skypencil@gmail.com>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 36 Code Smells

5.5% 5.5% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.20) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@KengoTODA KengoTODA merged commit bcf4706 into v6 Aug 13, 2023
@KengoTODA KengoTODA deleted the introduce-kotlin branch August 13, 2023 19:05
@github-actions
Copy link

🎉 This PR is included in version 6.0.0-v6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version 6.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version 6.0.0-rc.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Dec 2, 2023

🎉 This PR is included in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Goooler Goooler mentioned this pull request Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant