-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve console help formatting, add -s, and add plugin options
- Loading branch information
Showing
17 changed files
with
191 additions
and
68 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
plugins/idea-not-null/src/main/java/org/vineflower/ideanotnull/IdeaNotNullOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.vineflower.ideanotnull; | ||
|
||
import org.jetbrains.java.decompiler.api.plugin.PluginOptions; | ||
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; | ||
|
||
public interface IdeaNotNullOptions { | ||
@IFernflowerPreferences.Name("Resugar Intellij IDEA @NotNull") | ||
@IFernflowerPreferences.Description("Resugar Intellij IDEA's code generated by @NotNull annotations.") | ||
@IFernflowerPreferences.ShortName("inn") | ||
@IFernflowerPreferences.Type(IFernflowerPreferences.Type.BOOLEAN) | ||
String IDEA_NOT_NULL_ANNOTATION = "resugar-idea-notnull"; | ||
|
||
static void addDefaults(PluginOptions.AddDefaults cons) { | ||
cons.addDefault(IDEA_NOT_NULL_ANNOTATION, "1"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.vineflower.kotlin; | ||
|
||
import org.jetbrains.java.decompiler.api.plugin.PluginOptions; | ||
import org.jetbrains.java.decompiler.main.DecompilerContext; | ||
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences.*; | ||
|
||
import java.util.Map; | ||
|
||
public interface KotlinOptions { | ||
@Name("Show public visibility") | ||
@Description("If a construct is public, show the public keyword") | ||
@Type(Type.BOOLEAN) | ||
String SHOW_PUBLIC_VISIBILITY = "kt-show-public"; | ||
|
||
@Name("Decompile Kotlin") | ||
@Description("Decompile Kotlin classes as Kotlin instead of Java") | ||
@Type(Type.BOOLEAN) | ||
String DECOMPILE_KOTLIN = "kt-decompile-kotlin"; | ||
|
||
static void addDefaults(PluginOptions.AddDefaults cons) { | ||
cons.addDefault(SHOW_PUBLIC_VISIBILITY, "1"); | ||
cons.addDefault(DECOMPILE_KOTLIN, "1"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
plugins/kotlin/src/main/java/org/vineflower/kotlin/KotlinPreferences.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/org/jetbrains/java/decompiler/api/plugin/PluginOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.jetbrains.java.decompiler.api.plugin; | ||
|
||
import org.jetbrains.java.decompiler.util.Pair; | ||
|
||
import java.util.function.BiConsumer; | ||
import java.util.function.Consumer; | ||
|
||
@FunctionalInterface | ||
public interface PluginOptions { | ||
Pair<Class<?>, Consumer<AddDefaults>> provideOptions(); | ||
|
||
@FunctionalInterface | ||
interface AddDefaults { | ||
void addDefault(String key, Object defaultVal); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.jetbrains.java.decompiler.main; | ||
|
||
import org.jetbrains.java.decompiler.main.plugins.JarPluginLoader; | ||
import org.jetbrains.java.decompiler.struct.attr.StructGeneralAttribute; | ||
|
||
public final class Init { | ||
private static boolean initialized = false; | ||
public static void init() { | ||
if (initialized) { | ||
return; | ||
} | ||
|
||
initialized = true; | ||
|
||
// Load all Java code attributes | ||
StructGeneralAttribute.init(); | ||
|
||
// Class-load all plugins that potentially could be included in the jar | ||
JarPluginLoader.init(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.