摘要:
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("ffffdxx");//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
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/73154.html
摘要:因此,对应地我们可以翻译这段二进制字节码为这样的代码注意,这段代码并不能通过编译,因为源码这一层是不允许直接继承的,这个继承过程只允许在编译器内部解语法糖的过程中被编译器添加,添加之后的类才会有的访问标识符。 语法糖(Syntactic Sugar)的出现是为了降低我们编写某些代码时陷入的重复或繁琐,这使得我们使用语法糖后可以写出简明而优雅的代码。在Java中不加工的语法糖代码运行时可...
摘要:如感兴趣,可移步手写之基于动态创建对象手写之基于注解动态创建对象今天将详细介绍如何手写依赖注入,在运行过程中如何动态地为对象的属性赋值。完成后在中会有相关的包出现进行注入前需要创建工厂,在运行时从工厂中取出对象为属性赋值。 前两篇文章介绍了关于手写Spring IOC控制反转,由Spring工厂在运行过程中动态地创建对象的两种方式。如感兴趣,可移步: 手写Spring之IOC基于xml...
摘要:上一篇博客介绍了如何基于配置文件在运行时创建实例对象,这篇博客将介绍基于注解方式怎样实现对象的创建。方便测试,该类型分别创建两个单例和多例的类型。注意这种为对象注入属性值的方式耦合度较高,可根据情况使用。 上一篇博客介绍了如何基于xml配置文件在运行时创建实例对象,这篇博客将介绍基于注解方式怎样实现对象的创建。 废话不多说,直接上代码。 首先还是创建项目,由于这次不需要使用第三方的AP...
Spring作为Java Web最为流行的框架之一,其功能之强大,封装细节之全面不用过多赘述。使用Spring的方式很简单,不需要关注细节,把对象的创建和对象之间的关系都交给框架来管理,仅仅做好配置文件和实现具体的业务逻辑即可。可以说Spring为我们在编写Java Web应用时省去了大量重复的代码,并且可以降低对象与对象之间的耦合度。但若只是知其然,而不知其所以然,在编程时也难免会遇到各种问题,...
IntelliJ IDEA 问题描述 IntelliJ IDEA 在 多窗口、多项目协作开发时,MacBook Pro的散热风扇凶猛地转动,相关配置如下: MacBook Pro 配置 MacBook Pro (Retina, 15-inch, Mid 2015) 型号名称: MacBook Pro 型号标识符: MacBookPro11,4 处理器名称: Intel Core ...
阅读 2952·2021-11-16 11:55
阅读 2728·2021-09-29 09:34
阅读 3703·2021-09-01 14:21
阅读 3898·2019-08-29 12:36
阅读 771·2019-08-26 10:55
阅读 4173·2019-08-26 10:20
阅读 1105·2019-08-23 18:19
阅读 1269·2019-08-23 17:56