Search in sources :

Example 51 with EntryMessage

use of org.apache.logging.log4j.message.EntryMessage in project meghanada-server by mopemope.

the class LocationSearcher method searchFieldAccess.

private Optional<Location> searchFieldAccess(final Source src, final int line, final int col, final String symbol) {
    final EntryMessage entryMessage = log.traceEntry("line={} col={} symbol={}", line, col, symbol);
    final Optional<Location> result = src.searchFieldAccess(line, col, symbol).flatMap(fa -> {
        final String fieldName = fa.name;
        final String declaringClass = fa.declaringClass;
        if (declaringClass == null) {
            return Optional.empty();
        }
        final List<String> searchTargets = new ArrayList<>(2);
        searchTargets.add(declaringClass);
        final CachedASMReflector reflector = CachedASMReflector.getInstance();
        searchTargets.addAll(reflector.getSuperClass(declaringClass));
        return searchTargets.stream().map(fqcn -> existsFQCN(project.getAllSourcesWithDependencies(), fqcn).flatMap(file -> getFieldLocationFromProject(fqcn, fieldName, file)).orElseGet(wrapIO(() -> {
            final SearchContext context = new SearchContext(fqcn, SearchKind.FIELD);
            context.name = fieldName;
            return Optional.ofNullable(searchFromSrcZip(context)).orElseGet(wrapIO(() -> searchFromDependency(context)));
        }))).filter(Objects::nonNull).findFirst();
    });
    log.traceExit(entryMessage);
    return result;
}
Also used : CachedASMReflector(meghanada.reflect.asm.CachedASMReflector) ArrayList(java.util.ArrayList) EntryMessage(org.apache.logging.log4j.message.EntryMessage)

Example 52 with EntryMessage

use of org.apache.logging.log4j.message.EntryMessage in project meghanada-server by mopemope.

the class ExpressionScope method dumpVariable.

@Override
public void dumpVariable() {
    EntryMessage em = log.traceEntry("**** {} {}", this.getClassName(), this.range);
    super.dumpVariable(log);
    log.traceExit(em);
}
Also used : EntryMessage(org.apache.logging.log4j.message.EntryMessage)

Example 53 with EntryMessage

use of org.apache.logging.log4j.message.EntryMessage in project meghanada-server by mopemope.

the class ExpressionScope method dump.

@Override
public void dump() {
    EntryMessage em = log.traceEntry("**** {} {}", this.getClassName(), this.range);
    super.dumpVariable(log);
    super.dumpFieldAccess(log);
    log.traceExit(em);
}
Also used : EntryMessage(org.apache.logging.log4j.message.EntryMessage)

Example 54 with EntryMessage

use of org.apache.logging.log4j.message.EntryMessage in project meghanada-server by mopemope.

the class Source method dumpVariable.

public void dumpVariable() {
    final EntryMessage entryMessage = log.traceEntry("{}", Strings.repeat("*", 100));
    for (final ClassScope cs : classScopes) {
        cs.dumpVariable();
    }
    log.traceExit(entryMessage);
}
Also used : EntryMessage(org.apache.logging.log4j.message.EntryMessage)

Example 55 with EntryMessage

use of org.apache.logging.log4j.message.EntryMessage in project meghanada-server by mopemope.

the class Source method dumpFieldAccess.

public void dumpFieldAccess() {
    final EntryMessage entryMessage = log.traceEntry("{}", Strings.repeat("*", 100));
    for (final ClassScope cs : classScopes) {
        cs.dumpFieldAccess();
    }
    log.traceExit(entryMessage);
}
Also used : EntryMessage(org.apache.logging.log4j.message.EntryMessage)

Aggregations

EntryMessage (org.apache.logging.log4j.message.EntryMessage)64 ArrayList (java.util.ArrayList)9 CachedASMReflector (meghanada.reflect.asm.CachedASMReflector)8 Test (org.junit.jupiter.api.Test)8 ClassScope (meghanada.analyze.ClassScope)5 MethodCall (meghanada.analyze.MethodCall)5 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Map (java.util.Map)3 Set (java.util.Set)3 ExecutionException (java.util.concurrent.ExecutionException)3 Variable (meghanada.analyze.Variable)3 Project (meghanada.project.Project)3 ClassIndex (meghanada.reflect.ClassIndex)3 ClassNameUtils (meghanada.utils.ClassNameUtils)3 LogManager (org.apache.logging.log4j.LogManager)3 Logger (org.apache.logging.log4j.Logger)3 SignatureReader (org.objectweb.asm.signature.SignatureReader)3