feat(gui): disk code cache and search rewrite (PR #1483)
* feat: implement disk code cache * feat: rewrite code metadata handling, remove code index * feat: rewrite search * fix: code cleanup and fixes for previous commits * feat: run code search in parallel * fix: reset code strings cache on low memory, code cleanup * fix: include input files timestamp into code hash
This commit is contained in:
@@ -29,15 +29,16 @@ public final class JadxTokenMaker extends JavaTokenMaker {
|
||||
|
||||
@Override
|
||||
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
||||
Token tokens = super.getTokenList(text, initialTokenType, startOffset);
|
||||
if (tokens.getType() != TokenTypes.NULL) {
|
||||
try {
|
||||
try {
|
||||
Token tokens = super.getTokenList(text, initialTokenType, startOffset);
|
||||
if (tokens.getType() != TokenTypes.NULL) {
|
||||
processTokens(tokens);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Process tokens failed for text: {}", text, e);
|
||||
}
|
||||
return tokens;
|
||||
} catch (Throwable e) { // JavaTokenMaker throws 'java.lang.Error' if failed to parse input string
|
||||
LOG.error("Process tokens failed for text: {}", text, e);
|
||||
return new TokenImpl();
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
private void processTokens(Token tokens) {
|
||||
@@ -81,14 +82,14 @@ public final class JadxTokenMaker extends JavaTokenMaker {
|
||||
if (annotation) {
|
||||
offset++;
|
||||
}
|
||||
JavaNode javaNode = codeArea.getJavaNodeAtOffset(offset);
|
||||
if (javaNode instanceof JavaClass) {
|
||||
String name = javaNode.getName();
|
||||
JavaClass javaCls = codeArea.getJavaClassIfAtPos(offset);
|
||||
if (javaCls != null) {
|
||||
String name = javaCls.getName();
|
||||
String lexeme = current.getLexeme();
|
||||
if (annotation && lexeme.length() > 1) {
|
||||
lexeme = lexeme.substring(1);
|
||||
}
|
||||
if (!lexeme.equals(name) && isClassNameStart(javaNode, lexeme)) {
|
||||
if (!lexeme.equals(name) && isClassNameStart(javaCls, lexeme)) {
|
||||
// try to replace long class name with one token
|
||||
Token replace = concatTokensUntil(current, name);
|
||||
if (replace != null && prev instanceof TokenImpl) {
|
||||
|
||||
Reference in New Issue
Block a user