From 2d785f940616d634898f8a48f9c33924075b6a17 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Tue, 20 Jan 2015 11:17:40 +0100 Subject: [PATCH] Optimize imports using shared IDEA configuration The affected sources have drifted from import organization conventions since the shared IDEA configuration was added in commit a155518. There are several ways to avoid this in the future: 1. Run Code->Optimize Imports manually prior to making any commit (or use the shortcut key). 2. Select 'Optimize Imports on the Fly' from Preferences->Editor->General->Auto Import. If IDEA is not being used, simply follow convention. --- .../java/org/ethereum/core/BlockchainImpl.java | 7 ++++++- .../ethereum/datasource/LevelDbDataSource.java | 15 ++++++++------- .../org/ethereum/datasource/RedisDataSource.java | 13 +++++++------ .../src/main/java/org/ethereum/db/BlockStore.java | 2 ++ .../java/org/ethereum/db/BlockStoreDummy.java | 2 +- .../main/java/org/ethereum/db/BlockStoreImpl.java | 2 +- .../main/java/org/ethereum/db/DatabaseImpl.java | 3 ++- .../java/org/ethereum/db/RepositoryDummy.java | 2 -- .../main/java/org/ethereum/db/RepositoryImpl.java | 10 ++++++++-- .../java/org/ethereum/db/RepositoryTrack.java | 3 +++ .../main/java/org/ethereum/facade/Repository.java | 3 --- .../listener/EthereumListenerWrapper.java | 2 +- .../java/org/ethereum/manager/WorldManager.java | 1 - .../java/org/ethereum/net/server/Channel.java | 1 + .../src/main/java/org/ethereum/trie/Cache.java | 3 --- .../src/main/java/org/ethereum/trie/TrieImpl.java | 2 -- .../src/main/java/org/ethereum/vm/Program.java | 9 +++++++-- .../org/ethereum/vm/ProgramInvokeFactoryImpl.java | 1 - .../ethereum/datasource/RedisDataSourceTest.java | 3 +++ .../src/test/java/test/ethereum/db/MockDB.java | 1 + .../test/java/test/ethereum/trie/TrieTest.java | 14 +++++++++++--- .../test/ethereum/vm/PrecompiledContractTest.java | 3 ++- .../src/test/java/test/ethereum/vm/VMTest.java | 3 ++- .../java/org/ethereum/gui/AccountsListWindow.java | 7 +++++-- 24 files changed, 71 insertions(+), 41 deletions(-) diff --git a/ethereumj-core/src/main/java/org/ethereum/core/BlockchainImpl.java b/ethereumj-core/src/main/java/org/ethereum/core/BlockchainImpl.java index da0263ef..36fef6b1 100644 --- a/ethereumj-core/src/main/java/org/ethereum/core/BlockchainImpl.java +++ b/ethereumj-core/src/main/java/org/ethereum/core/BlockchainImpl.java @@ -9,9 +9,12 @@ import org.ethereum.net.BlockQueue; import org.ethereum.net.server.ChannelManager; import org.ethereum.util.AdvancedDeviceUtils; import org.ethereum.vm.ProgramInvokeFactory; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import org.spongycastle.util.encoders.Hex; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.FileSystemUtils; @@ -20,7 +23,9 @@ import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; + import java.math.BigInteger; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -332,7 +337,7 @@ public class BlockchainImpl implements Blockchain { for (Transaction tx : block.getTransactionsList()) { stateLogger.info("apply block: [{}] tx: [{}] ", block.getNumber(), i); - TransactionExecutor executor = new TransactionExecutor(tx, block.getCoinbase(), + TransactionExecutor executor = new TransactionExecutor(tx, block.getCoinbase(), track, blockStore, programInvokeFactory, block); executor.execute(); diff --git a/ethereumj-core/src/main/java/org/ethereum/datasource/LevelDbDataSource.java b/ethereumj-core/src/main/java/org/ethereum/datasource/LevelDbDataSource.java index 421f3fdf..f030a385 100644 --- a/ethereumj-core/src/main/java/org/ethereum/datasource/LevelDbDataSource.java +++ b/ethereumj-core/src/main/java/org/ethereum/datasource/LevelDbDataSource.java @@ -1,18 +1,19 @@ package org.ethereum.datasource; import org.ethereum.config.SystemProperties; -import org.ethereum.db.ByteArrayWrapper; -import org.ethereum.db.Database; -import org.ethereum.db.DatabaseImpl; -import org.ethereum.trie.Node; -import org.iq80.leveldb.*; + +import org.iq80.leveldb.CompressionType; +import org.iq80.leveldb.DB; +import org.iq80.leveldb.DBIterator; +import org.iq80.leveldb.Options; +import org.iq80.leveldb.WriteBatch; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.spongycastle.util.encoders.Hex; import java.io.File; import java.io.IOException; -import java.util.HashMap; + import java.util.HashSet; import java.util.Map; import java.util.Set; diff --git a/ethereumj-core/src/main/java/org/ethereum/datasource/RedisDataSource.java b/ethereumj-core/src/main/java/org/ethereum/datasource/RedisDataSource.java index 2ef34ef4..df1c495b 100644 --- a/ethereumj-core/src/main/java/org/ethereum/datasource/RedisDataSource.java +++ b/ethereumj-core/src/main/java/org/ethereum/datasource/RedisDataSource.java @@ -1,15 +1,16 @@ package org.ethereum.datasource; -import org.ethereum.db.Database; -import org.ethereum.db.DatabaseImpl; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.Pipeline; - -import java.util.*; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import static org.ethereum.config.SystemProperties.CONFIG; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.Pipeline; + /** * @author Roman Mandeleil * @since 18.01.2015 diff --git a/ethereumj-core/src/main/java/org/ethereum/db/BlockStore.java b/ethereumj-core/src/main/java/org/ethereum/db/BlockStore.java index e06416d5..1cbfc4a9 100644 --- a/ethereumj-core/src/main/java/org/ethereum/db/BlockStore.java +++ b/ethereumj-core/src/main/java/org/ethereum/db/BlockStore.java @@ -2,9 +2,11 @@ package org.ethereum.db; import org.ethereum.core.Block; import org.ethereum.core.TransactionReceipt; + import org.springframework.transaction.annotation.Transactional; import java.math.BigInteger; + import java.util.List; /** diff --git a/ethereumj-core/src/main/java/org/ethereum/db/BlockStoreDummy.java b/ethereumj-core/src/main/java/org/ethereum/db/BlockStoreDummy.java index b987589e..9d137b64 100644 --- a/ethereumj-core/src/main/java/org/ethereum/db/BlockStoreDummy.java +++ b/ethereumj-core/src/main/java/org/ethereum/db/BlockStoreDummy.java @@ -3,9 +3,9 @@ package org.ethereum.db; import org.ethereum.core.Block; import org.ethereum.core.TransactionReceipt; import org.ethereum.crypto.HashUtil; -import org.ethereum.util.ByteUtil; import java.math.BigInteger; + import java.util.List; /** diff --git a/ethereumj-core/src/main/java/org/ethereum/db/BlockStoreImpl.java b/ethereumj-core/src/main/java/org/ethereum/db/BlockStoreImpl.java index 6149df9a..692c3a27 100644 --- a/ethereumj-core/src/main/java/org/ethereum/db/BlockStoreImpl.java +++ b/ethereumj-core/src/main/java/org/ethereum/db/BlockStoreImpl.java @@ -2,8 +2,8 @@ package org.ethereum.db; import org.ethereum.core.Block; import org.ethereum.core.TransactionReceipt; - import org.ethereum.util.ByteUtil; + import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/ethereumj-core/src/main/java/org/ethereum/db/DatabaseImpl.java b/ethereumj-core/src/main/java/org/ethereum/db/DatabaseImpl.java index 8038f7ab..fe0933be 100644 --- a/ethereumj-core/src/main/java/org/ethereum/db/DatabaseImpl.java +++ b/ethereumj-core/src/main/java/org/ethereum/db/DatabaseImpl.java @@ -1,12 +1,13 @@ package org.ethereum.db; -import org.ethereum.config.SystemProperties; import org.ethereum.datasource.KeyValueDataSource; import org.ethereum.datasource.LevelDbDataSource; import org.ethereum.datasource.RedisDataSource; import org.ethereum.util.ByteUtil; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import org.spongycastle.util.encoders.Hex; import java.util.ArrayList; diff --git a/ethereumj-core/src/main/java/org/ethereum/db/RepositoryDummy.java b/ethereumj-core/src/main/java/org/ethereum/db/RepositoryDummy.java index 06e02746..9b78a040 100644 --- a/ethereumj-core/src/main/java/org/ethereum/db/RepositoryDummy.java +++ b/ethereumj-core/src/main/java/org/ethereum/db/RepositoryDummy.java @@ -5,8 +5,6 @@ import org.ethereum.core.Block; import org.ethereum.facade.Repository; import org.ethereum.vm.DataWord; -import org.iq80.leveldb.DBIterator; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/ethereumj-core/src/main/java/org/ethereum/db/RepositoryImpl.java b/ethereumj-core/src/main/java/org/ethereum/db/RepositoryImpl.java index bfaa3c4b..fd11d9c8 100644 --- a/ethereumj-core/src/main/java/org/ethereum/db/RepositoryImpl.java +++ b/ethereumj-core/src/main/java/org/ethereum/db/RepositoryImpl.java @@ -1,7 +1,5 @@ package org.ethereum.db; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; import org.ethereum.core.AccountState; import org.ethereum.core.Block; import org.ethereum.facade.Repository; @@ -10,9 +8,15 @@ import org.ethereum.json.JSONHelper; import org.ethereum.trie.Trie; import org.ethereum.trie.TrieImpl; import org.ethereum.vm.DataWord; + +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import com.fasterxml.jackson.databind.node.ObjectNode; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import org.spongycastle.util.encoders.Hex; + import org.springframework.stereotype.Component; import org.springframework.util.FileSystemUtils; @@ -20,7 +24,9 @@ import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; + import java.math.BigInteger; + import java.util.HashMap; import java.util.List; import java.util.Set; diff --git a/ethereumj-core/src/main/java/org/ethereum/db/RepositoryTrack.java b/ethereumj-core/src/main/java/org/ethereum/db/RepositoryTrack.java index 2a77cd1d..73462ea7 100644 --- a/ethereumj-core/src/main/java/org/ethereum/db/RepositoryTrack.java +++ b/ethereumj-core/src/main/java/org/ethereum/db/RepositoryTrack.java @@ -4,11 +4,14 @@ import org.ethereum.core.AccountState; import org.ethereum.core.Block; import org.ethereum.facade.Repository; import org.ethereum.vm.DataWord; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import org.spongycastle.util.encoders.Hex; import java.math.BigInteger; + import java.util.HashMap; import java.util.Set; diff --git a/ethereumj-core/src/main/java/org/ethereum/facade/Repository.java b/ethereumj-core/src/main/java/org/ethereum/facade/Repository.java index 846b6929..a8ca5859 100644 --- a/ethereumj-core/src/main/java/org/ethereum/facade/Repository.java +++ b/ethereumj-core/src/main/java/org/ethereum/facade/Repository.java @@ -6,12 +6,9 @@ import org.ethereum.db.ByteArrayWrapper; import org.ethereum.db.ContractDetails; import org.ethereum.vm.DataWord; -import org.iq80.leveldb.DBIterator; - import java.math.BigInteger; import java.util.HashMap; -import java.util.Map; import java.util.Set; /** diff --git a/ethereumj-core/src/main/java/org/ethereum/listener/EthereumListenerWrapper.java b/ethereumj-core/src/main/java/org/ethereum/listener/EthereumListenerWrapper.java index 5fff8dc9..7ca9876e 100644 --- a/ethereumj-core/src/main/java/org/ethereum/listener/EthereumListenerWrapper.java +++ b/ethereumj-core/src/main/java/org/ethereum/listener/EthereumListenerWrapper.java @@ -3,8 +3,8 @@ package org.ethereum.listener; import org.ethereum.core.Block; import org.ethereum.core.Transaction; import org.ethereum.net.message.Message; - import org.ethereum.net.p2p.HelloMessage; + import org.springframework.stereotype.Component; import java.util.Set; diff --git a/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java b/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java index c3f13235..a4bf8b79 100644 --- a/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java +++ b/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java @@ -7,7 +7,6 @@ import org.ethereum.core.TransactionReceipt; import org.ethereum.core.Wallet; import org.ethereum.crypto.HashUtil; import org.ethereum.db.BlockStore; -import org.ethereum.db.BlockStoreImpl; import org.ethereum.facade.Blockchain; import org.ethereum.facade.Repository; import org.ethereum.listener.EthereumListener; diff --git a/ethereumj-core/src/main/java/org/ethereum/net/server/Channel.java b/ethereumj-core/src/main/java/org/ethereum/net/server/Channel.java index 280d3ecd..8f66a642 100644 --- a/ethereumj-core/src/main/java/org/ethereum/net/server/Channel.java +++ b/ethereumj-core/src/main/java/org/ethereum/net/server/Channel.java @@ -15,6 +15,7 @@ import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import java.math.BigInteger; + import java.net.InetSocketAddress; /** diff --git a/ethereumj-core/src/main/java/org/ethereum/trie/Cache.java b/ethereumj-core/src/main/java/org/ethereum/trie/Cache.java index 29502a62..9213b7da 100644 --- a/ethereumj-core/src/main/java/org/ethereum/trie/Cache.java +++ b/ethereumj-core/src/main/java/org/ethereum/trie/Cache.java @@ -5,9 +5,6 @@ import org.ethereum.datasource.KeyValueDataSource; import org.ethereum.db.ByteArrayWrapper; import org.ethereum.util.Value; -import org.iq80.leveldb.DB; -import org.iq80.leveldb.WriteBatch; - import java.util.HashMap; import java.util.Iterator; import java.util.Map; diff --git a/ethereumj-core/src/main/java/org/ethereum/trie/TrieImpl.java b/ethereumj-core/src/main/java/org/ethereum/trie/TrieImpl.java index 960ccc39..104c5573 100644 --- a/ethereumj-core/src/main/java/org/ethereum/trie/TrieImpl.java +++ b/ethereumj-core/src/main/java/org/ethereum/trie/TrieImpl.java @@ -5,8 +5,6 @@ import org.ethereum.datasource.KeyValueDataSource; import org.ethereum.db.ByteArrayWrapper; import org.ethereum.util.Value; -import org.iq80.leveldb.DB; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/ethereumj-core/src/main/java/org/ethereum/vm/Program.java b/ethereumj-core/src/main/java/org/ethereum/vm/Program.java index 8a19dd25..64d6eaac 100644 --- a/ethereumj-core/src/main/java/org/ethereum/vm/Program.java +++ b/ethereumj-core/src/main/java/org/ethereum/vm/Program.java @@ -1,7 +1,6 @@ package org.ethereum.vm; import org.ethereum.crypto.HashUtil; -import org.ethereum.db.BlockStore; import org.ethereum.db.ContractDetails; import org.ethereum.facade.Repository; import org.ethereum.util.ByteUtil; @@ -28,7 +27,13 @@ import java.math.BigInteger; import java.nio.ByteBuffer; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.Stack; import static org.ethereum.config.SystemProperties.CONFIG; import static org.ethereum.util.ByteUtil.EMPTY_BYTE_ARRAY; diff --git a/ethereumj-core/src/main/java/org/ethereum/vm/ProgramInvokeFactoryImpl.java b/ethereumj-core/src/main/java/org/ethereum/vm/ProgramInvokeFactoryImpl.java index bcb00128..972e9388 100644 --- a/ethereumj-core/src/main/java/org/ethereum/vm/ProgramInvokeFactoryImpl.java +++ b/ethereumj-core/src/main/java/org/ethereum/vm/ProgramInvokeFactoryImpl.java @@ -3,7 +3,6 @@ package org.ethereum.vm; import org.ethereum.core.Block; import org.ethereum.core.Transaction; import org.ethereum.db.BlockStore; -import org.ethereum.db.BlockStoreImpl; import org.ethereum.facade.Blockchain; import org.ethereum.facade.Repository; import org.ethereum.util.ByteUtil; diff --git a/ethereumj-core/src/test/java/test/ethereum/datasource/RedisDataSourceTest.java b/ethereumj-core/src/test/java/test/ethereum/datasource/RedisDataSourceTest.java index 960af183..33d30293 100644 --- a/ethereumj-core/src/test/java/test/ethereum/datasource/RedisDataSourceTest.java +++ b/ethereumj-core/src/test/java/test/ethereum/datasource/RedisDataSourceTest.java @@ -1,9 +1,12 @@ package test.ethereum.datasource; import org.ethereum.datasource.RedisDataSource; + import org.junit.Assert; import org.junit.Test; + import org.spongycastle.util.encoders.Hex; + import redis.clients.jedis.exceptions.JedisConnectionException; /** diff --git a/ethereumj-core/src/test/java/test/ethereum/db/MockDB.java b/ethereumj-core/src/test/java/test/ethereum/db/MockDB.java index e513326b..4608cc84 100644 --- a/ethereumj-core/src/test/java/test/ethereum/db/MockDB.java +++ b/ethereumj-core/src/test/java/test/ethereum/db/MockDB.java @@ -2,6 +2,7 @@ package test.ethereum.db; import org.ethereum.datasource.KeyValueDataSource; import org.ethereum.db.ByteArrayWrapper; + import org.iq80.leveldb.DBException; import java.util.HashMap; diff --git a/ethereumj-core/src/test/java/test/ethereum/trie/TrieTest.java b/ethereumj-core/src/test/java/test/ethereum/trie/TrieTest.java index 28992b9f..04a21179 100644 --- a/ethereumj-core/src/test/java/test/ethereum/trie/TrieTest.java +++ b/ethereumj-core/src/test/java/test/ethereum/trie/TrieTest.java @@ -1,7 +1,5 @@ package test.ethereum.trie; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.Pipeline; import test.ethereum.db.MockDB; import org.ethereum.core.AccountState; @@ -34,11 +32,21 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; import static org.ethereum.crypto.HashUtil.EMPTY_TRIE_HASH; import static org.junit.Assert.*; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.Pipeline; + public class TrieTest { private static final Logger logger = LoggerFactory.getLogger("test"); diff --git a/ethereumj-core/src/test/java/test/ethereum/vm/PrecompiledContractTest.java b/ethereumj-core/src/test/java/test/ethereum/vm/PrecompiledContractTest.java index a2ee2eee..0cb3da5d 100644 --- a/ethereumj-core/src/test/java/test/ethereum/vm/PrecompiledContractTest.java +++ b/ethereumj-core/src/test/java/test/ethereum/vm/PrecompiledContractTest.java @@ -4,8 +4,9 @@ import org.ethereum.util.ByteUtil; import org.ethereum.vm.DataWord; import org.ethereum.vm.PrecompiledContracts; import org.ethereum.vm.PrecompiledContracts.PrecompiledContract; -import org.junit.Assert; + import org.junit.Test; + import org.spongycastle.util.encoders.Hex; import static org.junit.Assert.*; diff --git a/ethereumj-core/src/test/java/test/ethereum/vm/VMTest.java b/ethereumj-core/src/test/java/test/ethereum/vm/VMTest.java index aa724763..f789fdb6 100644 --- a/ethereumj-core/src/test/java/test/ethereum/vm/VMTest.java +++ b/ethereumj-core/src/test/java/test/ethereum/vm/VMTest.java @@ -1,6 +1,5 @@ package test.ethereum.vm; -import jdk.nashorn.internal.ir.annotations.Ignore; import org.ethereum.facade.Repository; import org.ethereum.util.ByteUtil; import org.ethereum.vm.DataWord; @@ -24,6 +23,8 @@ import java.util.List; import static org.junit.Assert.*; +import jdk.nashorn.internal.ir.annotations.Ignore; + /** * @author Roman Mandeleil * @since 01.06.2014 diff --git a/ethereumj-studio/src/main/java/org/ethereum/gui/AccountsListWindow.java b/ethereumj-studio/src/main/java/org/ethereum/gui/AccountsListWindow.java index e889542c..ac454954 100755 --- a/ethereumj-studio/src/main/java/org/ethereum/gui/AccountsListWindow.java +++ b/ethereumj-studio/src/main/java/org/ethereum/gui/AccountsListWindow.java @@ -4,16 +4,19 @@ import org.ethereum.core.AccountState; import org.ethereum.core.Denomination; import org.ethereum.crypto.HashUtil; import org.ethereum.facade.Repository; + import org.spongycastle.util.Arrays; import org.spongycastle.util.encoders.Hex; -import javax.swing.*; -import javax.swing.table.AbstractTableModel; import java.awt.*; + import java.util.ArrayList; import java.util.List; import java.util.Set; +import javax.swing.*; +import javax.swing.table.AbstractTableModel; + public class AccountsListWindow extends JFrame { private JTable tblAccountsDataTable;