Skip to content

Instantly share code, notes, and snippets.

View antonarhipov's full-sized avatar
💣

Anton Arhipov antonarhipov

💣
View GitHub Profile

IntelliJ IDEA Debugger Tips & Tricks

Debuggers are commonly used to locate and fix bugs. Though, how long does it take to solve an issue? Debugging isn’t a very productive process, but there are ways to make it more efficient in IntelliJ IDEA. In this talk, Anton will demonstrate various debugger features, including not-so-standard ones, like:

  • Remote debugging
  • Lambda breakpoints
  • Stream chain tracing
  • Altering program behavior
  • Emulated method breakpoint
  • Evaluate and log
@antonarhipov
antonarhipov / onboarding.kt
Last active August 9, 2023 12:25
Kotlin onboarding example
data class Book(val isbn: String, val title: String, val pageCount: Int)
fun main() {
val books = listOf(
Book("1617293296", "Kotlin in Action", 360),
Book("1680506358", "Programming Kotlin", 450),
Book("1801815720", "Kotlin Design Patterns and Best Practices", 356),
Book("1492082279", "Java to Kotlin", 300),
)
//TestApplicaiton.kt
fun main(args: Array<String>) {
val application = Application.createSpringApplication()
application.addInitializers(AbstractIntegrationTest.Initializer())
application.run(*args)
}
//AbstratIntegrationTest.kt
import org.junit.runner.RunWith
import org.springframework.boot.test.context.SpringBootTest
//lazy singleton
object Singleton {
class Something
val INSTANCE by lazy { Something() }
}
// filtering positive integers
// Initialization-on-demand holder implementation of a lazy singleton
public class Something {
private Something() {}
private static class LazyHolder {
static final Something INSTANCE = new Something();
}
public static Something getInstance() {
@antonarhipov
antonarhipov / settings.kts
Created January 10, 2020 12:33
TeamCity Kotlin DSL - using type inheritance for settings reuse in build configurations
import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot
version = "2019.2"
project {
vcsRoot(ProjectVcs)
buildType(BuildA)
@antonarhipov
antonarhipov / settings.kts
Created January 9, 2020 20:47
TeamCity Kotlin DSL - build configuration with template
version = "2019.2"
project {
vcsRoot(ProjectVcs)
buildType(Build)
template(MyTemplate)
}
object Build : BuildType({
// from https://twitter.com/ZacSweers/status/1199224945072623616
typealias NickName = JvmName
typealias MakeDaggerHappy = JvmSuppressWildcards
typealias ConfuseDagger = JvmWildcard
typealias MaybeThreadSafe = Volatile
typealias MaybeThreadSafeButFun = Synchronized
typealias MakeDaggerHappy2 = JvmStatic
typealias AutoConvertedJavaStuff = Throws
typealias NoTouchy = JvmSynthetic
@antonarhipov
antonarhipov / pom.xml
Created September 24, 2018 08:12
blog-component-branch
<properties>
<component.branch/>
</properties>
<dependency>
<groupId>org.arhan</groupId>
<artifactId>component</artifactId>
<version>1.0${component.branch}-SNAPSHOT</version>
</dependency>
@antonarhipov
antonarhipov / pom.xml
Created September 24, 2018 08:12
blog-property-vcs-branch
<properties>
<project.vcs.branch/>
</properties>