一个Intellij / Android Studio插件,以帮助您可视化代码中的side效果
一个Intellij / Android Studio插件,以帮助您可视化代码中的side效果
Android Android Stu
共325Star
详细介绍
Here Be Dragons
Here be dragons is an Intellij/Android Studio plugin that let's you annotate your impure Java methods with the @SideEffect
annotation and shows a little dragon icon in the gutter when you call them.
Why would I want to do this?
When writing functional style code, isolating impure and pure functions becomes very important. This helps you visually identify which methods are impure when a bunch of methods are being called in a code block.
For a beginner friendly introduction to functional programming in Android, please checkout out my blog series.
Installation
Install the plugin
Download the plugin jar and select "Install Plugin From Disk" in IntelliJ's plugin preferences.
Add the annotation library
Add the jcenter repository to your gradle build file if it's not already present:
repositories {
jcenter()
}
Next, add the lib containing the @SideEffect
annotation as a dependency:
dependencies {
compile 'com.anupcowkur:here-be-dragons-annotation:1.0.1'
}
Usage
Simpy add the @SideEffect
annotation to any method you want like this:
import com.anupcowkur.herebedragons.SideEffect;
public class Test {
@SideEffect
public void foo() {
// do some impure things
}
}
And when you call the method anywhere, you'll see the dragon icon show up in the IDE gutter.
License
This project is licensed under the MIT License
-
78 Star
-
6341 Star
-
222 Star
-
737 Star