java class format error LVTT entry does not match any LVT entry
Java class file shrinker, optimizer, obfuscator, and preverifier
Brought to you by:
guardsquare
Using Proguard 5.3.3. The error is
java.lang.ClassFormatError: LVTT entry for 'arrayClazz' in class file
net/certiv/dsl/core/DslCore does not match any LVT entry
The error did not occur with Proguard 5.2.1
The relevant code is:
public IDslElement[] getDslElementArray(Map<String, String> map, String countAttribute, String arrayAttribute,
int offset, String project, Class<? extends IDslElement> arrayClazz) throws IllegalArgumentException {
if (countAttribute != null) {
int count = getInt(map, countAttribute);
IDslElement[] result = (IDslElement[]) Array.newInstance(arrayClazz, count);
for (int i = 0; i < count; i++) {
result[i] = getDslElement(map, getAttributeName(arrayAttribute, i + offset), project);
}
return result;
} else {
ArrayList<IDslElement> result = new ArrayList<>();
IDslElement element = null;
while ((element = getDslElement(map, arrayAttribute, project, true)) != null) {
result.add(element);
}
return (IDslElement[]) result.toArray((Object[]) Array.newInstance(arrayClazz, result.size()));
}
}
Related to bugs #376 and #459.
Keeping 'LocalVariableTable' alone is not sufficient. Using '-optimizations !code/allocation/variable' does work as a workaround.
Thanks for your report. ProGuard's optimization step sometimes has problems keeping the LocalVariableTable up to date as it optimizes the code. The LocalVariableTable is just an attribute with debug information about local variables. Typical programs don't need it, so you can perhaps not keep it explicitly to work around the problem.
It's difficult to reproduce the problem when I can't compile the code snippet. Can you send me a source file that compiles?