From 6ec2c2924a4b9b50687f02f823f6ac3e22b73919 Mon Sep 17 00:00:00 2001
From: Lukas Stadler <lukas.stadler@oracle.com>
Date: Mon, 9 Jan 2017 19:20:33 +0100
Subject: [PATCH] final, formatting, unused code

---
 .../r/library/stats/RandFunctionsNodes.java   |  4 +-
 .../r/library/stats/StatsFunctionsNodes.java  |  4 +-
 .../oracle/truffle/r/library/utils/Rprof.java |  4 +-
 .../truffle/r/nodes/builtin/base/Combine.java |  5 +-
 .../truffle/r/nodes/builtin/base/Drop.java    | 11 ++--
 .../truffle/r/nodes/builtin/base/Match.java   | 10 ++--
 .../r/nodes/builtin/base/Transpose.java       |  6 +-
 .../base/fastpaths/IntersectFastPath.java     |  6 +-
 .../r/nodes/builtin/fastr/FastRStats.java     |  4 +-
 .../nodes/builtin/helpers/DebugHandling.java  |  4 +-
 .../r/nodes/casts/FilterSamplerFactory.java   |  6 +-
 .../truffle/r/nodes/test/ChimneySweeping.java |  4 +-
 .../vector/CachedExtractVectorNode.java       |  6 +-
 .../vector/CachedReplaceVectorNode.java       |  6 +-
 .../r/nodes/builtin/ArgumentFilter.java       |  5 +-
 .../truffle/r/nodes/builtin/CastBuilder.java  | 10 ++--
 .../r/nodes/function/ArgumentStatePush.java   |  5 +-
 .../function/FunctionDefinitionNode.java      |  7 +--
 .../truffle/r/nodes/function/PromiseNode.java |  4 +-
 .../r/nodes/primitive/BinaryMapNode.java      |  5 +-
 .../r/nodes/primitive/UnaryMapNode.java       |  5 +-
 .../truffle/r/nodes/unary/PrecedenceNode.java |  5 +-
 .../unary/UnaryArithmeticReduceNode.java      | 15 +++--
 .../truffle/r/runtime/ffi/jni/JNI_Glob.java   |  4 +-
 .../src/com/oracle/truffle/r/runtime/DCF.java |  6 +-
 .../truffle/r/runtime/ExitException.java      |  4 +-
 .../oracle/truffle/r/runtime/LazyDBCache.java |  4 +-
 .../oracle/truffle/r/runtime/RChannel.java    |  8 +--
 .../truffle/r/runtime/RErrorHandling.java     |  6 +-
 .../truffle/r/runtime/RInternalCode.java      |  4 +-
 .../oracle/truffle/r/runtime/RSerialize.java  | 60 +++++++++----------
 .../truffle/r/runtime/RStartParams.java       |  2 +-
 .../com/oracle/truffle/r/runtime/Utils.java   |  8 +--
 .../r/runtime/conn/CompressedConnections.java |  4 +-
 .../r/runtime/conn/FileConnections.java       |  8 +--
 .../r/runtime/conn/SocketConnections.java     |  4 +-
 .../r/runtime/conn/TextConnections.java       |  4 +-
 .../r/runtime/conn/URLConnections.java        |  4 +-
 .../truffle/r/runtime/context/RContext.java   |  4 +-
 .../runtime/data/AgentObjectSizeFactory.java  |  4 +-
 .../com/oracle/truffle/r/runtime/ffi/DLL.java |  2 +-
 .../instrument/InstrumentationState.java      |  4 +-
 .../truffle/r/runtime/nmath/distr/PTukey.java |  2 +-
 .../truffle/r/runtime/nmath/distr/QBeta.java  |  3 +-
 .../r/runtime/nmath/distr/Signrank.java       |  2 +-
 .../r/test/generate/TestOutputManager.java    |  2 +-
 46 files changed, 141 insertions(+), 153 deletions(-)

diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RandFunctionsNodes.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RandFunctionsNodes.java
index 1a554b01cf..07da33f6dc 100644
--- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RandFunctionsNodes.java
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RandFunctionsNodes.java
@@ -47,7 +47,7 @@ import com.oracle.truffle.r.runtime.nmath.RandomFunctions.RandFunction1_Double;
 import com.oracle.truffle.r.runtime.nmath.RandomFunctions.RandFunction2_Double;
 import com.oracle.truffle.r.runtime.nmath.RandomFunctions.RandFunction3_Double;
 import com.oracle.truffle.r.runtime.nmath.RandomFunctions.RandomNumberProvider;
-import com.oracle.truffle.r.runtime.nodes.RNode;
+import com.oracle.truffle.r.runtime.nodes.RBaseNode;
 import com.oracle.truffle.r.runtime.rng.RRNG;
 
 /**
@@ -133,7 +133,7 @@ public final class RandFunctionsNodes {
         private Object evaluateWrapper(RAbstractVector lengthVec, RAbstractDoubleVector a, RAbstractDoubleVector b, RAbstractDoubleVector c, RandomNumberProvider rand,
                         RandGenerationNodeData nodeData) {
             int length = nodeData.resultVectorLengthProfile.profile(convertToLength.execute(lengthVec));
-            RNode.reportWork(this, length);
+            RBaseNode.reportWork(this, length);
             return evaluate(length, a, b, c, nodeData, rand);
         }
 
diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/StatsFunctionsNodes.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/StatsFunctionsNodes.java
index 73325ec93f..5ea680278a 100644
--- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/StatsFunctionsNodes.java
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/StatsFunctionsNodes.java
@@ -46,7 +46,7 @@ import com.oracle.truffle.r.runtime.nmath.MathFunctions.Function3_1;
 import com.oracle.truffle.r.runtime.nmath.MathFunctions.Function3_2;
 import com.oracle.truffle.r.runtime.nmath.MathFunctions.Function4_1;
 import com.oracle.truffle.r.runtime.nmath.MathFunctions.Function4_2;
-import com.oracle.truffle.r.runtime.nodes.RNode;
+import com.oracle.truffle.r.runtime.nodes.RBaseNode;
 import com.oracle.truffle.r.runtime.ops.na.NACheck;
 
 // inspired by arithmetic.c
@@ -86,7 +86,7 @@ public final class StatsFunctionsNodes {
             return RDataFactory.createEmptyDoubleVector();
         }
         int length = profiles.resultVectorLengthProfile.profile(Math.max(aLength, Math.max(bLength, Math.max(cLength, dLength))));
-        RNode.reportWork(node, length);
+        RBaseNode.reportWork(node, length);
         double[] result = new double[length];
 
         boolean complete = true;
diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java
index 626125e07e..c33cfab250 100644
--- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java
+++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java
@@ -188,8 +188,8 @@ public abstract class Rprof extends RExternalBuiltinNode.Arg8 implements RDataFa
      * collects the stack of functions.
      */
     private final class StatementListener implements ExecutionEventListener {
-        private ArrayList<ArrayList<RSyntaxElement>> intervalStacks = new ArrayList<>();
-        private ArrayList<RprofState.MemoryQuad> intervalMemory = new ArrayList<>();
+        private final ArrayList<ArrayList<RSyntaxElement>> intervalStacks = new ArrayList<>();
+        private final ArrayList<RprofState.MemoryQuad> intervalMemory = new ArrayList<>();
         private volatile boolean newInterval;
 
         private StatementListener() {
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Combine.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Combine.java
index 1c53a2a22f..021f7bd900 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Combine.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Combine.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,6 +76,7 @@ import com.oracle.truffle.r.runtime.data.RNull;
 import com.oracle.truffle.r.runtime.data.RStringVector;
 import com.oracle.truffle.r.runtime.data.RVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
+import com.oracle.truffle.r.runtime.nodes.RBaseNode;
 import com.oracle.truffle.r.runtime.nodes.RNode;
 import com.oracle.truffle.r.runtime.ops.na.NACheck;
 
@@ -148,7 +149,7 @@ public abstract class Combine extends RBuiltinNode {
         // get the actual contents of the result
         RVector<?> result = foldContents(cachedPrecedence, elements, size, namesVector);
 
-        RNode.reportWork(this, size);
+        RBaseNode.reportWork(this, size);
 
         return result;
     }
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Drop.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Drop.java
index bb060fb21b..5edaedbcbe 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Drop.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Drop.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,12 +74,11 @@ public abstract class Drop extends RBuiltinNode {
 
         // the result is single value, all dims == 1
         if (resultIsScalarProfile.profile(lastNonOneIndex == -1)) {
-            @SuppressWarnings("unused")
             RAbstractVector r = x.copy();
-            setDimsNode.setDimensions(x, null);
-            setDimsNamesNode.setDimNames(x, null);
-            setNamesNode.setNames(x, null);
-            return x;
+            setDimsNode.setDimensions(r, null);
+            setDimsNamesNode.setDimNames(r, null);
+            setNamesNode.setNames(r, null);
+            return r;
         }
 
         // the result is vector
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Match.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Match.java
index e53aed54ee..56288f90ca 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Match.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Match.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -800,7 +800,7 @@ public abstract class Match extends RBuiltinNode {
     }
 
     private static class NonRecursiveHashSetInt {
-        private NonRecursiveHashMapInt map;
+        private final NonRecursiveHashMapInt map;
 
         NonRecursiveHashSetInt(int approxCapacity) {
             map = new NonRecursiveHashMapInt(approxCapacity);
@@ -816,7 +816,7 @@ public abstract class Match extends RBuiltinNode {
     }
 
     private static class NonRecursiveHashSetDouble {
-        private NonRecursiveHashMapDouble map;
+        private final NonRecursiveHashMapDouble map;
 
         NonRecursiveHashSetDouble(int approxCapacity) {
             map = new NonRecursiveHashMapDouble(approxCapacity);
@@ -832,7 +832,7 @@ public abstract class Match extends RBuiltinNode {
     }
 
     private static class NonRecursiveHashSetCharacter {
-        private NonRecursiveHashMapCharacter map;
+        private final NonRecursiveHashMapCharacter map;
 
         NonRecursiveHashSetCharacter(int approxCapacity) {
             map = new NonRecursiveHashMapCharacter(approxCapacity);
@@ -848,7 +848,7 @@ public abstract class Match extends RBuiltinNode {
     }
 
     private static class NonRecursiveHashSetComplex {
-        private NonRecursiveHashMapComplex map;
+        private final NonRecursiveHashMapComplex map;
 
         NonRecursiveHashSetComplex(int approxCapacity) {
             map = new NonRecursiveHashMapComplex(approxCapacity);
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Transpose.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Transpose.java
index db8fcf3082..5daa1ab7dd 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Transpose.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Transpose.java
@@ -6,7 +6,7 @@
  * Copyright (c) 1995, 1996, 1997  Robert Gentleman and Ross Ihaka
  * Copyright (c) 1995-2014, The R Core Team
  * Copyright (c) 2002-2008, The R Foundation
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates
  *
  * All rights reserved.
  */
@@ -45,7 +45,7 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractRawVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
-import com.oracle.truffle.r.runtime.nodes.RNode;
+import com.oracle.truffle.r.runtime.nodes.RBaseNode;
 
 @RBuiltin(name = "t.default", kind = INTERNAL, parameterNames = {"x"}, behavior = PURE)
 public abstract class Transpose extends RBuiltinNode {
@@ -80,7 +80,7 @@ public abstract class Transpose extends RBuiltinNode {
             firstDim = length;
             secondDim = 1;
         }
-        RNode.reportWork(this, length);
+        RBaseNode.reportWork(this, length);
 
         A array = createArray.apply(length);
         int j = 0;
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/fastpaths/IntersectFastPath.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/fastpaths/IntersectFastPath.java
index 611cf68d89..0089dad0f3 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/fastpaths/IntersectFastPath.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/fastpaths/IntersectFastPath.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,8 +31,8 @@ import com.oracle.truffle.api.dsl.Specialization;
 import com.oracle.truffle.api.profiles.ConditionProfile;
 import com.oracle.truffle.r.runtime.data.RDataFactory;
 import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector;
+import com.oracle.truffle.r.runtime.nodes.RBaseNode;
 import com.oracle.truffle.r.runtime.nodes.RFastPathNode;
-import com.oracle.truffle.r.runtime.nodes.RNode;
 
 public abstract class IntersectFastPath extends RFastPathNode {
 
@@ -53,7 +53,7 @@ public abstract class IntersectFastPath extends RFastPathNode {
 
         int xLength = profiledX.getLength();
         int yLength = profiledY.getLength();
-        RNode.reportWork(this, xLength + yLength);
+        RBaseNode.reportWork(this, xLength + yLength);
 
         int count = 0;
         int[] result = EMPTY_INT_ARRAY;
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRStats.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRStats.java
index 2cc1e37a4c..d0886976b7 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRStats.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRStats.java
@@ -420,8 +420,8 @@ public class FastRStats {
         }
 
         private static final class SortableCounter implements Comparable<SortableCounter> {
-            private boolean timing;
-            private Profiler.Counter counter;
+            private final boolean timing;
+            private final Profiler.Counter counter;
 
             private SortableCounter(Profiler.Counter counter, boolean timing) {
                 this.counter = counter;
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java
index 801a83f816..80f96d66aa 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -581,7 +581,7 @@ public class DebugHandling {
      * Listener for (transient) step into.
      */
     private static class StepIntoInstrumentListener implements ExecutionEventListener {
-        private FunctionStatementsEventListener functionStatementsEventListener;
+        private final FunctionStatementsEventListener functionStatementsEventListener;
 
         StepIntoInstrumentListener(FunctionStatementsEventListener debugEventReceiver) {
             this.functionStatementsEventListener = debugEventReceiver;
diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/FilterSamplerFactory.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/FilterSamplerFactory.java
index bc27e20cff..e1c486f861 100644
--- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/FilterSamplerFactory.java
+++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/FilterSamplerFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -207,11 +207,11 @@ public final class FilterSamplerFactory
                 return filter.getFilter().isNarrowing() ? toNegate.trueBranchType().not() : toNegate.trueBranchType();
             }
 
-            @SuppressWarnings({"unchecked", "cast"})
+            @SuppressWarnings({"unchecked"})
             @Override
             public Samples<Object> collectSamples(TypeExpr inputType) {
                 Samples thisSamples = toNegate.collectSamples(inputType);
-                return (Samples<Object>) thisSamples.swap();
+                return thisSamples.swap();
             }
 
         };
diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java
index 0caff99715..eccc3ed746 100644
--- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java
+++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@ import com.oracle.truffle.r.test.generate.TestOutputManager.TestInfo;
  */
 class ChimneySweeping extends SingleBuiltinDiagnostics {
 
-    private Set<String> blacklistedBuiltins = new HashSet<>();
+    private final Set<String> blacklistedBuiltins = new HashSet<>();
     {
         blacklistedBuiltins.add(".dfltWarn");
         blacklistedBuiltins.add("browser");
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedExtractVectorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedExtractVectorNode.java
index 600fa6067e..85dcea77b1 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedExtractVectorNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedExtractVectorNode.java
@@ -58,7 +58,7 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractContainer;
 import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
 import com.oracle.truffle.r.runtime.env.REnvironment;
-import com.oracle.truffle.r.runtime.nodes.RNode;
+import com.oracle.truffle.r.runtime.nodes.RBaseNode;
 
 final class CachedExtractVectorNode extends CachedVectorNode {
 
@@ -188,7 +188,7 @@ final class CachedExtractVectorNode extends CachedVectorNode {
                 writeVectorNode.enableValueNACheck(vector);
                 writeVectorNode.apply(extractedVector, extractedVectorLength, positions, vector, vectorLength, dimensions);
                 extractedVector.setComplete(writeVectorNode.neverSeenNAInValue());
-                RNode.reportWork(this, extractedVectorLength);
+                RBaseNode.reportWork(this, extractedVectorLength);
             }
             if (oneDimensionProfile.profile(numberOfDimensions == 1)) {
                 // names only need to be considered for single dimensional accesses
@@ -217,7 +217,7 @@ final class CachedExtractVectorNode extends CachedVectorNode {
 
         } else {
             writeVectorNode.apply(extractedVector, extractedVectorLength, positions, vector, vectorLength, dimensions);
-            RNode.reportWork(this, 1);
+            RBaseNode.reportWork(this, 1);
             assert extractedVectorLength == 1;
             return extractedVector.getDataAtAsObject(0);
         }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedReplaceVectorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedReplaceVectorNode.java
index 2113155262..a7c9dee70e 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedReplaceVectorNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/CachedReplaceVectorNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
 import com.oracle.truffle.r.runtime.env.REnvironment;
 import com.oracle.truffle.r.runtime.env.REnvironment.PutException;
-import com.oracle.truffle.r.runtime.nodes.RNode;
+import com.oracle.truffle.r.runtime.nodes.RBaseNode;
 
 final class CachedReplaceVectorNode extends CachedVectorNode {
 
@@ -298,7 +298,7 @@ final class CachedReplaceVectorNode extends CachedVectorNode {
             }
         }
 
-        RNode.reportWork(this, replacementLength);
+        RBaseNode.reportWork(this, replacementLength);
 
         if (isDeleteElements()) {
             assert deleteElementsNode != null;
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/ArgumentFilter.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/ArgumentFilter.java
index a6357445be..005315e5ec 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/ArgumentFilter.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/ArgumentFilter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -187,13 +187,12 @@ public interface ArgumentFilter<T, R> {
 
                 private final ConditionProfile profile = ConditionProfile.createBinaryProfile();
 
-                @SuppressWarnings({"cast", "unchecked"})
                 @Override
                 public boolean test(T arg) {
                     if (profile.profile(!InverseArgumentFilter.this.test(arg))) {
                         return false;
                     } else {
-                        return other.test((R) arg);
+                        return other.test(arg);
                     }
                 }
 
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/CastBuilder.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/CastBuilder.java
index c7f6bc6ef0..4b215d7d58 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/CastBuilder.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/CastBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -665,20 +665,20 @@ public final class CastBuilder {
             return new TypeFilter<>(x -> true, Object.class);
         }
 
-        @SuppressWarnings({"rawtypes", "unchecked", "cast"})
+        @SuppressWarnings({"rawtypes", "unchecked"})
         public static Filter<Object, RAbstractVector> numericValue() {
             Filter f = integerValue().or(doubleValue()).or(logicalValue());
-            return (Filter<Object, RAbstractVector>) f;
+            return f;
         }
 
         /**
          * Checks that the argument is a list or vector/scalar of type numeric, string, complex or
          * raw.
          */
-        @SuppressWarnings({"rawtypes", "unchecked", "cast"})
+        @SuppressWarnings({"rawtypes", "unchecked"})
         public static Filter<Object, RAbstractVector> abstractVectorValue() {
             Filter f = numericValue().or(stringValue()).or(complexValue()).or(rawValue()).or(instanceOf(RAbstractListVector.class));
-            return (Filter<Object, RAbstractVector>) f;
+            return f;
         }
 
         public static Filter<Object, Integer> atomicIntegerValue() {
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentStatePush.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentStatePush.java
index 6100faa0f4..5439f6c486 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentStatePush.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentStatePush.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
 package com.oracle.truffle.r.nodes.function;
 
 import com.oracle.truffle.api.CompilerDirectives;
-import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
 import com.oracle.truffle.api.dsl.Cached;
 import com.oracle.truffle.api.dsl.Specialization;
 import com.oracle.truffle.api.dsl.TypeSystemReference;
@@ -54,7 +53,7 @@ public abstract class ArgumentStatePush extends Node {
     private final ConditionProfile isRefCountUpdateable = ConditionProfile.createBinaryProfile();
 
     private final int index;
-    @CompilationFinal private int mask = 0;
+
     @Child private WriteLocalFrameVariableNode writeArgNode;
 
     public static final int MAX_COUNTED_ARGS = 8;
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java
index 85c1172c4e..9e0477b8a4 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,6 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo
      * loaded from packages, where at the point of definition any assignee variable is unknown.
      */
     private String name;
-    private boolean instrumented = false;
     private SourceSection sourceSectionR;
     private final SourceSection[] argSourceSections;
 
@@ -438,10 +437,6 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo
         this.name = name;
     }
 
-    public boolean getInstrumented() {
-        return instrumented;
-    }
-
     @Override
     public RBuiltinFactory getBuiltin() {
         return null;
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java
index e9a2275663..f879c37100 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -371,7 +371,7 @@ public abstract class PromiseNode extends RNode {
                 if (RASTUtils.isLookup(nodes[i], ArgumentsSignature.VARARG_NAME)) {
                     this.promised[i] = nodes[i];
                 } else {
-                    this.promised[i] = PromisedNode.create(RPromiseFactory.create(PromiseState.Supplied, closure), false, forcedEager);
+                    this.promised[i] = PromiseNode.create(RPromiseFactory.create(PromiseState.Supplied, closure), false, forcedEager);
                 }
             }
             this.signature = signature;
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java
index a720fcbc35..029608fbef 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/BinaryMapNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,6 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractRawVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
 import com.oracle.truffle.r.runtime.nodes.RBaseNode;
-import com.oracle.truffle.r.runtime.nodes.RNode;
 
 /**
  * Implements a binary map operation that maps two vectors into a single result vector of the
@@ -264,7 +263,7 @@ public final class BinaryMapNode extends RBaseNode {
             assert isStoreCompatible(store, resultType, leftLength, rightLength);
 
             vectorNode.execute(function, store, leftCast, leftLength, rightCast, rightLength);
-            RNode.reportWork(this, maxLength);
+            RBaseNode.reportWork(this, maxLength);
             target.setComplete(function.isComplete());
         }
         if (mayContainMetadata) {
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/UnaryMapNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/UnaryMapNode.java
index e0b9d614ca..ccbd6106a6 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/UnaryMapNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/primitive/UnaryMapNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,6 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
 import com.oracle.truffle.r.runtime.nodes.RBaseNode;
-import com.oracle.truffle.r.runtime.nodes.RNode;
 
 public final class UnaryMapNode extends RBaseNode {
 
@@ -157,7 +156,7 @@ public final class UnaryMapNode extends RBaseNode {
             target = createOrShareVector(operandLength, operand);
             Object store = target.getInternalStore();
             vectorNode.apply(scalarNode, store, operandCast, operandLength);
-            RNode.reportWork(this, operandLength);
+            RBaseNode.reportWork(this, operandLength);
             target.setComplete(scalarNode.isComplete());
         }
         if (mayContainMetadata) {
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/PrecedenceNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/PrecedenceNode.java
index c00a280c66..6a1843768d 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/PrecedenceNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/PrecedenceNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -156,8 +156,7 @@ public abstract class PrecedenceNode extends RBaseNode {
                     @Cached("createRecursive()") PrecedenceNode precedenceNode) {
         int precedence = -1;
         for (int i = 0; i < val.getLength(); i++) {
-            Object data = val.getDataAt(i);
-            precedence = Math.max(precedence, precedenceNode.executeInteger(val.getDataAtAsObject(i), recursive));
+            precedence = Math.max(precedence, precedenceNode.executeInteger(val.getDataAt(i), recursive));
         }
         return precedence;
     }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticReduceNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticReduceNode.java
index fe33372879..7c28bb9a4b 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticReduceNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticReduceNode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,6 @@ import com.oracle.truffle.r.runtime.data.RRawVector;
 import com.oracle.truffle.r.runtime.data.RStringVector;
 import com.oracle.truffle.r.runtime.data.RTypes;
 import com.oracle.truffle.r.runtime.nodes.RBaseNode;
-import com.oracle.truffle.r.runtime.nodes.RNode;
 import com.oracle.truffle.r.runtime.ops.BinaryArithmetic;
 import com.oracle.truffle.r.runtime.ops.BinaryArithmeticFactory;
 import com.oracle.truffle.r.runtime.ops.na.NACheck;
@@ -199,7 +198,7 @@ public abstract class UnaryArithmeticReduceNode extends RBaseNode {
 
     @Specialization
     protected int doIntVector(RIntVector operand, boolean naRm, @SuppressWarnings("unused") boolean finite) {
-        RNode.reportWork(this, operand.getLength());
+        RBaseNode.reportWork(this, operand.getLength());
         boolean profiledNaRm = naRmProfile.profile(naRm);
         int result = semantics.getIntStart();
         na.enable(operand);
@@ -226,7 +225,7 @@ public abstract class UnaryArithmeticReduceNode extends RBaseNode {
 
     @Specialization
     protected double doDoubleVector(RDoubleVector operand, boolean naRm, @SuppressWarnings("unused") boolean finite) {
-        RNode.reportWork(this, operand.getLength());
+        RBaseNode.reportWork(this, operand.getLength());
         boolean profiledNaRm = naRmProfile.profile(naRm);
         double result = semantics.getDoubleStart();
         na.enable(operand);
@@ -253,7 +252,7 @@ public abstract class UnaryArithmeticReduceNode extends RBaseNode {
 
     @Specialization
     protected int doLogicalVector(RLogicalVector operand, boolean naRm, @SuppressWarnings("unused") boolean finite) {
-        RNode.reportWork(this, operand.getLength());
+        RBaseNode.reportWork(this, operand.getLength());
         boolean profiledNaRm = naRmProfile.profile(naRm);
         int result = semantics.getIntStart();
         na.enable(operand);
@@ -280,7 +279,7 @@ public abstract class UnaryArithmeticReduceNode extends RBaseNode {
 
     @Specialization
     protected int doIntSequence(RIntSequence operand, @SuppressWarnings("unused") boolean naRm, @SuppressWarnings("unused") boolean finite) {
-        RNode.reportWork(this, operand.getLength());
+        RBaseNode.reportWork(this, operand.getLength());
         int result = semantics.getIntStart();
         int current = operand.getStart();
         for (int i = 0; i < operand.getLength(); i++) {
@@ -295,7 +294,7 @@ public abstract class UnaryArithmeticReduceNode extends RBaseNode {
 
     @Specialization
     protected double doDoubleSequence(RDoubleSequence operand, @SuppressWarnings("unused") boolean naRm, @SuppressWarnings("unused") boolean finite) {
-        RNode.reportWork(this, operand.getLength());
+        RBaseNode.reportWork(this, operand.getLength());
         double result = semantics.getDoubleStart();
         double current = operand.getStart();
         for (int i = 0; i < operand.getLength(); i++) {
@@ -310,7 +309,7 @@ public abstract class UnaryArithmeticReduceNode extends RBaseNode {
 
     @Specialization
     protected RComplex doComplexVector(RComplexVector operand, boolean naRm, @SuppressWarnings("unused") boolean finite) {
-        RNode.reportWork(this, operand.getLength());
+        RBaseNode.reportWork(this, operand.getLength());
         if (semantics.supportComplex) {
             boolean profiledNaRm = naRmProfile.profile(naRm);
             RComplex result = RRuntime.double2complex(semantics.getDoubleStart());
diff --git a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/JNI_Glob.java b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/JNI_Glob.java
index 975294266f..e39000a549 100644
--- a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/JNI_Glob.java
+++ b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/JNI_Glob.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@ package com.oracle.truffle.r.runtime.ffi.jni;
 import java.util.ArrayList;
 
 public class JNI_Glob {
-    private ArrayList<String> paths = new ArrayList<>();
+    private final ArrayList<String> paths = new ArrayList<>();
 
     public static ArrayList<String> glob(String pattern) {
         JNI_Glob jniGlob = new JNI_Glob();
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/DCF.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/DCF.java
index a4b4387ce8..5f5fa9f83c 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/DCF.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/DCF.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@ public class DCF {
 
     public static class Fields {
         // A map because field may repeat and last one wins
-        private LinkedHashMap<String, String> fieldMap = new LinkedHashMap<>();
+        private final LinkedHashMap<String, String> fieldMap = new LinkedHashMap<>();
 
         private void add(String name, String content) {
             fieldMap.put(name, content);
@@ -47,7 +47,7 @@ public class DCF {
         }
     }
 
-    private ArrayList<Fields> paragraphs = new ArrayList<>();
+    private final ArrayList<Fields> paragraphs = new ArrayList<>();
 
     public static DCF read(String[] lines, Set<String> keepWhiteSet) {
         DCF result = new DCF();
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ExitException.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ExitException.java
index 53691d5cac..ba11798658 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ExitException.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ExitException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@ package com.oracle.truffle.r.runtime;
  */
 public class ExitException extends RuntimeException {
     private static final long serialVersionUID = 1L;
-    private int status;
+    private final int status;
 
     public ExitException(int status) {
         this.status = status;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/LazyDBCache.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/LazyDBCache.java
index 6b742edcf9..62715c5023 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/LazyDBCache.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/LazyDBCache.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@ import com.oracle.truffle.r.runtime.context.RContext;
 public class LazyDBCache {
 
     public static final class ContextStateImpl implements RContext.ContextState {
-        private Map<String, byte[]> dbCache = new HashMap<>();
+        private final Map<String, byte[]> dbCache = new HashMap<>();
 
         public byte[] getData(String dbPath) {
             byte[] dbData = dbCache.get(dbPath);
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RChannel.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RChannel.java
index 13475477da..db41454ae0 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RChannel.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RChannel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -239,10 +239,10 @@ public class RChannel {
                 }
             }
 
-            private Bindings bindings;
+            private final Bindings bindings;
             // parent can be SerializedEnv or byte[]
-            private Object parent;
-            private DynamicObject attributes;
+            private final Object parent;
+            private final DynamicObject attributes;
 
             SerializedEnv(Bindings bindings, Object parent, DynamicObject attributes) {
                 this.bindings = bindings;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java
index ef3983b463..6bba048cb6 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java
@@ -60,7 +60,7 @@ public class RErrorHandling {
     private static final RStringVector RESTART_CLASS = RDataFactory.createStringVectorFromScalar("restart");
 
     private static class Warnings {
-        private ArrayList<Warning> list = new ArrayList<>();
+        private final ArrayList<Warning> list = new ArrayList<>();
 
         int size() {
             return list.size();
@@ -95,11 +95,11 @@ public class RErrorHandling {
         /**
          * Current list of (deferred) warnings.
          */
-        private Warnings warnings = new Warnings();
+        private final Warnings warnings = new Warnings();
         /**
          * Max warnings accumulated.
          */
-        private int maxWarnings = 50;
+        private final int maxWarnings = 50;
         /**
          * Set/get by seterrmessage/geterrmessage builtins.
          */
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalCode.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalCode.java
index f47dda0168..5abb022ae2 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalCode.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalCode.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@ import com.oracle.truffle.r.runtime.env.REnvironment;
 public final class RInternalCode {
     private final RContext context;
     private final String basePackage;
-    private Source source;
+    private final Source source;
 
     private REnvironment evaluatedEnvironment;
 
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java
index 3cfaeb8f1e..156ab436c3 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1995-2012, The R Core Team
  * Copyright (c) 2003, The R Foundation
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates
  *
  * All rights reserved.
  */
@@ -982,8 +982,9 @@ public class RSerialize {
                     Object car = readBCLang(SEXPTYPE.mapInt(stream.readInt()), reps);
                     Object cdr = readBCLang(SEXPTYPE.mapInt(stream.readInt()), reps);
                     Object ans = RDataFactory.createPairList(car, cdr, tag, type);
-                    if (pos >= 0)
+                    if (pos >= 0) {
                         reps[pos] = ans;
+                    }
                     return ans;
                 }
                 default: {
@@ -1188,7 +1189,7 @@ public class RSerialize {
     }
 
     private static class XdrOutputFormat extends POutputStream {
-        private byte[] buf;
+        private final byte[] buf;
         private int offset;
 
         XdrOutputFormat(OutputStream os) {
@@ -1295,12 +1296,13 @@ public class RSerialize {
 
     private static final class Output extends Common {
 
-        private State state;
-        protected final POutputStream stream;
-        private int version;
+        private final State state;
+        private final POutputStream stream;
+        private final int version;
 
         private Output(OutputStream os, int format, int version, CallHook hook) throws IOException {
             super(hook);
+            this.state = new PLState();
             this.version = version;
             switch (format) {
                 case ASCII:
@@ -1313,8 +1315,7 @@ public class RSerialize {
             }
         }
 
-        private void serialize(State s, Object obj) throws IOException {
-            this.state = s;
+        private void serialize(Object obj) throws IOException {
             switch (version) {
                 case DEFAULT_VERSION:
                     stream.writeInt(version);
@@ -1330,22 +1331,30 @@ public class RSerialize {
         }
 
         private static SEXPTYPE saveSpecialHook(Object item) {
-            if (item == RNull.instance)
+            if (item == RNull.instance) {
                 return SEXPTYPE.NILVALUE_SXP;
-            if (item == REnvironment.emptyEnv())
+            }
+            if (item == REnvironment.emptyEnv()) {
                 return SEXPTYPE.EMPTYENV_SXP;
-            if (item == REnvironment.baseEnv())
+            }
+            if (item == REnvironment.baseEnv()) {
                 return SEXPTYPE.BASEENV_SXP;
-            if (item == REnvironment.globalEnv())
+            }
+            if (item == REnvironment.globalEnv()) {
                 return SEXPTYPE.GLOBALENV_SXP;
-            if (item == RUnboundValue.instance)
+            }
+            if (item == RUnboundValue.instance) {
                 return SEXPTYPE.UNBOUNDVALUE_SXP;
-            if (item == RMissing.instance)
+            }
+            if (item == RMissing.instance) {
                 return SEXPTYPE.MISSINGARG_SXP;
-            if (item == REmpty.instance)
+            }
+            if (item == REmpty.instance) {
                 return SEXPTYPE.MISSINGARG_SXP;
-            if (item == REnvironment.baseNamespaceEnv())
+            }
+            if (item == REnvironment.baseNamespaceEnv()) {
                 return SEXPTYPE.BASENAMESPACE_SXP;
+            }
             if (item instanceof RArgsValuesAndNames && ((RArgsValuesAndNames) item).getLength() == 0) {
                 // empty DOTSXP
                 return SEXPTYPE.NILVALUE_SXP;
@@ -1814,12 +1823,7 @@ public class RSerialize {
      */
     private abstract static class State {
 
-        @SuppressWarnings("unused") protected final Output output;
-        private Map<String, RSymbol> symbolMap = new HashMap<>();
-
-        private State(Output output) {
-            this.output = output;
-        }
+        private final Map<String, RSymbol> symbolMap = new HashMap<>();
 
         /**
          * Pushes a new virtual pairlist (no type) onto the stack. An untyped pairlist is subject to
@@ -1927,11 +1931,7 @@ public class RSerialize {
      */
     private static class PLState extends State {
         private static final RPairList NULL = RDataFactory.createPairList();
-        private Deque<RPairList> active = new LinkedList<>();
-
-        private PLState(Output output) {
-            super(output);
-        }
+        private final Deque<RPairList> active = new LinkedList<>();
 
         @Override
         public State openPairList() {
@@ -2081,8 +2081,7 @@ public class RSerialize {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         try {
             Output output = new Output(out, type, version, (CallHook) refhook);
-            State state = new PLState(output);
-            output.serialize(state, obj);
+            output.serialize(obj);
             return out.toByteArray();
         } catch (IOException ex) {
             throw RInternalError.shouldNotReachHere();
@@ -2092,8 +2091,7 @@ public class RSerialize {
     @TruffleBoundary
     public static void serialize(RConnection conn, Object obj, int type, int version, Object refhook) throws IOException {
         Output output = new Output(conn.getOutputStream(), type, version, (CallHook) refhook);
-        State state = new PLState(output);
-        output.serialize(state, obj);
+        output.serialize(obj);
     }
 
     private static class Debug {
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RStartParams.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RStartParams.java
index c3de0108a8..854b3c93b6 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RStartParams.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RStartParams.java
@@ -88,7 +88,7 @@ public class RStartParams {
     /**
      * The original command line arguments that were parsed by {@link RCmdOptions}.
      */
-    private String[] arguments;
+    private final String[] arguments;
 
     /**
      * Indicates that FastR is running embedded.
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java
index f4f61fb5ed..751f209ca9 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -828,7 +828,7 @@ public final class Utils {
     }
 
     public static class NonRecursiveHashSet<VAL> {
-        private NonRecursiveHashMap<VAL> map;
+        private final NonRecursiveHashMap<VAL> map;
 
         public NonRecursiveHashSet(int approxCapacity) {
             map = new NonRecursiveHashMap<>(approxCapacity);
@@ -844,7 +844,7 @@ public final class Utils {
     }
 
     public static class NonRecursiveHashSetInt {
-        private NonRecursiveHashMapInt map;
+        private final NonRecursiveHashMapInt map;
 
         public NonRecursiveHashSetInt(int approxCapacity) {
             map = new NonRecursiveHashMapInt(approxCapacity);
@@ -860,7 +860,7 @@ public final class Utils {
     }
 
     public static class NonRecursiveHashSetDouble {
-        private NonRecursiveHashMapDouble map;
+        private final NonRecursiveHashMapDouble map;
 
         public NonRecursiveHashSetDouble(int approxCapacity) {
             map = new NonRecursiveHashMapDouble(approxCapacity);
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/CompressedConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/CompressedConnections.java
index 4530f65c9f..f914930fdb 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/CompressedConnections.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/CompressedConnections.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -157,7 +157,7 @@ public class CompressedConnections {
     }
 
     private static class CompressedInputRConnection extends DelegateReadRConnection implements ReadWriteHelper {
-        private InputStream inputStream;
+        private final InputStream inputStream;
 
         protected CompressedInputRConnection(CompressedRConnection base, InputStream is) {
             super(base);
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java
index 0d9d532e6b..10e9a7ce17 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -167,7 +167,7 @@ public class FileConnections {
     }
 
     private static class FileWriteTextRConnection extends DelegateWriteRConnection implements ReadWriteHelper {
-        private BufferedOutputStream outputStream;
+        private final BufferedOutputStream outputStream;
 
         FileWriteTextRConnection(FileRConnection base, boolean append) throws IOException {
             super(base);
@@ -218,7 +218,7 @@ public class FileConnections {
     }
 
     static class FileReadBinaryRConnection extends DelegateReadRConnection implements ReadWriteHelper {
-        private FileInputStream inputStream;
+        private final FileInputStream inputStream;
 
         FileReadBinaryRConnection(BasePathRConnection base) throws IOException {
             super(base);
@@ -290,7 +290,7 @@ public class FileConnections {
     }
 
     private static class FileWriteBinaryConnection extends DelegateWriteRConnection implements ReadWriteHelper {
-        private FileOutputStream outputStream;
+        private final FileOutputStream outputStream;
 
         FileWriteBinaryConnection(FileRConnection base, boolean append) throws IOException {
             super(base);
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/SocketConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/SocketConnections.java
index 4de2db23b0..e7da9ceca6 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/SocketConnections.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/SocketConnections.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -172,7 +172,7 @@ public class SocketConnections {
     }
 
     private static class RServerSocketConnection extends RSocketReadWriteConnection {
-        private Socket connectionSocket;
+        private final Socket connectionSocket;
 
         RServerSocketConnection(RSocketConnection base) throws IOException {
             super(base);
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/TextConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/TextConnections.java
index a8e290b98b..8c85df0c7d 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/TextConnections.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/TextConnections.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@ public class TextConnections {
     }
 
     private static class TextReadRConnection extends DelegateReadRConnection implements GetConnectionValue {
-        private String[] lines;
+        private final String[] lines;
         private int index;
 
         TextReadRConnection(TextRConnection base) {
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/URLConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/URLConnections.java
index 08403f6569..7aad2be8e1 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/URLConnections.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/URLConnections.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@ public class URLConnections {
 
     private static class URLReadRConnection extends DelegateReadRConnection implements ReadWriteHelper {
 
-        private BufferedInputStream inputStream;
+        private final BufferedInputStream inputStream;
 
         protected URLReadRConnection(URLRConnection base) throws MalformedURLException, IOException {
             super(base);
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java
index a140e87e36..2b36adaa26 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -333,7 +333,7 @@ public final class RContext extends ExecutionContext implements TruffleObject {
      */
     private boolean methodTableDispatchOn = false;
     private boolean allowPrimitiveMethods = true;
-    private HashMap<String, RStringVector> s4ExtendsTable = new HashMap<>();
+    private final HashMap<String, RStringVector> s4ExtendsTable = new HashMap<>();
 
     private boolean nullS4Object = false;
 
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/AgentObjectSizeFactory.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/AgentObjectSizeFactory.java
index 7e303054ed..152f88fedc 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/AgentObjectSizeFactory.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/AgentObjectSizeFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@ import com.oracle.truffle.r.runtime.data.RObjectSize.TypeCustomizer;
  */
 public class AgentObjectSizeFactory extends ObjectSizeFactory {
 
-    private Map<Class<?>, ArrayList<Field>> objectFieldsMap = new HashMap<>();
+    private final Map<Class<?>, ArrayList<Field>> objectFieldsMap = new HashMap<>();
     private static Map<Class<?>, TypeCustomizer> customizerMap = new HashMap<>(); // system wide
 
     public AgentObjectSizeFactory() {
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLL.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLL.java
index bff24d0228..a20cbe325d 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLL.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLL.java
@@ -164,7 +164,7 @@ public class DLL {
         public final Object handle;
         private boolean dynamicLookup;
         private boolean forceSymbols;
-        private DotSymbol[][] nativeSymbols = new DotSymbol[NativeSymbolType.values().length][];
+        private final DotSymbol[][] nativeSymbols = new DotSymbol[NativeSymbolType.values().length][];
 
         private DLLInfo(String name, String path, boolean dynamicLookup, Object handle) {
             this.id = ID.getAndIncrement();
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/instrument/InstrumentationState.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/instrument/InstrumentationState.java
index 4af3bde56a..cf8ff63d1c 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/instrument/InstrumentationState.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/instrument/InstrumentationState.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -137,7 +137,7 @@ public final class InstrumentationState implements RContext.ContextState {
 
         private RCaller caller;
         private String lastEmptyLineCommand = "n";
-        private ArrayList<HelperState> helperStateList = new ArrayList<>();
+        private final ArrayList<HelperState> helperStateList = new ArrayList<>();
 
         public void setInBrowser(RCaller caller) {
             this.caller = caller;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/PTukey.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/PTukey.java
index b238d42c77..5b6f589c6f 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/PTukey.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/PTukey.java
@@ -164,7 +164,7 @@ public class PTukey implements Function4_2 {
         return DPQ.rdtval(ans, lowerTail, logP);
     }
 
-    private double getULen(double df) {
+    private static double getULen(double df) {
         if (df <= dhaf) {
             return ulen1;
         } else if (df <= dquar) {
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/QBeta.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/QBeta.java
index 02e634aff2..c05b3e752d 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/QBeta.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/QBeta.java
@@ -524,8 +524,9 @@ public final class QBeta implements Function3_2 {
                     w = log_p
                                     ? (y - la) * Math.exp(y + logbeta + r * Math.log(xinbta) + t * Math.log1p(-xinbta))
                                     : (y - a) * Math.exp(logbeta + r * Math.log(xinbta) + t * Math.log1p(-xinbta));
-                    if (i_pb >= n_N && w * wprev <= 0.)
+                    if (i_pb >= n_N && w * wprev <= 0.) {
                         prev = RMath.fmax2(Math.abs(adj), fpu);
+                    }
                     debugPrintf("N(i=%d): x0=%.15g, pb(x0)=%.15g, w=%.15g, %s prev=%g,",
                                     i_pb, xinbta, y, w, (w * wprev <= 0.) ? "new" : "old", prev);
                     g = 1;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/Signrank.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/Signrank.java
index 8d0f14b554..2d1baf7bbb 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/Signrank.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/distr/Signrank.java
@@ -175,7 +175,7 @@ public final class Signrank {
          * Makes sure that the value can be reached by integer counter, this is probably just really
          * defensive, since the allocation with such number is bound to fail anyway.
          */
-        private int getUpperIntBound(double x) {
+        private static int getUpperIntBound(double x) {
             return (x + 1) > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) Math.ceil(x);
         }
     }
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/TestOutputManager.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/TestOutputManager.java
index 5c35c1784e..da01131596 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/TestOutputManager.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/TestOutputManager.java
@@ -120,7 +120,7 @@ public class TestOutputManager {
     /**
      * Maps inputs to expected outputs, used during generation.
      */
-    private SortedMap<String, SortedMap<String, TestInfo>> testMaps = new TreeMap<>();
+    private final SortedMap<String, SortedMap<String, TestInfo>> testMaps = new TreeMap<>();
     /**
      * A fast lookup map used at runtime to located the expected output.
      */
-- 
GitLab