JesusFreke / smali

smali/baksmali
6.29k stars 1.07k forks source link

fix: Cast java.nio.ByteBuffer to support java6-8 #804

Closed iBotPeaches closed 3 years ago

iBotPeaches commented 3 years ago

I was having build issues with Apktool, this resolves it. Strangely, I can build smali without this either way without an issue. So its very possible this is entirely my fault somehow.

Though, I found this https://jira.mongodb.org/browse/JAVA-2559 & https://github.com/mongodb/mongo-java-driver/commit/21c91bd364d38489e0bbe2e390efdb3746ee3fff

So I feel less crazy.

Checked entire project.

➜  smali git:(master) ✗ grep -r '.position();' * 
➜  smali git:(master) ✗ grep -r '.limit();' *   
➜  smali git:(master) ✗ grep -r '.flip();' *    
➜  smali git:(master) ✗ grep -r '.clear();' *   
dexlib2/src/main/java/org/jf/dexlib2/writer/io/MemoryDeferredOutputStream.java:        buffers.clear();
dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java:            tempBuffer.clear();
➜  smali git:(master) ✗ 

Only 1 ByteBuffer affected method used.

JesusFreke commented 3 years ago

Oh weird. Thanks for the PR!

JesusFreke commented 3 years ago

I just released v2.5.1 with this fix :)

JesusFreke commented 3 years ago

Also, I confirmed that I was able to get the same error when running smali on a java 8 jdk

iBotPeaches commented 3 years ago

thanks for quick turn around!