aboutsummaryrefslogtreecommitdiffstats
path: root/lib/jinterface
diff options
context:
space:
mode:
authorVlad Dumitrescu <[email protected]>2014-09-10 11:32:50 +0200
committerVlad Dumitrescu <[email protected]>2014-09-11 21:24:25 +0200
commitd0a1059d551c86d41ecbb36a1f23516eb71679c6 (patch)
tree0d09037d9e05c697a368e89a08e95166a30ec008 /lib/jinterface
parent4725d4cc06ded1c9ee2712330e233aa865df3ebd (diff)
downloadotp-d0a1059d551c86d41ecbb36a1f23516eb71679c6.tar.gz
otp-d0a1059d551c86d41ecbb36a1f23516eb71679c6.tar.bz2
otp-d0a1059d551c86d41ecbb36a1f23516eb71679c6.zip
keep all method parameters final
Diffstat (limited to 'lib/jinterface')
-rw-r--r--lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java7
-rw-r--r--lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java16
-rw-r--r--lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java7
-rw-r--r--lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java14
-rw-r--r--lib/jinterface/test/jinterface_SUITE_data/GetNames.java6
-rw-r--r--lib/jinterface/test/jinterface_SUITE_data/NodeStatusHandler.java12
6 files changed, 40 insertions, 22 deletions
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java
index bfc4c92c28..a80d02e12c 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java
@@ -749,13 +749,14 @@ public abstract class AbstractConnection extends Thread {
final int oldLevel = traceLevel;
// pin the value
+ int theLevel = level;
if (level < 0) {
- level = 0;
+ theLevel = 0;
} else if (level > 4) {
- level = 4;
+ theLevel = 4;
}
- traceLevel = level;
+ traceLevel = theLevel;
return oldLevel;
}
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
index 8d490d1370..a6e7936e78 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
@@ -85,16 +85,17 @@ public class OtpInputStream extends ByteArrayInputStream {
*
* @return the previous position in the stream.
*/
- public int setPos(int pos) {
+ public int setPos(final int pos) {
final int oldpos = super.pos;
+ int apos = pos;
if (pos > super.count) {
- pos = super.count;
+ apos = super.count;
} else if (pos < 0) {
- pos = 0;
+ apos = 0;
}
- super.pos = pos;
+ super.pos = apos;
return oldpos;
}
@@ -284,7 +285,7 @@ public class OtpInputStream extends ByteArrayInputStream {
* @exception OtpErlangDecodeException
* if the next byte cannot be read.
*/
- public long readLE(int n) throws OtpErlangDecodeException {
+ public long readLE(final int n) throws OtpErlangDecodeException {
final byte[] b = new byte[n];
try {
super.read(b);
@@ -292,8 +293,9 @@ public class OtpInputStream extends ByteArrayInputStream {
throw new OtpErlangDecodeException("Cannot read from input stream");
}
long v = 0;
- while (n-- > 0) {
- v = v << 8 | (long) b[n] & 0xff;
+ int i = n;
+ while (i-- > 0) {
+ v = v << 8 | (long) b[i] & 0xff;
}
return v;
}
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java
index 31a5d0fb8f..7c5bc69361 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMsg.java
@@ -129,13 +129,14 @@ public class OtpMsg {
}
// other message types (link, unlink)
- OtpMsg(int tag, final OtpErlangPid from, final OtpErlangPid to) {
+ OtpMsg(final int tag, final OtpErlangPid from, final OtpErlangPid to) {
// convert TT-tags to equiv non-TT versions
+ int atag = tag;
if (tag > 10) {
- tag -= 10;
+ atag -= 10;
}
- this.tag = tag;
+ this.tag = atag;
this.from = from;
this.to = to;
}
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java
index e082a1bda0..6e91a855a0 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java
@@ -284,10 +284,11 @@ public class OtpOutputStream extends ByteArrayOutputStream {
* @param b
* the number of bytes to write from the little end.
*/
- public void writeLE(long n, final int b) {
+ public void writeLE(final long n, final int b) {
+ long v = n;
for (int i = 0; i < b; i++) {
- write((byte) (n & 0xff));
- n >>= 8;
+ write((byte) (v & 0xff));
+ v >>= 8;
}
}
@@ -517,16 +518,17 @@ public class OtpOutputStream extends ByteArrayOutputStream {
write_double(f);
}
- public void write_big_integer(BigInteger v) {
+ public void write_big_integer(final BigInteger v) {
if (v.bitLength() < 64) {
this.write_long(v.longValue(), true);
return;
}
final int signum = v.signum();
+ BigInteger val = v;
if (signum < 0) {
- v = v.negate();
+ val = val.negate();
}
- final byte[] magnitude = v.toByteArray();
+ final byte[] magnitude = val.toByteArray();
final int n = magnitude.length;
// Reverse the array to make it little endian.
for (int i = 0, j = n; i < j--; i++) {
diff --git a/lib/jinterface/test/jinterface_SUITE_data/GetNames.java b/lib/jinterface/test/jinterface_SUITE_data/GetNames.java
index 3d2bc4ac84..54efaad242 100644
--- a/lib/jinterface/test/jinterface_SUITE_data/GetNames.java
+++ b/lib/jinterface/test/jinterface_SUITE_data/GetNames.java
@@ -18,7 +18,9 @@
*/
import java.util.ArrayList;
-import com.ericsson.otp.erlang.*;
+
+import com.ericsson.otp.erlang.OtpMbox;
+import com.ericsson.otp.erlang.OtpNode;
class GetNames {
@@ -37,7 +39,7 @@ class GetNames {
OtpMbox mbox3 = node.createMbox();
node.registerName("mbox3",mbox3);
- ArrayList existing_names = new ArrayList();
+ ArrayList<String> existing_names = new ArrayList<String>();
existing_names.add("mbox3");
existing_names.add("mbox2");
existing_names.add("mbox1");
diff --git a/lib/jinterface/test/jinterface_SUITE_data/NodeStatusHandler.java b/lib/jinterface/test/jinterface_SUITE_data/NodeStatusHandler.java
index 51ea15b5ef..13c6203b15 100644
--- a/lib/jinterface/test/jinterface_SUITE_data/NodeStatusHandler.java
+++ b/lib/jinterface/test/jinterface_SUITE_data/NodeStatusHandler.java
@@ -17,7 +17,14 @@
* %CopyrightEnd%
*/
-import com.ericsson.otp.erlang.*;
+import com.ericsson.otp.erlang.OtpErlangAtom;
+import com.ericsson.otp.erlang.OtpErlangBoolean;
+import com.ericsson.otp.erlang.OtpErlangObject;
+import com.ericsson.otp.erlang.OtpErlangString;
+import com.ericsson.otp.erlang.OtpErlangTuple;
+import com.ericsson.otp.erlang.OtpMbox;
+import com.ericsson.otp.erlang.OtpNode;
+import com.ericsson.otp.erlang.OtpNodeStatus;
public class NodeStatusHandler extends OtpNodeStatus {
/*
@@ -100,6 +107,7 @@ public class NodeStatusHandler extends OtpNodeStatus {
+ @Override
public void remoteStatus(String node, boolean up, Object info) {
try {
dbg("Got remoteStatus: " + node + " " + up + " " + info);
@@ -120,6 +128,7 @@ public class NodeStatusHandler extends OtpNodeStatus {
}
+ @Override
public void localStatus(String node, boolean up, Object info) {
try {
dbg("Got localStatus: " + node + " " + up + " " + info);
@@ -141,6 +150,7 @@ public class NodeStatusHandler extends OtpNodeStatus {
+@Override
public void connAttempt(String node, boolean incoming, Object info) {
try {
dbg("Got connAttempt: " + node + " " + incoming + " " + info);