-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: difference code between Eclipse and Gradle #536
Comments
@asashour looks like I found the cause of this issue. Here method And yes, I know that Eclipse compiler in some cases generate very different bytecode, especially for syntax sugar like enums (see post in CFR decompiler blog). |
Thanks for the hint. Another suggestion, is that we actually add other compilers, so we support different bytecode flavors. Obviously this would double or triple the build time, but I guess it is worth it. |
I think the difference is very small and running all tests again not worth it, just adding some smali tests is enough. Also, there are tons of other tools for change bytecode like obfuscators, optimizers, packers, etc and we can't run tests again for all of them and in my opinion jadx is general enough to handle them good. |
Thanks, test passes now in Eclipse. |
I add test option to allow write test with Eclipse compiler. Maybe it will be useful. new byte[]{1, 0, 2, 0, 0, 0, 0, 0, 0, 3} Eclipse compiler generate: byte[] bArr = new byte[10];
bArr[0] = 1;
bArr[2] = 2;
bArr[9] = 3; I like this 'zeros elimination'. Jadx can revert it, but only if exists all sequential puts without skips, and I think for this case I will not fix that because it looks good. And also it is hard to determine how many skips are allowed. Like byte[] arr = new byte[10];
arr[9] = 1; must be converted to |
I have thought a little about it, but thought it doesn't worth the effort, since byte array starting with 0 wouldn't be a common case, and in both ways, the code is correct. After major issues are fixes, we can think about those enhancements :) What was annoying is that eclipse tests gives different results, thanks for fixing it :) |
I see the Eclipse compiler option, very nice. |
This is the second time, I notice there is a difference in a test result between Eclipse and Gradle on Windows.
The first one was in #522, and I ended up adding
noDebugInfo()
for all relevant tests, because somehow the debug info containedboolean
types however in obfuscated code, it isint
.The purpose of this issue, is not to particularly fix a specific test, but rather to know why Eclipse tests differ from Gradle.
I know Eclipse has an internal compiler, but I think we use the system java compiler, which is
javac
(throughToolProvider.getSystemJavaCompiler()
).Test case which passes in Gradle, but fails in Eclipse
The generated code in Eclipse is:
The text was updated successfully, but these errors were encountered: