feelschaotic / aopautotrycatch Goto Github PK
View Code? Open in Web Editor NEWUse Javassist, a custom Gradle plug-in to implement automatic try-catch. AOP**取代防范性try-catch
Use Javassist, a custom Gradle plug-in to implement automatic try-catch. AOP**取代防范性try-catch
TryCatchInject.injectDir(it.file.absolutePath, "com\feelschaotic\javassist")
这个 com\feelschaotic\javassist 是你的 MainActivity 所在的包名吗,我传入我的包名,结果在 TryCatchInject#traverseFile 方法的判断条件中就 return 掉了,没往下执行。
这方法中有一句
int index = filePath.indexOf(packageName.replace(".", File.separator))
packageName 在外面传进来的时候格式是 com\feelschaotic\javassist
所以里面没有包含 “.” , 这里 replace 的结果跟没 replace 是一样的
而 filePath 是路径大概是这样的:
app/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/feelschaotic/javassist
所以 index 的结果永远都是 -1 。下面 isClassFilePath 的判断永远都为 false。
所以我觉得这样改就可以了:
int index = filePath.indexOf(packageName.replace("\\", "/"))
Cannot infer Groovy class path because no Groovy Jar was found on class path: configuration ':buildsrc:compileClasspath'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.