[java-decompiler] utility classes reorganized

This commit is contained in:
Roman Shevchenko
2016-04-20 14:06:28 +02:00
parent 857dc4d023
commit b96586cc2f
11 changed files with 63 additions and 126 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package org.jetbrains.java.decompiler.main.decompiler;
import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import org.jetbrains.java.decompiler.util.TextUtil;
import java.io.PrintStream;
@@ -33,7 +33,7 @@ public class PrintStreamLogger extends IFernflowerLogger {
@Override
public void writeMessage(String message, Severity severity) {
if (accepts(severity)) {
stream.println(severity.prefix + InterpreterUtil.getIndentString(indent) + message);
stream.println(severity.prefix + TextUtil.getIndentString(indent) + message);
}
}

View File

@@ -28,7 +28,6 @@ import org.jetbrains.java.decompiler.modules.decompiler.vars.VarVersionPair;
import org.jetbrains.java.decompiler.struct.StructClass;
import org.jetbrains.java.decompiler.struct.StructField;
import org.jetbrains.java.decompiler.struct.StructMethod;
import org.jetbrains.java.decompiler.struct.attr.StructGeneralAttribute;
import org.jetbrains.java.decompiler.struct.attr.StructLocalVariableTableAttribute;
import org.jetbrains.java.decompiler.struct.gen.MethodDescriptor;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
@@ -162,9 +161,7 @@ public class ClassWrapper {
// if debug information present and should be used
if (DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_VAR_NAMES)) {
StructLocalVariableTableAttribute attr = (StructLocalVariableTableAttribute)mt.getAttributes().getWithKey(
StructGeneralAttribute.ATTRIBUTE_LOCAL_VARIABLE_TABLE);
StructLocalVariableTableAttribute attr = mt.getLocalVariableAttr();
if (attr != null) {
varProc.setDebugVarNames(attr.getMapVarNames());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,25 +26,17 @@ import org.jetbrains.java.decompiler.struct.StructMethod;
import java.util.HashSet;
import java.util.List;
public class MethodWrapper {
public final RootStatement root;
public final VarProcessor varproc;
public final StructMethod methodStruct;
public final CounterContainer counter;
public final HashSet<String> setOuterVarNames = new HashSet<String>();
public DirectGraph graph;
public List<VarVersionPair> signatureFields;
public boolean decompiledWithErrors;
public final HashSet<String> setOuterVarNames = new HashSet<String>();
public MethodWrapper(RootStatement root, VarProcessor varproc, StructMethod methodStruct, CounterContainer counter) {
this.root = root;
this.varproc = varproc;
@@ -54,9 +46,8 @@ public class MethodWrapper {
public DirectGraph getOrBuildGraph() {
if (graph == null && root != null) {
FlattenStatementsHelper flatthelper = new FlattenStatementsHelper();
graph = flatthelper.buildDirectGraph(root);
graph = new FlattenStatementsHelper().buildDirectGraph(root);
}
return graph;
}
}
}