While exploring DictionaryBase.weightedParse() I found that after second iteration of inner for-loop ( DictionaryBase.java:148). suffix.toString() starts throwing StringIndexOutOfBoundsException.
You can make sure of that by inserting String s = suffix.toString(); after DictionaryBase.java:149 line. After that test DictExpansionTest.testIndependent() will fail.
After tiny exploration I found that it's happening because of bug(?) in CharSeqAdapter.copyToArray().
Does line start += this.start; make sense? In function CharSeqAdapter.charAt() we also do that operation. So we incrementing offset twice.
Because of that while incrementing start in for-loop in CharSeq.copyToArray() it goes out of the bound of initial delegate size.
I will provide a pull request if this would be confirmed.
While exploring
DictionaryBase.weightedParse()I found that after second iteration of inner for-loop ( DictionaryBase.java:148).suffix.toString()starts throwing StringIndexOutOfBoundsException.You can make sure of that by inserting
String s = suffix.toString();after DictionaryBase.java:149 line. After that testDictExpansionTest.testIndependent()will fail.After tiny exploration I found that it's happening because of bug(?) in
CharSeqAdapter.copyToArray().Does line
start += this.start;make sense? In functionCharSeqAdapter.charAt()we also do that operation. So we incrementing offset twice.Because of that while incrementing
startin for-loop inCharSeq.copyToArray()it goes out of the bound of initial delegate size.I will provide a pull request if this would be confirmed.