From 8ee7853268d029d6b5f585d0d2fe40560811389a Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 14 Aug 2018 17:47:50 +0200 Subject: [PATCH] add override --- .../java/decompiler/code/InstructionSequence.java | 3 ++- .../decompiler/code/SimpleInstructionSequence.java | 3 ++- .../java/decompiler/code/cfg/BasicBlock.java | 3 ++- .../main/decompiler/PrintStreamLogger.java | 3 ++- .../decompiler/modules/decompiler/ExprentStack.java | 4 +++- .../deobfuscator/ExceptionDeobfuscator.java | 4 +++- .../modules/decompiler/exps/ArrayExprent.java | 7 ++++--- .../modules/decompiler/exps/ConstExprent.java | 5 ++--- .../decompiler/stats/BasicBlockStatement.java | 8 ++++---- .../modules/decompiler/stats/CatchAllStatement.java | 8 +++++--- .../modules/decompiler/stats/CatchStatement.java | 4 +++- .../modules/decompiler/stats/DoStatement.java | 6 +++++- .../modules/decompiler/stats/GeneralStatement.java | 7 +++---- .../modules/decompiler/stats/IfStatement.java | 9 ++++++++- .../modules/decompiler/stats/RootStatement.java | 7 +++---- .../modules/decompiler/stats/SequenceStatement.java | 8 ++++---- .../modules/decompiler/stats/SwitchStatement.java | 13 +++++++++---- .../decompiler/stats/SynchronizedStatement.java | 13 +++++++++---- .../modules/decompiler/vars/VarVersionNode.java | 3 ++- .../modules/decompiler/vars/VarVersionsGraph.java | 4 +++- .../java/decompiler/util/FastFixedSetFactory.java | 6 +++++- .../java/decompiler/util/FastSparseSetFactory.java | 6 +++++- .../jetbrains/java/decompiler/util/ListStack.java | 4 +++- .../java/decompiler/util/SFormsFastMapDirect.java | 5 ++++- .../java/decompiler/util/VBStyleCollection.java | 9 ++++++++- 25 files changed, 103 insertions(+), 49 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/code/InstructionSequence.java b/src/org/jetbrains/java/decompiler/code/InstructionSequence.java index 41a11df..3d0cab0 100644 --- a/src/org/jetbrains/java/decompiler/code/InstructionSequence.java +++ b/src/org/jetbrains/java/decompiler/code/InstructionSequence.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.code; import org.jetbrains.java.decompiler.main.DecompilerContext; @@ -30,6 +30,7 @@ public abstract class InstructionSequence { // ***************************************************************************** // to nbe overwritten + @Override public InstructionSequence clone() { return null; } diff --git a/src/org/jetbrains/java/decompiler/code/SimpleInstructionSequence.java b/src/org/jetbrains/java/decompiler/code/SimpleInstructionSequence.java index 4a8399a..0b62c51 100644 --- a/src/org/jetbrains/java/decompiler/code/SimpleInstructionSequence.java +++ b/src/org/jetbrains/java/decompiler/code/SimpleInstructionSequence.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.code; import org.jetbrains.java.decompiler.util.VBStyleCollection; @@ -12,6 +12,7 @@ public class SimpleInstructionSequence extends InstructionSequence { super(collinstr); } + @Override public SimpleInstructionSequence clone() { SimpleInstructionSequence newseq = new SimpleInstructionSequence(collinstr.clone()); newseq.setPointer(this.getPointer()); diff --git a/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java b/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java index 66d7ffb..265ffca 100644 --- a/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java +++ b/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.code.cfg; import org.jetbrains.java.decompiler.code.Instruction; @@ -160,6 +160,7 @@ public class BasicBlock implements IGraphNode { return instrOldOffsets; } + @Override public List getPredecessors() { List lst = new ArrayList<>(preds); lst.addAll(predExceptions); diff --git a/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java b/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java index cbc03fd..ff3b9b3 100644 --- a/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java +++ b/src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.main.decompiler; import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger; @@ -71,6 +71,7 @@ public class PrintStreamLogger extends IFernflowerLogger { } } + @Override public void endMethod() { if (accepts(Severity.INFO)) { --indent; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprentStack.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprentStack.java index f1db32f..e0bb1b2 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprentStack.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprentStack.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler; import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent; @@ -14,11 +14,13 @@ public class ExprentStack extends ListStack { pointer = list.getPointer(); } + @Override public Exprent pop() { return this.remove(--pointer); } + @Override public ExprentStack clone() { return new ExprentStack(this); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java index 261f22c..676f448 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.deobfuscator; import org.jetbrains.java.decompiler.code.CodeConstants; @@ -211,10 +211,12 @@ public class ExceptionDeobfuscator { public static void removeCircularRanges(final ControlFlowGraph graph) { GenericDominatorEngine engine = new GenericDominatorEngine(new IGraph() { + @Override public List getReversePostOrderList() { return graph.getReversePostOrder(); } + @Override public Set getRoots() { return new HashSet<>(Collections.singletonList(graph.getFirst())); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java index bc482a2..753a0a6 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.exps; import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer; @@ -44,10 +42,12 @@ public class ArrayExprent extends Exprent { } } + @Override public int getExprentUse() { return array.getExprentUse() & index.getExprentUse() & Exprent.MULTIPLE_USES; } + @Override public CheckTypesResult checkExprTypeBounds() { CheckTypesResult result = new CheckTypesResult(); result.addMinTypeExprent(index, VarType.VARTYPE_BYTECHAR); @@ -55,6 +55,7 @@ public class ArrayExprent extends Exprent { return result; } + @Override public List getAllExprents() { List lst = new ArrayList<>(); lst.add(array); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java index 402b9e7..d250db9 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.exps; import org.jetbrains.java.decompiler.code.CodeConstants; @@ -97,6 +95,7 @@ public class ConstExprent extends Exprent { return Exprent.MULTIPLE_USES | Exprent.SIDE_EFFECTS_FREE; } + @Override public List getAllExprents() { return new ArrayList<>(); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/BasicBlockStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/BasicBlockStatement.java index 377d212..262a01f 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/BasicBlockStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/BasicBlockStatement.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.stats; import org.jetbrains.java.decompiler.code.CodeConstants; @@ -8,10 +6,10 @@ import org.jetbrains.java.decompiler.code.Instruction; import org.jetbrains.java.decompiler.code.SimpleInstructionSequence; import org.jetbrains.java.decompiler.code.cfg.BasicBlock; import org.jetbrains.java.decompiler.main.DecompilerContext; -import org.jetbrains.java.decompiler.util.TextBuffer; import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer; import org.jetbrains.java.decompiler.main.collectors.CounterContainer; import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; +import org.jetbrains.java.decompiler.util.TextBuffer; public class BasicBlockStatement extends Statement { @@ -55,12 +53,14 @@ public class BasicBlockStatement extends Statement { // public methods // ***************************************************************************** + @Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { TextBuffer tb = ExprProcessor.listToJava(varDefinitions, indent, tracer); tb.append(ExprProcessor.listToJava(exprents, indent, tracer)); return tb; } + @Override public Statement getSimpleCopy() { BasicBlock newblock = new BasicBlock( diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java index 37cd85a..376abe5 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.stats; import org.jetbrains.java.decompiler.code.CodeConstants; @@ -96,6 +94,7 @@ public class CatchAllStatement extends Statement { return null; } + @Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { String new_line_separator = DecompilerContext.getNewLineSeparator(); @@ -146,6 +145,7 @@ public class CatchAllStatement extends Statement { return buf; } + @Override public void replaceStatement(Statement oldstat, Statement newstat) { if (handler == oldstat) { @@ -155,6 +155,7 @@ public class CatchAllStatement extends Statement { super.replaceStatement(oldstat, newstat); } + @Override public Statement getSimpleCopy() { CatchAllStatement cas = new CatchAllStatement(); @@ -176,6 +177,7 @@ public class CatchAllStatement extends Statement { return cas; } + @Override public void initSimpleCopy() { first = stats.get(0); handler = stats.get(1); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java index 2c32d4c..652931a 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java @@ -4,7 +4,6 @@ package org.jetbrains.java.decompiler.modules.decompiler.stats; import org.jetbrains.java.decompiler.code.CodeConstants; import org.jetbrains.java.decompiler.code.cfg.BasicBlock; import org.jetbrains.java.decompiler.main.DecompilerContext; -import org.jetbrains.java.decompiler.util.TextBuffer; import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer; import org.jetbrains.java.decompiler.main.collectors.CounterContainer; import org.jetbrains.java.decompiler.modules.decompiler.DecHelper; @@ -12,6 +11,7 @@ import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; import org.jetbrains.java.decompiler.modules.decompiler.StatEdge; import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent; import org.jetbrains.java.decompiler.struct.gen.VarType; +import org.jetbrains.java.decompiler.util.TextBuffer; import java.util.ArrayList; import java.util.List; @@ -130,6 +130,7 @@ public class CatchStatement extends Statement { return null; } + @Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { TextBuffer buf = new TextBuffer(); @@ -178,6 +179,7 @@ public class CatchStatement extends Statement { return buf; } + @Override public Statement getSimpleCopy() { CatchStatement cs = new CatchStatement(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java index 8abfc29..f9a149f 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java @@ -1,11 +1,11 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.stats; -import org.jetbrains.java.decompiler.util.TextBuffer; import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer; import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; import org.jetbrains.java.decompiler.modules.decompiler.StatEdge; import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent; +import org.jetbrains.java.decompiler.util.TextBuffer; import java.util.ArrayList; import java.util.List; @@ -77,6 +77,7 @@ public class DoStatement extends Statement { return null; } + @Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { TextBuffer buf = new TextBuffer(); @@ -126,6 +127,7 @@ public class DoStatement extends Statement { return buf; } + @Override public List getSequentialObjects() { List lst = new ArrayList<>(); @@ -152,6 +154,7 @@ public class DoStatement extends Statement { return lst; } + @Override public void replaceExprent(Exprent oldexpr, Exprent newexpr) { if (initExprent.get(0) == oldexpr) { initExprent.set(0, newexpr); @@ -164,6 +167,7 @@ public class DoStatement extends Statement { } } + @Override public Statement getSimpleCopy() { return new DoStatement(); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/GeneralStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/GeneralStatement.java index fffd34d..56ada55 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/GeneralStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/GeneralStatement.java @@ -1,10 +1,8 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.stats; -import org.jetbrains.java.decompiler.util.TextBuffer; import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer; +import org.jetbrains.java.decompiler.util.TextBuffer; import java.util.Collection; import java.util.HashSet; @@ -41,6 +39,7 @@ public class GeneralStatement extends Statement { // public methods // ***************************************************************************** + @Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { TextBuffer buf = new TextBuffer(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java index 46fba5e..bf18c51 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java @@ -1,7 +1,6 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.stats; -import org.jetbrains.java.decompiler.util.TextBuffer; import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer; import org.jetbrains.java.decompiler.modules.decompiler.DecHelper; import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; @@ -11,6 +10,7 @@ import org.jetbrains.java.decompiler.modules.decompiler.exps.IfExprent; import org.jetbrains.java.decompiler.struct.match.IMatchable; import org.jetbrains.java.decompiler.struct.match.MatchEngine; import org.jetbrains.java.decompiler.struct.match.MatchNode; +import org.jetbrains.java.decompiler.util.TextBuffer; import org.jetbrains.java.decompiler.util.TextUtil; import java.util.ArrayList; @@ -187,6 +187,7 @@ public class IfStatement extends Statement { return null; } + @Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { TextBuffer buf = new TextBuffer(); @@ -266,6 +267,7 @@ public class IfStatement extends Statement { return buf; } + @Override public void initExprents() { IfExprent ifexpr = (IfExprent)first.getExprents().remove(first.getExprents().size() - 1); @@ -278,6 +280,7 @@ public class IfStatement extends Statement { headexprent.set(0, ifexpr); } + @Override public List getSequentialObjects() { List lst = new ArrayList<>(stats); @@ -286,12 +289,14 @@ public class IfStatement extends Statement { return lst; } + @Override public void replaceExprent(Exprent oldexpr, Exprent newexpr) { if (headexprent.get(0) == oldexpr) { headexprent.set(0, newexpr); } } + @Override public void replaceStatement(Statement oldstat, Statement newstat) { super.replaceStatement(oldstat, newstat); @@ -324,6 +329,7 @@ public class IfStatement extends Statement { } } + @Override public Statement getSimpleCopy() { IfStatement is = new IfStatement(); @@ -333,6 +339,7 @@ public class IfStatement extends Statement { return is; } + @Override public void initSimpleCopy() { first = stats.get(0); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/RootStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/RootStatement.java index 5133036..61eca33 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/RootStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/RootStatement.java @@ -1,11 +1,9 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.stats; -import org.jetbrains.java.decompiler.util.TextBuffer; import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer; import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; +import org.jetbrains.java.decompiler.util.TextBuffer; public class RootStatement extends Statement { private final DummyExitStatement dummyExit; @@ -20,6 +18,7 @@ public class RootStatement extends Statement { first.setParent(this); } + @Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { return ExprProcessor.listToJava(varDefinitions, indent, tracer).append(first.toJava(indent, tracer)); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java index 8122b5c..7acad0c 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java @@ -1,13 +1,11 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.stats; -import org.jetbrains.java.decompiler.util.TextBuffer; import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer; import org.jetbrains.java.decompiler.modules.decompiler.DecHelper; import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; import org.jetbrains.java.decompiler.modules.decompiler.StatEdge; +import org.jetbrains.java.decompiler.util.TextBuffer; import java.util.Arrays; import java.util.List; @@ -86,6 +84,7 @@ public class SequenceStatement extends Statement { return null; } + @Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { TextBuffer buf = new TextBuffer(); boolean islabeled = isLabeled(); @@ -122,6 +121,7 @@ public class SequenceStatement extends Statement { return buf; } + @Override public Statement getSimpleCopy() { return new SequenceStatement(); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java index ae41af7..6633d80 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java @@ -1,12 +1,9 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.stats; import org.jetbrains.java.decompiler.code.SwitchInstruction; import org.jetbrains.java.decompiler.code.cfg.BasicBlock; import org.jetbrains.java.decompiler.main.DecompilerContext; -import org.jetbrains.java.decompiler.util.TextBuffer; import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer; import org.jetbrains.java.decompiler.main.collectors.CounterContainer; import org.jetbrains.java.decompiler.modules.decompiler.DecHelper; @@ -18,6 +15,7 @@ import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent; import org.jetbrains.java.decompiler.modules.decompiler.exps.FieldExprent; import org.jetbrains.java.decompiler.modules.decompiler.exps.SwitchExprent; import org.jetbrains.java.decompiler.struct.gen.VarType; +import org.jetbrains.java.decompiler.util.TextBuffer; import java.util.*; @@ -97,6 +95,7 @@ public class SwitchStatement extends Statement { return null; } + @Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { SwitchHelper.simplify(this); @@ -153,6 +152,7 @@ public class SwitchStatement extends Statement { return buf; } + @Override public void initExprents() { SwitchExprent swexpr = (SwitchExprent)first.getExprents().remove(first.getExprents().size() - 1); swexpr.setCaseValues(caseValues); @@ -160,6 +160,7 @@ public class SwitchStatement extends Statement { headexprent.set(0, swexpr); } + @Override public List getSequentialObjects() { List lst = new ArrayList<>(stats); @@ -168,12 +169,14 @@ public class SwitchStatement extends Statement { return lst; } + @Override public void replaceExprent(Exprent oldexpr, Exprent newexpr) { if (headexprent.get(0) == oldexpr) { headexprent.set(0, newexpr); } } + @Override public void replaceStatement(Statement oldstat, Statement newstat) { for (int i = 0; i < caseStatements.size(); i++) { @@ -185,10 +188,12 @@ public class SwitchStatement extends Statement { super.replaceStatement(oldstat, newstat); } + @Override public Statement getSimpleCopy() { return new SwitchStatement(); } + @Override public void initSimpleCopy() { first = stats.get(0); default_edge = first.getSuccessorEdges(Statement.STATEDGE_DIRECT_ALL).get(0); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java index 90408d7..bc56583 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java @@ -1,16 +1,14 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.stats; import org.jetbrains.java.decompiler.code.CodeConstants; import org.jetbrains.java.decompiler.code.cfg.BasicBlock; -import org.jetbrains.java.decompiler.util.TextBuffer; import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer; import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; import org.jetbrains.java.decompiler.modules.decompiler.SequenceHelper; import org.jetbrains.java.decompiler.modules.decompiler.StatEdge; import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent; +import org.jetbrains.java.decompiler.util.TextBuffer; import java.util.ArrayList; import java.util.List; @@ -58,6 +56,7 @@ public class SynchronizedStatement extends Statement { // public methods // ***************************************************************************** + @Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { TextBuffer buf = new TextBuffer(); buf.append(ExprProcessor.listToJava(varDefinitions, indent, tracer)); @@ -88,10 +87,12 @@ public class SynchronizedStatement extends Statement { } } + @Override public void initExprents() { headexprent.set(0, first.getExprents().remove(first.getExprents().size() - 1)); } + @Override public List getSequentialObjects() { List lst = new ArrayList<>(stats); @@ -100,12 +101,14 @@ public class SynchronizedStatement extends Statement { return lst; } + @Override public void replaceExprent(Exprent oldexpr, Exprent newexpr) { if (headexprent.get(0) == oldexpr) { headexprent.set(0, newexpr); } } + @Override public void replaceStatement(Statement oldstat, Statement newstat) { if (body == oldstat) { @@ -122,10 +125,12 @@ public class SynchronizedStatement extends Statement { stats.removeWithKey(exc.id); } + @Override public Statement getSimpleCopy() { return new SynchronizedStatement(); } + @Override public void initSimpleCopy() { first = stats.get(0); body = stats.get(1); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionNode.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionNode.java index 6c7ae33..914995e 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionNode.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionNode.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.vars; import org.jetbrains.java.decompiler.modules.decompiler.decompose.IGraphNode; @@ -31,6 +31,7 @@ public class VarVersionNode implements IGraphNode { this.version = version; } + @Override public List getPredecessors() { List lst = new ArrayList<>(preds.size()); for (VarVersionEdge edge : preds) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java index ef0fc4b..e295915 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.modules.decompiler.vars; import org.jetbrains.java.decompiler.modules.decompiler.decompose.GenericDominatorEngine; @@ -72,10 +72,12 @@ public class VarVersionsGraph { } engine = new GenericDominatorEngine(new IGraph() { + @Override public List getReversePostOrderList() { return getReversedPostOrder(roots); } + @Override public Set getRoots() { return new HashSet(roots); } diff --git a/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java index 80ac7d6..d05b7d4 100644 --- a/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java +++ b/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.util; import java.util.Collection; @@ -174,6 +174,7 @@ public class FastFixedSetFactory { return true; } + @Override public Iterator iterator() { return new FastFixedSetIterator<>(this); } @@ -288,11 +289,13 @@ public class FastFixedSetFactory { return -1; } + @Override public boolean hasNext() { next_pointer = getNextIndex(pointer); return (next_pointer >= 0); } + @Override public E next() { if (next_pointer >= 0) { pointer = next_pointer; @@ -308,6 +311,7 @@ public class FastFixedSetFactory { return pointer < size ? colValuesInternal.getKey(pointer) : null; } + @Override public void remove() { int[] index = colValuesInternal.get(pointer); data[index[0]] &= ~index[1]; diff --git a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java index 91cdabc..08bf156 100644 --- a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java +++ b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.util; import java.util.Collection; @@ -317,6 +317,7 @@ public class FastSparseSetFactory { return data.length == 0 || (next[0] == 0 && data[0] == 0); } + @Override public Iterator iterator() { return new FastSparseSetIterator<>(this); } @@ -407,11 +408,13 @@ public class FastSparseSetFactory { return -1; } + @Override public boolean hasNext() { next_pointer = getNextIndex(pointer); return (next_pointer >= 0); } + @Override public E next() { if (next_pointer >= 0) { pointer = next_pointer; @@ -427,6 +430,7 @@ public class FastSparseSetFactory { return pointer < size ? colValuesInternal.getKey(pointer) : null; } + @Override public void remove() { int[] index = colValuesInternal.get(pointer); data[index[0]] &= ~index[1]; diff --git a/src/org/jetbrains/java/decompiler/util/ListStack.java b/src/org/jetbrains/java/decompiler/util/ListStack.java index e1d169f..d5ae774 100644 --- a/src/org/jetbrains/java/decompiler/util/ListStack.java +++ b/src/org/jetbrains/java/decompiler/util/ListStack.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.util; import java.util.ArrayList; @@ -14,6 +14,7 @@ public class ListStack extends ArrayList { super(list); } + @Override @SuppressWarnings("MethodDoesntCallSuperMethod") public ListStack clone() { ListStack copy = new ListStack<>(this); @@ -62,6 +63,7 @@ public class ListStack extends ArrayList { pointer++; } + @Override public void clear() { super.clear(); pointer = 0; diff --git a/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java b/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java index d1465c6..16a0484 100644 --- a/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java +++ b/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.util; import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent; @@ -348,14 +348,17 @@ public class SFormsFastMapDirect { private final Integer var = key; private final FastSparseSet val = ent; + @Override public Integer getKey() { return var; } + @Override public FastSparseSet getValue() { return val; } + @Override public FastSparseSet setValue(FastSparseSet newvalue) { return null; } diff --git a/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java b/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java index 8200843..4454337 100644 --- a/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java +++ b/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.util; import java.util.ArrayList; @@ -21,16 +21,19 @@ public class VBStyleCollection extends ArrayList { map = new HashMap<>(initialCapacity); } + @Override public boolean add(E element) { lstKeys.add(null); super.add(element); return true; } + @Override public boolean remove(Object element) { // TODO: error on void remove(E element) throw new RuntimeException("not implemented!"); } + @Override public boolean addAll(Collection c) { for (int i = c.size() - 1; i >= 0; i--) { lstKeys.add(null); @@ -67,6 +70,7 @@ public class VBStyleCollection extends ArrayList { return null; } + @Override public void add(int index, E element) { addToListIndex(index, 1); lstKeys.add(index, null); @@ -88,6 +92,7 @@ public class VBStyleCollection extends ArrayList { map.remove(key); } + @Override public E remove(int index) { addToListIndex(index + 1, -1); K obj = lstKeys.get(index); @@ -118,12 +123,14 @@ public class VBStyleCollection extends ArrayList { return map.containsKey(key); } + @Override public void clear() { map.clear(); lstKeys.clear(); super.clear(); } + @Override public VBStyleCollection clone() { VBStyleCollection c = new VBStyleCollection<>(); c.addAll(new ArrayList<>(this));