diff --git a/ethereumj-core/src/main/java/org/ethereum/solidity/SolidityType.java b/ethereumj-core/src/main/java/org/ethereum/solidity/SolidityType.java index 6c2a04d8ca..86228abc39 100644 --- a/ethereumj-core/src/main/java/org/ethereum/solidity/SolidityType.java +++ b/ethereumj-core/src/main/java/org/ethereum/solidity/SolidityType.java @@ -135,6 +135,23 @@ public byte[] encode(Object value) { throw new RuntimeException("List value expected for type " + getName()); } } + + @Override + public String getCanonicalName() { + return getArrayCanonicalName(""); + } + + String getArrayCanonicalName(String parentDimStr) { + String myDimStr = parentDimStr + getCanonicalDimension(); + if (getElementType() instanceof ArrayType) { + return ((ArrayType) getElementType()). + getArrayCanonicalName(myDimStr); + } else { + return getElementType().getCanonicalName() + myDimStr; + } + } + + protected abstract String getCanonicalDimension(); public SolidityType getElementType() { return elementType; @@ -164,6 +181,11 @@ public String getCanonicalName() { return elementType.getCanonicalName() + "[" + size + "]"; } } + + @Override + protected String getCanonicalDimension() { + return "[" + size + "]"; + } @Override public byte[] encodeList(List l) { @@ -207,6 +229,11 @@ public String getCanonicalName() { return elementType.getCanonicalName() + "[]"; } } + + @Override + protected String getCanonicalDimension() { + return "[]"; + } @Override public byte[] encodeList(List l) {