mirror of
https://github.com/alibaba/arthas.git
synced 2026-11-30 15:33:59 +00:00
fix jad command do not match inner class. close #301
This commit is contained in:
1 parent
755c527d3b
commit
775b342ab3
1 file changed
+10
-5
@@ -93,8 +93,12 @@ public class JadCommand extends AnnotatedCommand {
|
|||||||
processNoMatch(process);
|
processNoMatch(process);
|
||||||
} else if (matchedClasses.size() > 1) {
|
} else if (matchedClasses.size() > 1) {
|
||||||
processMatches(process, matchedClasses);
|
processMatches(process, matchedClasses);
|
||||||
} else {
|
} else { // matchedClasses size is 1
|
||||||
Set<Class<?>> withInnerClasses = SearchUtils.searchClassOnly(inst, classPattern + "(?!.*\\$\\$Lambda\\$).*", true, code);
|
// find inner classes. TODO slow
|
||||||
|
Set<Class<?>> withInnerClasses = SearchUtils.searchClassOnly(inst, matchedClasses.iterator().next().getName() + "(?!.*\\$\\$Lambda\\$).*", true, code);
|
||||||
|
if(withInnerClasses.isEmpty()) {
|
||||||
|
withInnerClasses = matchedClasses;
|
||||||
|
}
|
||||||
processExactMatch(process, affect, inst, matchedClasses, withInnerClasses);
|
processExactMatch(process, affect, inst, matchedClasses, withInnerClasses);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@@ -105,11 +109,12 @@ public class JadCommand extends AnnotatedCommand {
|
|||||||
|
|
||||||
private void processExactMatch(CommandProcess process, RowAffect affect, Instrumentation inst, Set<Class<?>> matchedClasses, Set<Class<?>> withInnerClasses) {
|
private void processExactMatch(CommandProcess process, RowAffect affect, Instrumentation inst, Set<Class<?>> matchedClasses, Set<Class<?>> withInnerClasses) {
|
||||||
Class<?> c = matchedClasses.iterator().next();
|
Class<?> c = matchedClasses.iterator().next();
|
||||||
matchedClasses = withInnerClasses;
|
Set<Class<?>> allClasses = new HashSet<Class<?>>(withInnerClasses);
|
||||||
|
allClasses.add(c);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ClassDumpTransformer transformer = new ClassDumpTransformer(matchedClasses);
|
ClassDumpTransformer transformer = new ClassDumpTransformer(allClasses);
|
||||||
Enhancer.enhance(inst, transformer, matchedClasses);
|
Enhancer.enhance(inst, transformer, allClasses);
|
||||||
Map<Class<?>, File> classFiles = transformer.getDumpResult();
|
Map<Class<?>, File> classFiles = transformer.getDumpResult();
|
||||||
File classFile = classFiles.get(c);
|
File classFile = classFiles.get(c);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user