脚本宝典收集整理的这篇文章主要介绍了

replace java.lang.String.equals by Xbootclasspath

脚本宝典小编觉得挺不错的,现在分享给大家,也给大家做个参考,希望能帮助你少写一行代码,多一份安全和惬意。

env:
os:ubuntu 16.04 x64
openjdk8u

//java.lang.String package java.lang; import java.lang.StringDebugHelper; //... public final class String{  final char value[];//remove private     public boolean equals(Object anObject) {         if (this == anObject) {             return true;         }         if (anObject instanceof String) {          // {replace begin             String anotherString = (String)anObject;             if(StringDebugHelper.Equals.isInAttention(this) || StringDebugHelper.Equals.isInAttention(anotherString)){                 //new Throwable().getStackTrace();//not crash                 //System.out.println("xxxxx");//not crash                 new Throwable("attention:"+this).printStackTrace();             }             //Thread.currentThread().getStackTrace();//crash             //new Throwable().getStackTrace();//crash             //new Exception("uuuuuuuuuu");//crash             //new String("dddxx");//not crash             //System.out.println("xxxxx");//crash             int n = value.length;             return StringDebugHelper.Equals.equals(this.value, anotherString.value);         //replace end}         }         return false;     } }
package java.lang;  //import java.util.Set;  public class StringDebugHelper{      public static class Equals{         public static String[] attention;                           public static boolean isInAttention(final String str){             if(attention==null) return false;             for(int i = 0; i < attention.length; i++){                 if(null != attention[i] && StringDebugHelper.Equals.equals(attention[i].value, str.value))                     return true;             }             return false;         }          public static boolean equals(final char [] thiz,final char [] anotherString) {             int n = thiz.length;             if (n == anotherString.length) {                 char v1[] = thiz;                 char v2[] = anotherString;                 int i = 0;                 while (n-- != 0) {                     if (v1[i] != v2[i])                         return false;                     i++;                 }                 return true;             }             return false;         }           }  }
import java.util.HashSet; import java.util.Set;  public class StringDebugHelperTest{     public static void main(String[] args){                  // to this before boot app {         String[] st = new String[5];         st[0] = "java";         st[1] =  "tsogvilin";         StringDebugHelper.Equals.attention = st;                  // }                  // app content:         //"java".equals(new String("java"));         "tsogvilin".equals(new String("tsogvilin"));              }  }
#compile javac -sourcepath main/src/ -d main/classes/ main/src/*.java   javac -Xbootclasspath/p:main/classes -d test/classes/ test/src/*.java   #run java -Xbootclasspath/p:main/classes -cp test/classes T    java -Xbootclasspath/p:main/classes -cp test/classes StringDebugHelperTest 

real exmaple :apktool:

#replace javac cmd:  mv /usr/lib/jvm/java-8-openjdk-amd64/bin/javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac.real  cat  /usr/lib/jvm/java-8-openjdk-amd64/bin/javac #!/bin/sh  /usr/lib/jvm/java-8-openjdk-amd64/bin/javac.real -Xbootclasspath/p:/home/z/hg_openjdk_java_net/jdk8u_jdk8u/str.eq.dbg/main/classes/ "$@" 
Apktool/build.gradle:     tasks.withType(JavaCompile) {         options.compilerArgs += ["-Xlint:-options"]         // add this:         options.bootClasspath = "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/rt.jar:/home/z/hg_openjdk_java_net/jdk8u_jdk8u/str.eq.dbg/main/classes/"  //add this     }
//Apktool/brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java:         // to this before boot app {         String[] st = new String[1];         st[0] = "resources.arsc";         //st[1] =  "tsogvilin";         StringDebugHelper.Equals.attention = st;         System.out.println("rrrrrrrrrrrrrrrrrr");                  // }
java -Xbootclasspath/p:main/classes -cp /home/z/a/Apktool/brut.apktool/apktool-cli/build/libs/apktool-cli-all.jar  -Duser.language=en -Dfile.encoding=UTF8  brut.apktool.Main d  ~/a/game.v182815.apk -o ~/a/myoutdir

图片描述

总结

以上是脚本宝典为你收集整理的

replace java.lang.String.equals by Xbootclasspath

全部内容,希望文章能够帮你解决

replace java.lang.String.equals by Xbootclasspath

所遇到的程序开发问题,欢迎加入QQ群277859234一起讨论学习。如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典网站推荐给程序员好友。 本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。

80%的人都看过