Addressed review comments + additional test

master
upnotes 6 years ago committed by Roman Shevchenko
parent 1af631be9d
commit 6f70918c3b
  1. 4
      src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
  2. 4
      src/org/jetbrains/java/decompiler/main/rels/MethodProcessorRunnable.java
  3. 1
      testData/src/pkg/TestPrivateEmptyConstructor.java
  4. 8
      testData/src/pkg/TestSynchronizedUnprotected.kt

@ -17,7 +17,7 @@ public interface IFernflowerPreferences {
String HIDE_DEFAULT_CONSTRUCTOR = "hdc";
String DECOMPILE_GENERIC_SIGNATURES = "dgs";
String NO_EXCEPTIONS_RETURN = "ner";
String KT_SYNCHRONIZED_MONITOR = "ksm";
String ENSURE_SYNCHRONIZED_MONITOR = "esm";
String DECOMPILE_ENUM = "den";
String REMOVE_GET_CLASS_NEW = "rgn";
String LITERALS_AS_IS = "lit";
@ -62,7 +62,7 @@ public interface IFernflowerPreferences {
defaults.put(HIDE_DEFAULT_CONSTRUCTOR, "1");
defaults.put(DECOMPILE_GENERIC_SIGNATURES, "0");
defaults.put(NO_EXCEPTIONS_RETURN, "1");
defaults.put(KT_SYNCHRONIZED_MONITOR, "1");
defaults.put(ENSURE_SYNCHRONIZED_MONITOR, "1");
defaults.put(DECOMPILE_ENUM, "1");
defaults.put(REMOVE_GET_CLASS_NEW, "1");
defaults.put(LITERALS_AS_IS, "0");

@ -88,8 +88,8 @@ public class MethodProcessorRunnable implements Runnable {
ExceptionDeobfuscator.removeEmptyRanges(graph);
}
if (DecompilerContext.getOption(IFernflowerPreferences.KT_SYNCHRONIZED_MONITOR)) {
// special case: search for 'synchronized' ranges w/o monitorexit instruction (generated by the Kotlin compiler)
if (DecompilerContext.getOption(IFernflowerPreferences.ENSURE_SYNCHRONIZED_MONITOR)) {
// special case: search for 'synchronized' ranges w/o monitorexit instruction (as generated by Kotlin and Scala)
DeadCodeHelper.extendSynchronizedRangeToMonitorexit(graph);
}

@ -1,3 +1,4 @@
package pkg;
public final class PrivateEmptyConstructor {

@ -0,0 +1,8 @@
object TestSynchronizedUnprotected {
fun test() {
synchronized(this) {
println("Boom")
}
}
}
Loading…
Cancel
Save