From 262d580ccc7c0c860b7d15ad15e19dbd7ea2377a Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 27 Mar 2015 12:56:07 +0300 Subject: [PATCH] decompiler: cleanup --- .../main/ClassReference14Processor.java | 4 +-- .../decompiler/main/ClassesProcessor.java | 8 ++--- .../main/extern/IIdentifierRenamer.java | 4 +-- .../decompiler/main/rels/MethodWrapper.java | 12 ++++---- .../modules/decompiler/IfHelper.java | 6 ++-- .../modules/decompiler/SequenceHelper.java | 4 +-- .../decompiler/SimplifyExprentsHelper.java | 2 +- .../IrreducibleCFGDeobfuscator.java | 6 ++-- .../modules/decompiler/exps/ExitExprent.java | 3 +- .../decompiler/exps/FunctionExprent.java | 3 -- .../decompiler/sforms/DirectGraph.java | 12 ++++---- .../modules/decompiler/sforms/DirectNode.java | 12 ++++---- .../sforms/FlattenStatementsHelper.java | 30 +++++++++---------- .../modules/decompiler/stats/IfStatement.java | 7 ++--- .../modules/decompiler/stats/Statement.java | 6 ++-- .../decompiler/vars/CheckTypesResult.java | 6 ++-- .../decompiler/vars/VarVersionEdge.java | 6 ++-- .../decompiler/vars/VarVersionNode.java | 10 +++---- .../decompiler/vars/VarVersionsGraph.java | 4 +-- .../struct/consts/ConstantPool.java | 2 +- .../gen/generics/GenericClassDescriptor.java | 8 ++--- .../gen/generics/GenericMethodDescriptor.java | 10 +++---- .../decompiler/struct/lazy/LazyLoader.java | 8 ++--- .../decompiler/struct/match/IMatchable.java | 21 +++++++++++-- .../decompiler/struct/match/MatchNode.java | 4 +-- .../java/decompiler/util/FastSetFactory.java | 2 +- .../decompiler/util/FastSparseSetFactory.java | 2 +- .../java/decompiler/util/InterpreterUtil.java | 3 +- 28 files changed, 107 insertions(+), 98 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java b/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java index adce2b7..677f457 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java +++ b/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java @@ -38,9 +38,9 @@ import java.util.Map.Entry; public class ClassReference14Processor { - public ExitExprent bodyexprent; + public final ExitExprent bodyexprent; - public ExitExprent handlerexprent; + public final ExitExprent handlerexprent; public ClassReference14Processor() { diff --git a/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java b/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java index d345b71..b27e343 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java @@ -353,14 +353,14 @@ public class ClassesProcessor { public int type; public int access; public String simpleName; - public StructClass classStruct; + public final StructClass classStruct; private ClassWrapper wrapper; public String enclosingMethod; public InvocationExprent superInvocation; - public Map mapFieldsToVars = new HashMap(); + public final Map mapFieldsToVars = new HashMap(); public VarType anonymousClassType; - public List nested = new ArrayList(); - public Set enclosingClasses = new HashSet(); + public final List nested = new ArrayList(); + public final Set enclosingClasses = new HashSet(); public ClassNode parent; public LambdaInformation lambdaInformation; public boolean namelessConstructorStub = false; diff --git a/src/org/jetbrains/java/decompiler/main/extern/IIdentifierRenamer.java b/src/org/jetbrains/java/decompiler/main/extern/IIdentifierRenamer.java index 93692e4..5513528 100644 --- a/src/org/jetbrains/java/decompiler/main/extern/IIdentifierRenamer.java +++ b/src/org/jetbrains/java/decompiler/main/extern/IIdentifierRenamer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -17,7 +17,7 @@ package org.jetbrains.java.decompiler.main.extern; public interface IIdentifierRenamer { - enum Type {ELEMENT_CLASS, ELEMENT_FIELD, ELEMENT_METHOD}; + enum Type {ELEMENT_CLASS, ELEMENT_FIELD, ELEMENT_METHOD} boolean toBeRenamed(Type elementType, String className, String element, String descriptor); diff --git a/src/org/jetbrains/java/decompiler/main/rels/MethodWrapper.java b/src/org/jetbrains/java/decompiler/main/rels/MethodWrapper.java index 9d99a81..0f44e42 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/MethodWrapper.java +++ b/src/org/jetbrains/java/decompiler/main/rels/MethodWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -29,13 +29,13 @@ import java.util.List; public class MethodWrapper { - public RootStatement root; + public final RootStatement root; - public VarProcessor varproc; + public final VarProcessor varproc; - public StructMethod methodStruct; + public final StructMethod methodStruct; - public CounterContainer counter; + public final CounterContainer counter; public DirectGraph graph; @@ -43,7 +43,7 @@ public class MethodWrapper { public boolean decompiledWithErrors; - public HashSet setOuterVarNames = new HashSet(); + public final HashSet setOuterVarNames = new HashSet(); public MethodWrapper(RootStatement root, VarProcessor varproc, StructMethod methodStruct, CounterContainer counter) { this.root = root; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java index 97c4f8d..3adf70c 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java @@ -733,10 +733,10 @@ public class IfHelper { } private static class IfNode { - public Statement value; + public final Statement value; - public List succs = new ArrayList(); - public List edgetypes = new ArrayList(); + public final List succs = new ArrayList(); + public final List edgetypes = new ArrayList(); public IfNode(Statement value) { this.value = value; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java index 063d201..75bbd39 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -244,7 +244,7 @@ public class SequenceHelper { while (true) { - Statement next = null; + Statement next; Statement current = null; boolean found = false; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java index 97c7d72..ddf6865 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java @@ -51,7 +51,7 @@ import org.jetbrains.java.decompiler.util.InterpreterUtil; public class SimplifyExprentsHelper { - static MatchEngine class14Builder = new MatchEngine(); + static final MatchEngine class14Builder = new MatchEngine(); private final boolean firstInvocation; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java index 31e171e..42ba76f 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -31,8 +31,8 @@ public class IrreducibleCFGDeobfuscator { class Node { public Integer id; - public Set preds = new HashSet(); - public Set succs = new HashSet(); + public final Set preds = new HashSet(); + public final Set succs = new HashSet(); public Node(Integer id) { this.id = id; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExitExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExitExprent.java index f0aa7d2..7b4a5ac 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExitExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExitExprent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -33,7 +33,6 @@ import org.jetbrains.java.decompiler.util.InterpreterUtil; import java.util.ArrayList; import java.util.List; import java.util.Set; -import java.util.Map.Entry; public class ExitExprent extends Exprent { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java index 92ae381..48206a7 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java @@ -21,15 +21,12 @@ import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer; import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor; import org.jetbrains.java.decompiler.modules.decompiler.vars.CheckTypesResult; import org.jetbrains.java.decompiler.struct.gen.VarType; -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.struct.match.IMatchable.MatchProperties; import org.jetbrains.java.decompiler.util.InterpreterUtil; import org.jetbrains.java.decompiler.util.ListStack; import java.util.*; -import java.util.Map.Entry; public class FunctionExprent extends Exprent { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java index b24b72c..abd844c 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -27,21 +27,21 @@ import java.util.List; public class DirectGraph { - public VBStyleCollection nodes = new VBStyleCollection(); + public final VBStyleCollection nodes = new VBStyleCollection(); public DirectNode first; // exit, [source, destination] - public HashMap> mapShortRangeFinallyPaths = new HashMap>(); + public final HashMap> mapShortRangeFinallyPaths = new HashMap>(); // exit, [source, destination] - public HashMap> mapLongRangeFinallyPaths = new HashMap>(); + public final HashMap> mapLongRangeFinallyPaths = new HashMap>(); // negative if branches (recorded for handling of && and ||) - public HashMap mapNegIfBranch = new HashMap(); + public final HashMap mapNegIfBranch = new HashMap(); // nodes, that are exception exits of a finally block with monitor variable - public HashMap mapFinallyMonitorExceptionPathExits = new HashMap(); + public final HashMap mapFinallyMonitorExceptionPathExits = new HashMap(); public void sortReversePostOrder() { LinkedList res = new LinkedList(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectNode.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectNode.java index 73303ec..8a39531 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectNode.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -32,19 +32,19 @@ public class DirectNode { public static final int NODE_INCREMENT = 5; public static final int NODE_TRY = 6; - public int type; + public final int type; - public String id; + public final String id; public BasicBlockStatement block; - public Statement statement; + public final Statement statement; public List exprents = new ArrayList(); - public List succs = new ArrayList(); + public final List succs = new ArrayList(); - public List preds = new ArrayList(); + public final List preds = new ArrayList(); public DirectNode(int type, Statement statement, String id) { this.type = type; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java index c2019ab..971ace5 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java @@ -489,9 +489,9 @@ public class FlattenStatementsHelper { } public static class FinallyPathWrapper { - public String source; - public String destination; - public String entry; + public final String source; + public final String destination; + public final String entry; private FinallyPathWrapper(String source, String destination, String entry) { this.source = source; @@ -522,16 +522,16 @@ public class FlattenStatementsHelper { private static class StackEntry { - public CatchAllStatement catchstatement; - public boolean state; - public int edgetype; - public boolean isFinallyExceptionPath; + public final CatchAllStatement catchstatement; + public final boolean state; + public final int edgetype; + public final boolean isFinallyExceptionPath; - public Statement destination; - public Statement finallyShortRangeEntry; - public Statement finallyLongRangeEntry; - public DirectNode finallyShortRangeSource; - public DirectNode finallyLongRangeSource; + public final Statement destination; + public final Statement finallyShortRangeEntry; + public final Statement finallyLongRangeEntry; + public final DirectNode finallyShortRangeSource; + public final DirectNode finallyLongRangeSource; public StackEntry(CatchAllStatement catchstatement, boolean state, @@ -561,9 +561,9 @@ public class FlattenStatementsHelper { } private static class Edge { - public String sourceid; - public Integer statid; - public int edgetype; + public final String sourceid; + public final Integer statid; + public final int edgetype; public Edge(String sourceid, Integer statid, int edgetype) { this.sourceid = sourceid; 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 308435a..8be0dcc 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java @@ -30,13 +30,12 @@ import org.jetbrains.java.decompiler.util.InterpreterUtil; import java.util.ArrayList; import java.util.List; -import java.util.Map.Entry; public class IfStatement extends Statement { - public static int IFTYPE_IF = 0; - public static int IFTYPE_IFELSE = 1; + public static final int IFTYPE_IF = 0; + public static final int IFTYPE_IFELSE = 1; public int iftype; @@ -54,7 +53,7 @@ public class IfStatement extends Statement { private boolean iffflag; - private List headexprent = new ArrayList(); // contains IfExprent + private final List headexprent = new ArrayList(); // contains IfExprent // ***************************************************************************** // constructors diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java index 25a5cee..ced701f 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java @@ -80,7 +80,7 @@ public class Statement implements IMatchable { private final Map> mapPredStates = new HashMap>(); // statement as graph - protected VBStyleCollection stats = new VBStyleCollection(); + protected final VBStyleCollection stats = new VBStyleCollection(); protected Statement parent; @@ -88,9 +88,9 @@ public class Statement implements IMatchable { protected List exprents; - protected HashSet labelEdges = new HashSet(); + protected final HashSet labelEdges = new HashSet(); - protected List varDefinitions = new ArrayList(); + protected final List varDefinitions = new ArrayList(); // copied statement, s. deobfuscating of irreducible CFGs private boolean copied = false; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/CheckTypesResult.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/CheckTypesResult.java index 8c5e58d..12bcc32 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/CheckTypesResult.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/CheckTypesResult.java @@ -44,9 +44,9 @@ public class CheckTypesResult { } public static class ExprentTypePair { - public Exprent exprent; - public VarType type; - public VarType desttype; + public final Exprent exprent; + public final VarType type; + public final VarType desttype; public ExprentTypePair(Exprent exprent, VarType type, VarType desttype) { this.exprent = exprent; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionEdge.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionEdge.java index 3ae444e..a871fec 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionEdge.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionEdge.java @@ -20,11 +20,11 @@ public class VarVersionEdge { // FIXME: can be removed? public static final int EDGE_GENERAL = 0; public static final int EDGE_PHANTOM = 1; - public int type; + public final int type; - public VarVersionNode source; + public final VarVersionNode source; - public VarVersionNode dest; + public final VarVersionNode dest; private final int hashCode; 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 acc88b0..9b57833 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionNode.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -27,13 +27,13 @@ public class VarVersionNode implements IGraphNode { public static final int FLAG_PHANTOM_FINEXIT = 2; - public int var; + public final int var; - public int version; + public final int version; - public Set succs = new HashSet(); + public final Set succs = new HashSet(); - public Set preds = new HashSet(); + public final Set preds = new HashSet(); public int flags; 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 0077d95..8cc11fa 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -27,7 +27,7 @@ public class VarVersionsGraph { public int counter = 0; - public VBStyleCollection nodes = new VBStyleCollection(); + public final VBStyleCollection nodes = new VBStyleCollection(); private GenericDominatorEngine engine; diff --git a/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java b/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java index 6dc010d..aa9ed9c 100644 --- a/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java +++ b/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java @@ -34,7 +34,7 @@ public class ConstantPool implements NewClassNameBuilder { public static final int FIELD = 1; public static final int METHOD = 2; - private List pool = new ArrayList(); + private final List pool = new ArrayList(); private final PoolInterceptor interceptor; diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java index 66fab96..2ff2954 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -22,9 +22,9 @@ public class GenericClassDescriptor { public GenericType superclass; - public List superinterfaces = new ArrayList(); + public final List superinterfaces = new ArrayList(); - public List fparameters = new ArrayList(); + public final List fparameters = new ArrayList(); - public List> fbounds = new ArrayList>(); + public final List> fbounds = new ArrayList>(); } diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java index 7b4c9dc..7ef9399 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -20,13 +20,13 @@ import java.util.List; public class GenericMethodDescriptor { - public List fparameters = new ArrayList(); + public final List fparameters = new ArrayList(); - public List> fbounds = new ArrayList>(); + public final List> fbounds = new ArrayList>(); - public List params = new ArrayList(); + public final List params = new ArrayList(); public GenericType ret; - public List exceptions = new ArrayList(); + public final List exceptions = new ArrayList(); } diff --git a/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java b/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java index 70254d8..d75c93d 100644 --- a/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java +++ b/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -160,9 +160,9 @@ public class LazyLoader { public static final int CLASS = 1; public static final int ENTRY = 2; - public int type; - public String externalPath; - public String internalPath; + public final int type; + public final String externalPath; + public final String internalPath; public Link(int type, String externalPath, String internalPath) { this.type = type; diff --git a/src/org/jetbrains/java/decompiler/struct/match/IMatchable.java b/src/org/jetbrains/java/decompiler/struct/match/IMatchable.java index 8ab89e6..95f149e 100644 --- a/src/org/jetbrains/java/decompiler/struct/match/IMatchable.java +++ b/src/org/jetbrains/java/decompiler/struct/match/IMatchable.java @@ -1,9 +1,24 @@ +/* + * Copyright 2000-2015 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jetbrains.java.decompiler.struct.match; public interface IMatchable { - public enum MatchProperties { + enum MatchProperties { STATEMENT_TYPE, STATEMENT_RET, STATEMENT_STATSIZE, @@ -25,8 +40,8 @@ public interface IMatchable { EXPRENT_FIELD_NAME, } - public IMatchable findObject(MatchNode matchNode, int index); + IMatchable findObject(MatchNode matchNode, int index); - public boolean match(MatchNode matchNode, MatchEngine engine); + boolean match(MatchNode matchNode, MatchEngine engine); } diff --git a/src/org/jetbrains/java/decompiler/struct/match/MatchNode.java b/src/org/jetbrains/java/decompiler/struct/match/MatchNode.java index 34de504..f922a3c 100644 --- a/src/org/jetbrains/java/decompiler/struct/match/MatchNode.java +++ b/src/org/jetbrains/java/decompiler/struct/match/MatchNode.java @@ -25,8 +25,8 @@ import org.jetbrains.java.decompiler.struct.match.IMatchable.MatchProperties; public class MatchNode { public static class RuleValue { - public int parameter; - public Object value; + public final int parameter; + public final Object value; public RuleValue(int parameter, Object value) { this.parameter = parameter; diff --git a/src/org/jetbrains/java/decompiler/util/FastSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastSetFactory.java index 833629b..ab80150 100644 --- a/src/org/jetbrains/java/decompiler/util/FastSetFactory.java +++ b/src/org/jetbrains/java/decompiler/util/FastSetFactory.java @@ -192,7 +192,7 @@ public class FastSetFactory { index = factory.addElement(element); } - return index[0] >= data.length ? false : ((data[index[0]] & index[1]) != 0); + return index[0] < data.length && ((data[index[0]] & index[1]) != 0); } public boolean contains(FastSet set) { diff --git a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java index d94d059..a4ad9ac 100644 --- a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java +++ b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java @@ -219,7 +219,7 @@ public class FastSparseSetFactory { index = factory.addElement(element); } - return index[0] >= data.length ? false : ((data[index[0]] & index[1]) != 0); + return index[0] < data.length && ((data[index[0]] & index[1]) != 0); } public boolean contains(FastSparseSet set) { diff --git a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java index 67af3ad..b965009 100644 --- a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java +++ b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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,6 @@ package org.jetbrains.java.decompiler.util; import org.jetbrains.java.decompiler.main.DecompilerContext; -import org.jetbrains.java.decompiler.main.TextBuffer; import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; import java.io.*;