AST_demo:利用JavaParser框架在编译时修改语法树(源码)的demo-修改源码

上传者: 42146888 | 上传时间: 2021-09-22 22:10:21 | 文件大小: 5.26MB | 文件类型: ZIP
本示例展示了如下功能: 1,删除方法中的打印日志代码。 2,删除指定的方法和成员变量。 3,检测方法中是否有新的线程代码。 4,生成新的类和方法。并在运行时验证。 5,解析类文件:MainActivity.java,并在打印输出类信息。 6,修改类中的方法。将结果保存在工程目录下的/ output中。 7,在现有类中生成一个方法,并在运行时验证。 环境: gradle4.1 classpath 'com.android.tools.build:gradle:3.0.1' 1,删除类方法中的日志:Log.xxxx System.out.xxx 2,删除指定的方法和成员变量 //过滤如下 成员变量 和 方法 public void test() public int test(int a) String abc String def 3

文件下载

资源详情

[{"title":"( 59 个子文件 5.26MB ) AST_demo:利用JavaParser框架在编译时修改语法树(源码)的demo-修改源码","children":[{"title":"AST_demo-master","children":[{"title":"gradlew <span style='color:#111;'> 4.85KB </span>","children":null,"spread":false},{"title":"settings.gradle <span style='color:#111;'> 31B </span>","children":null,"spread":false},{"title":"output","children":[{"title":"MainActivity.java <span style='color:#111;'> 3.79KB </span>","children":null,"spread":false}],"spread":true},{"title":"lib","children":[{"title":"src","children":[{"title":"main","children":[{"title":"java","children":[{"title":"demo","children":[{"title":"ast","children":[{"title":"nzh","children":[{"title":"com","children":[{"title":"lib","children":[{"title":"translator","children":[{"title":"CleanLogTranslator.java <span style='color:#111;'> 4.80KB </span>","children":null,"spread":false}],"spread":true},{"title":"TestAnalyzer.java <span style='color:#111;'> 307B </span>","children":null,"spread":false},{"title":"MyProcessor.java <span style='color:#111;'> 29.00KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true}],"spread":true}],"spread":true}],"spread":true}],"spread":true}],"spread":true},{"title":"libs","children":[{"title":"tools.jar <span style='color:#111;'> 17.47MB </span>","children":null,"spread":false}],"spread":true},{"title":".gitignore <span style='color:#111;'> 7B </span>","children":null,"spread":false},{"title":"build.gradle <span style='color:#111;'> 1.13KB </span>","children":null,"spread":false}],"spread":true},{"title":".idea","children":[{"title":"runConfigurations.xml <span style='color:#111;'> 564B </span>","children":null,"spread":false},{"title":"misc.xml <span style='color:#111;'> 1.98KB </span>","children":null,"spread":false},{"title":"caches","children":[{"title":"build_file_checksums.ser <span style='color:#111;'> 627B </span>","children":null,"spread":false},{"title":"gradle_models.ser <span style='color:#111;'> 91.82KB </span>","children":null,"spread":false}],"spread":true},{"title":"gradle.xml <span style='color:#111;'> 778B </span>","children":null,"spread":false},{"title":"encodings.xml <span style='color:#111;'> 442B </span>","children":null,"spread":false},{"title":"modules.xml <span style='color:#111;'> 547B </span>","children":null,"spread":false},{"title":"codeStyles","children":[{"title":"Project.xml <span style='color:#111;'> 3.23KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"gradle","children":[{"title":"wrapper","children":[{"title":"gradle-wrapper.properties <span style='color:#111;'> 230B </span>","children":null,"spread":false},{"title":"gradle-wrapper.jar <span style='color:#111;'> 52.38KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"README.md <span style='color:#111;'> 4.69KB </span>","children":null,"spread":false},{"title":"gradlew.bat <span style='color:#111;'> 2.26KB </span>","children":null,"spread":false},{"title":"api","children":[{"title":"src","children":[{"title":"main","children":[{"title":"java","children":[{"title":"com","children":[{"title":"nzh","children":[{"title":"api","children":[{"title":"annotation","children":[{"title":"MethodAnnotaion.java <span style='color:#111;'> 359B </span>","children":null,"spread":false},{"title":"MethodAnnotaion2.java <span style='color:#111;'> 397B </span>","children":null,"spread":false},{"title":"ClassAnnotaion.java <span style='color:#111;'> 358B </span>","children":null,"spread":false},{"title":"FieldAnnotation.java <span style='color:#111;'> 354B </span>","children":null,"spread":false},{"title":"ParamAnnotation.java <span style='color:#111;'> 362B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":true}],"spread":true}],"spread":true}],"spread":true},{"title":".gitignore <span style='color:#111;'> 7B </span>","children":null,"spread":false},{"title":"build.gradle <span style='color:#111;'> 165B </span>","children":null,"spread":false}],"spread":true},{"title":"gradle.properties <span style='color:#111;'> 726B </span>","children":null,"spread":false},{"title":".gitignore <span style='color:#111;'> 118B </span>","children":null,"spread":false},{"title":"app","children":[{"title":"src","children":[{"title":"androidTest","children":[{"title":"java","children":[{"title":"com","children":[{"title":"nzh","children":[{"title":"ast","children":[{"title":"demo","children":[{"title":"ExampleInstrumentedTest.java <span style='color:#111;'> 733B </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false},{"title":"test","children":[{"title":"java","children":[{"title":"com","children":[{"title":"nzh","children":[{"title":"ast","children":[{"title":"demo","children":[{"title":"ExampleUnitTest.java <span style='color:#111;'> 2.29KB </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false},{"title":"main","children":[{"title":"AndroidManifest.xml <span style='color:#111;'> 710B </span>","children":null,"spread":false},{"title":"res","children":[{"title":"mipmap-hdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 2.98KB </span>","children":null,"spread":false},{"title":"ic_launcher_round.png <span style='color:#111;'> 4.91KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-xxxhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 9.03KB </span>","children":null,"spread":false},{"title":"ic_launcher_round.png <span style='color:#111;'> 15.16KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-xhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 4.46KB </span>","children":null,"spread":false},{"title":"ic_launcher_round.png <span style='color:#111;'> 6.93KB </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-anydpi-v26","children":[{"title":"ic_launcher.xml <span style='color:#111;'> 272B </span>","children":null,"spread":false},{"title":"ic_launcher_round.xml <span style='color:#111;'> 272B </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-mdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 2.05KB </span>","children":null,"spread":false},{"title":"ic_launcher_round.png <span style='color:#111;'> 2.79KB </span>","children":null,"spread":false}],"spread":false},{"title":"drawable","children":[{"title":"ic_launcher_background.xml <span style='color:#111;'> 5.47KB </span>","children":null,"spread":false}],"spread":false},{"title":"layout","children":[{"title":"activity_main.xml <span style='color:#111;'> 1.31KB </span>","children":null,"spread":false}],"spread":false},{"title":"drawable-v24","children":[{"title":"ic_launcher_foreground.xml <span style='color:#111;'> 1.84KB </span>","children":null,"spread":false}],"spread":false},{"title":"values","children":[{"title":"colors.xml <span style='color:#111;'> 208B </span>","children":null,"spread":false},{"title":"strings.xml <span style='color:#111;'> 71B </span>","children":null,"spread":false},{"title":"styles.xml <span style='color:#111;'> 383B </span>","children":null,"spread":false}],"spread":false},{"title":"mipmap-xxhdpi","children":[{"title":"ic_launcher.png <span style='color:#111;'> 6.31KB </span>","children":null,"spread":false},{"title":"ic_launcher_round.png <span style='color:#111;'> 10.43KB </span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"java","children":[{"title":"com","children":[{"title":"nzh","children":[{"title":"ast","children":[{"title":"demo","children":[{"title":"TestLog.java <span style='color:#111;'> 342B </span>","children":null,"spread":false},{"title":"MainActivity.java <span style='color:#111;'> 3.67KB </span>","children":null,"spread":false},{"title":"java_8_stream","children":[{"title":"StreamDemo.java <span style='color:#111;'> 12.96KB </span>","children":null,"spread":false},{"title":"FunctionalInterfaceDemo.java <span style='color:#111;'> 4.11KB </span>","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":false}],"spread":true},{"title":".gitignore <span style='color:#111;'> 7B </span>","children":null,"spread":false},{"title":"build.gradle <span style='color:#111;'> 1.11KB </span>","children":null,"spread":false},{"title":"proguard-rules.pro <span style='color:#111;'> 751B </span>","children":null,"spread":false}],"spread":true},{"title":"build.gradle <span style='color:#111;'> 568B </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明