Use newer dex to verify Kotlin bytecode in tests

This commit is contained in:
Andrey Breslav
2014-11-29 17:58:43 +03:00
parent 27d403ee23
commit 19d0ad7e10
3 changed files with 29 additions and 4 deletions
@@ -16,8 +16,11 @@
package org.jetbrains.jet.codegen;
import com.android.dx.cf.direct.DirectClassFile;
import com.android.dx.cf.direct.StdAttributeFactory;
import com.android.dx.command.dexer.Main;
import com.android.dx.dex.cf.CfTranslator;
import com.android.dx.dex.file.DexFile;
import org.jetbrains.jet.OutputFile;
import org.junit.Assert;
@@ -42,7 +45,16 @@ public class DxChecker {
for (OutputFile file : outputFiles.asList()) {
try {
CfTranslator.translate(file.getRelativePath(), file.asByteArray(), arguments.cfOptions, arguments.dexOptions);
byte[] bytes = file.asByteArray();
DirectClassFile cf = new DirectClassFile(bytes, file.getRelativePath(), true);
cf.setAttributeFactory(StdAttributeFactory.THE_ONE);
CfTranslator.translate(
cf,
bytes,
arguments.cfOptions,
arguments.dexOptions,
new DexFile(arguments.dexOptions)
);
}
catch (Throwable e) {
Assert.fail(generateExceptionMessage(e));