summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStiver <stiver.mail@gmail.com>2014-07-08 23:50:14 +0200
committerStiver <stiver.mail@gmail.com>2014-07-08 23:50:14 +0200
commitb3a1c412443b7b658e7a59cbe1f83c82a0f56901 (patch)
tree12155bc9d1d8d34004d0c6092776d28b3cfb519f
parentb668038ed956adee56915f408032bd1d8ac5bf8c (diff)
downloadfernflower-b3a1c412443b7b658e7a59cbe1f83c82a0f56901.tar
fernflower-b3a1c412443b7b658e7a59cbe1f83c82a0f56901.tar.gz
fernflower-b3a1c412443b7b658e7a59cbe1f83c82a0f56901.tar.lz
fernflower-b3a1c412443b7b658e7a59cbe1f83c82a0f56901.tar.xz
fernflower-b3a1c412443b7b658e7a59cbe1f83c82a0f56901.zip
Handling of certain loop types in a finally block
-rw-r--r--src/de/fernflower/main/ClassesProcessor.java15
-rw-r--r--src/de/fernflower/main/decompiler/helper/PrintStreamLogger.java14
-rw-r--r--src/de/fernflower/modules/decompiler/ExprProcessor.java16
3 files changed, 28 insertions, 17 deletions
diff --git a/src/de/fernflower/main/ClassesProcessor.java b/src/de/fernflower/main/ClassesProcessor.java
index 1bd008f..f2a25c9 100644
--- a/src/de/fernflower/main/ClassesProcessor.java
+++ b/src/de/fernflower/main/ClassesProcessor.java
@@ -165,13 +165,14 @@ public class ClassesProcessor {
HashSet<String> setNestedClasses = mapNestedClassReferences.get(superClass);
if(setNestedClasses != null) {
- StructClass scl = supernode.classStruct;
- StructInnerClassesAttribute inner = (StructInnerClassesAttribute)scl.getAttributes().getWithKey("InnerClasses");
- for(int i=0;i<inner.getStringentries().size();i++) {
- String nestedClass = inner.getStringentries().get(i)[0];
- if(!setNestedClasses.contains(nestedClass)) {
- continue;
- }
+
+ StructClass scl = supernode.classStruct;
+ StructInnerClassesAttribute inner = (StructInnerClassesAttribute) scl.getAttributes().getWithKey("InnerClasses");
+ for(int i = 0; i < inner.getStringentries().size(); i++) {
+ String nestedClass = inner.getStringentries().get(i)[0];
+ if (!setNestedClasses.contains(nestedClass)) {
+ continue;
+ }
if(setVisited.contains(nestedClass)) {
continue;
diff --git a/src/de/fernflower/main/decompiler/helper/PrintStreamLogger.java b/src/de/fernflower/main/decompiler/helper/PrintStreamLogger.java
index 7d1de7d..32211b1 100644
--- a/src/de/fernflower/main/decompiler/helper/PrintStreamLogger.java
+++ b/src/de/fernflower/main/decompiler/helper/PrintStreamLogger.java
@@ -35,15 +35,15 @@ public class PrintStreamLogger implements IFernflowerLogger {
public void writeMessage(String message, int severity) {
- if(severity >= this.severity) {
- stream.println(InterpreterUtil.getIndentString(indent)+names[severity]+": "+message);
- }
+ if (severity >= this.severity) {
+ stream.println(InterpreterUtil.getIndentString(indent) + names[severity] + ": " + message);
+ }
}
- public void writeMessage(String message, Throwable t) {
- t.printStackTrace(stream);
- writeMessage(message, ERROR);
- }
+ public void writeMessage(String message, Throwable t) {
+ t.printStackTrace(stream);
+ writeMessage(message, ERROR);
+ }
public void startClass(String classname) {
stream.println(InterpreterUtil.getIndentString(indent++)+"Processing class "+classname+" ...");
diff --git a/src/de/fernflower/modules/decompiler/ExprProcessor.java b/src/de/fernflower/modules/decompiler/ExprProcessor.java
index 64962c5..60ecc86 100644
--- a/src/de/fernflower/modules/decompiler/ExprProcessor.java
+++ b/src/de/fernflower/modules/decompiler/ExprProcessor.java
@@ -129,9 +129,11 @@ public class ExprProcessor implements CodeConstants {
FlattenStatementsHelper flatthelper = new FlattenStatementsHelper();
DirectGraph dgraph = flatthelper.buildDirectGraph(root);
- // try {
- // DotExporter.toDotFile(dgraph, new File("c:\\Temp\\gr12_my.dot"));
- // } catch(Exception ex) {ex.printStackTrace();}
+// try {
+// DotExporter.toDotFile(dgraph, new File("c:\\Temp\\gr12_my.dot"));
+// } catch (Exception ex) {
+// ex.printStackTrace();
+// }
// collect finally entry points
Set<String> setFinallyShortRangeEntryPoints = new HashSet<String>();
@@ -212,6 +214,14 @@ public class ExprProcessor implements CodeConstants {
// not be null at this point
}
+ // handling of entry point loops
+ int succ_entry_index = ndentrypoints.indexOf(nd.id);
+ if(succ_entry_index >= 0) { // we are in a loop (e.g. continue in a finally block), drop all entry points in the list beginning with succ_entry_index
+ for(int elements_to_remove = ndentrypoints.size() - succ_entry_index; elements_to_remove > 0; elements_to_remove--) {
+ ndentrypoints.removeLast();
+ }
+ }
+
String ndentrykey = buildEntryPointKey(ndentrypoints);
if (!mapSucc.containsKey(ndentrykey)) {