Reduce warning noise
This commit is contained in:
parent
ccd8eb4b07
commit
2c2a0f2f37
|
@ -11,6 +11,8 @@ subprojects {
|
|||
version = '0.8.2-SNAPSHOT'
|
||||
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
compileJava.options.compilerArgs << '-XDignore.symbol.file'
|
||||
|
||||
compileTestJava.options.encoding = 'UTF-8'
|
||||
|
||||
repositories {
|
||||
|
|
|
@ -46,10 +46,10 @@ public class EthereumIESEngine
|
|||
* set up for use with stream mode, where the key derivation function
|
||||
* is used to provide a stream of bytes to xor with the message.
|
||||
* @param agree the key agreement used as the basis for the encryption
|
||||
* @param kdf the key derivation function used for byte generation
|
||||
* @param mac the message authentication code generator for the message
|
||||
* @param hash
|
||||
* @param cipher
|
||||
* @param kdf the key derivation function used for byte generation
|
||||
* @param mac the message authentication code generator for the message
|
||||
* @param hash hash ing function
|
||||
* @param cipher the actual cipher
|
||||
*/
|
||||
public EthereumIESEngine(
|
||||
BasicAgreement agree,
|
||||
|
@ -199,9 +199,9 @@ public class EthereumIESEngine
|
|||
}
|
||||
else
|
||||
{
|
||||
cipher.init(true, new KeyParameter(K1));
|
||||
cipher.init(true, new KeyParameter(K1));
|
||||
}
|
||||
|
||||
|
||||
C = new byte[cipher.getOutputSize(inLen)];
|
||||
len = cipher.processBytes(in, inOff, inLen, C, 0);
|
||||
len += cipher.doFinal(C, len);
|
||||
|
@ -292,7 +292,7 @@ public class EthereumIESEngine
|
|||
}
|
||||
else
|
||||
{
|
||||
// Block cipher mode.
|
||||
// Block cipher mode.
|
||||
K1 = new byte[((IESWithCipherParameters)param).getCipherKeySize() / 8];
|
||||
K2 = new byte[param.getMacKeySize() / 8];
|
||||
K = new byte[K1.length + K2.length];
|
||||
|
@ -308,7 +308,7 @@ public class EthereumIESEngine
|
|||
}
|
||||
else
|
||||
{
|
||||
cipher.init(false, new KeyParameter(K1));
|
||||
cipher.init(false, new KeyParameter(K1));
|
||||
}
|
||||
|
||||
M = new byte[cipher.getOutputSize(inLen - V.length - mac.getMacSize())];
|
||||
|
@ -396,12 +396,12 @@ public class EthereumIESEngine
|
|||
}
|
||||
}
|
||||
|
||||
// Compute the common value and convert to byte array.
|
||||
// Compute the common value and convert to byte array.
|
||||
agree.init(privParam);
|
||||
BigInteger z = agree.calculateAgreement(pubParam);
|
||||
byte[] Z = BigIntegers.asUnsignedByteArray(agree.getFieldSize(), z);
|
||||
|
||||
// Create input to KDF.
|
||||
// Create input to KDF.
|
||||
byte[] VZ;
|
||||
// if (V.length != 0)
|
||||
// {
|
||||
|
|
|
@ -45,6 +45,7 @@ import java.util.List;
|
|||
*/
|
||||
public class JSONHelper {
|
||||
|
||||
@SuppressWarnings("uncheked")
|
||||
public static void dumpState(ObjectNode statesNode, String address, AccountState state, ContractDetails details) {
|
||||
|
||||
List<DataWord> storageKeys = new ArrayList<>(details.getStorage().keySet());
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.nio.ByteOrder;
|
|||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
/**
|
||||
* Utility code to do optimized byte-array comparison.
|
||||
|
@ -64,8 +63,6 @@ public abstract class FastByteComparisons {
|
|||
|
||||
|
||||
/**
|
||||
* Provides a lexicographical comparer implementation; either a Java
|
||||
* implementation or a faster implementation based on {@link Unsafe}.
|
||||
*
|
||||
* <p>Uses reflection to gracefully fall back to the Java implementation if
|
||||
* {@code Unsafe} isn't available.
|
||||
|
@ -119,128 +116,6 @@ public abstract class FastByteComparisons {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") // used via reflection
|
||||
private enum UnsafeComparer implements Comparer<byte[]> {
|
||||
INSTANCE;
|
||||
|
||||
static final Unsafe theUnsafe;
|
||||
|
||||
/**
|
||||
* The offset to the first element in a byte array.
|
||||
*/
|
||||
static final int BYTE_ARRAY_BASE_OFFSET;
|
||||
|
||||
static {
|
||||
theUnsafe = (Unsafe) AccessController.doPrivileged(
|
||||
new PrivilegedAction<Object>() {
|
||||
@Override
|
||||
public Object run() {
|
||||
try {
|
||||
Field f = Unsafe.class.getDeclaredField("theUnsafe");
|
||||
f.setAccessible(true);
|
||||
return f.get(null);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
// It doesn't matter what we throw;
|
||||
// it's swallowed in getBestComparer().
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
BYTE_ARRAY_BASE_OFFSET = theUnsafe.arrayBaseOffset(byte[].class);
|
||||
|
||||
// sanity check - this should never fail
|
||||
if (theUnsafe.arrayIndexScale(byte[].class) != 1) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
static final boolean littleEndian =
|
||||
ByteOrder.nativeOrder().equals(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
/**
|
||||
* Returns true if x1 is less than x2, when both values are treated as
|
||||
* unsigned.
|
||||
*/
|
||||
static boolean lessThanUnsigned(long x1, long x2) {
|
||||
return (x1 + Long.MIN_VALUE) < (x2 + Long.MIN_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lexicographically compare two arrays.
|
||||
*
|
||||
* @param buffer1 left operand
|
||||
* @param buffer2 right operand
|
||||
* @param offset1 Where to start comparing in the left buffer
|
||||
* @param offset2 Where to start comparing in the right buffer
|
||||
* @param length1 How much to compare from the left buffer
|
||||
* @param length2 How much to compare from the right buffer
|
||||
* @return 0 if equal, < 0 if left is less than right, etc.
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(byte[] buffer1, int offset1, int length1,
|
||||
byte[] buffer2, int offset2, int length2) {
|
||||
// Short circuit equal case
|
||||
if (buffer1 == buffer2 &&
|
||||
offset1 == offset2 &&
|
||||
length1 == length2) {
|
||||
return 0;
|
||||
}
|
||||
int minLength = Math.min(length1, length2);
|
||||
int minWords = minLength / Longs.BYTES;
|
||||
int offset1Adj = offset1 + BYTE_ARRAY_BASE_OFFSET;
|
||||
int offset2Adj = offset2 + BYTE_ARRAY_BASE_OFFSET;
|
||||
|
||||
/*
|
||||
* Compare 8 bytes at a time. Benchmarking shows comparing 8 bytes at a
|
||||
* time is no slower than comparing 4 bytes at a time even on 32-bit.
|
||||
* On the other hand, it is substantially faster on 64-bit.
|
||||
*/
|
||||
for (int i = 0; i < minWords * Longs.BYTES; i += Longs.BYTES) {
|
||||
long lw = theUnsafe.getLong(buffer1, offset1Adj + (long) i);
|
||||
long rw = theUnsafe.getLong(buffer2, offset2Adj + (long) i);
|
||||
long diff = lw ^ rw;
|
||||
|
||||
if (diff != 0) {
|
||||
if (!littleEndian) {
|
||||
return lessThanUnsigned(lw, rw) ? -1 : 1;
|
||||
}
|
||||
|
||||
// Use binary search
|
||||
int n = 0;
|
||||
int y;
|
||||
int x = (int) diff;
|
||||
if (x == 0) {
|
||||
x = (int) (diff >>> 32);
|
||||
n = 32;
|
||||
}
|
||||
|
||||
y = x << 16;
|
||||
if (y == 0) {
|
||||
n += 16;
|
||||
} else {
|
||||
x = y;
|
||||
}
|
||||
|
||||
y = x << 8;
|
||||
if (y == 0) {
|
||||
n += 8;
|
||||
}
|
||||
return (int) (((lw >>> n) & 0xFFL) - ((rw >>> n) & 0xFFL));
|
||||
}
|
||||
}
|
||||
|
||||
// The epilogue to cover the last (minLength % 8) elements.
|
||||
for (int i = minWords * Longs.BYTES; i < minLength; i++) {
|
||||
int result = UnsignedBytes.compare(
|
||||
buffer1[offset1 + i],
|
||||
buffer2[offset2 + i]);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return length1 - length2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import javax.swing.table.DefaultTableModel;
|
|||
* @author Roman Mandeleil
|
||||
* @since 18.05.14
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
class ContractCallDialog extends JDialog implements MessageAwareDialog {
|
||||
|
||||
private static final long serialVersionUID = -7561153561155037293L;
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Map;
|
|||
import javax.swing.*;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class StateExplorerWindow extends JFrame {
|
||||
|
||||
private ToolBar toolBar = null;
|
||||
|
|
Loading…
Reference in New Issue