Add jvm8 target key, added jvm 8 option to bytecode tool window

IsJava8 renamed to isJvm8
This commit is contained in:
Michael Bogdanov
2016-04-12 14:52:14 +03:00
committed by Mikhael Bogdanov
parent 96f892d60c
commit 0ae2175a00
3 changed files with 12 additions and 1 deletions
@@ -155,10 +155,11 @@ class GenerationState @JvmOverloads constructor(
val isInlineDisabled: Boolean = configuration.getBoolean(CommonConfigurationKeys.DISABLE_INLINE)
val useTypeTableInSerializer: Boolean = configuration.getBoolean(JVMConfigurationKeys.USE_TYPE_TABLE)
val inheritMultifileParts: Boolean = configuration.getBoolean(JVMConfigurationKeys.INHERIT_MULTIFILE_PARTS)
val isJvm8Target: Boolean = configuration.getBoolean(JVMConfigurationKeys.JVM_8_TARGET)
val rootContext: CodegenContext<*> = RootContext(this)
val classFileVersion: Int = Opcodes.V1_6
val classFileVersion: Int = if (isJvm8Target) Opcodes.V1_8 else Opcodes.V1_6
init {
this.interceptedBuilderFactory = builderFactory
@@ -57,6 +57,9 @@ public class JVMConfigurationKeys {
public static final CompilerConfigurationKey<Boolean> USE_TYPE_TABLE =
CompilerConfigurationKey.create("use type table in serializer");
public static final CompilerConfigurationKey<Boolean> JVM_8_TARGET =
CompilerConfigurationKey.create("compile to jvm 8");
public static final CompilerConfigurationKey<IncrementalCompilationComponents> INCREMENTAL_COMPILATION_COMPONENTS =
CompilerConfigurationKey.create("incremental cache provider");
@@ -127,6 +127,10 @@ public class KotlinBytecodeToolWindow extends JPanel implements Disposable {
configuration.put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, true);
}
if (jvm8Target.isSelected()) {
configuration.put(JVMConfigurationKeys.JVM_8_TARGET, true);
}
return getBytecodeForFile(ktFile, configuration);
}
@@ -175,6 +179,7 @@ public class KotlinBytecodeToolWindow extends JPanel implements Disposable {
private final JCheckBox enableOptimization;
private final JCheckBox enableAssertions;
private final JButton decompile;
private final JCheckBox jvm8Target;
public KotlinBytecodeToolWindow(Project project, ToolWindow toolWindow) {
super(new BorderLayout());
@@ -213,9 +218,11 @@ public class KotlinBytecodeToolWindow extends JPanel implements Disposable {
enableInline = new JCheckBox("Inline", true);
enableOptimization = new JCheckBox("Optimization", true);
enableAssertions = new JCheckBox("Assertions", true);
jvm8Target = new JCheckBox("JVM 8 target", false);
optionPanel.add(enableInline);
optionPanel.add(enableOptimization);
optionPanel.add(enableAssertions);
optionPanel.add(jvm8Target);
new InfinitePeriodicalTask(UPDATE_DELAY, Alarm.ThreadToUse.SWING_THREAD, this, new Computable<LongRunningReadTask>() {
@Override