Search in sources :

Example 26 with MemberDescriptor

use of meghanada.reflect.MemberDescriptor in project meghanada-server by mopemope.

the class MemberCacheLoader method storeMembers.

private void storeMembers(final String fqcn, final List<MemberDescriptor> list) {
    final CachedASMReflector reflector = CachedASMReflector.getInstance();
    reflector.containsClassIndex(fqcn).map(wrapIO(index -> ProjectDatabaseHelper.saveMemberDescriptors(index.getRawDeclaration(), list))).orElseGet(() -> {
        final String innerFQCN = ClassNameUtils.replaceInnerMark(fqcn);
        reflector.containsClassIndex(innerFQCN).ifPresent(wrapIOConsumer(index -> ProjectDatabaseHelper.saveMemberDescriptors(index.getRawDeclaration(), list)));
        return true;
    });
}
Also used : ClassName(meghanada.utils.ClassName) Stopwatch(com.google.common.base.Stopwatch) FunctionUtils.wrapIOConsumer(meghanada.utils.FunctionUtils.wrapIOConsumer) InheritanceInfo(meghanada.reflect.asm.InheritanceInfo) Map(java.util.Map) CandidateUnit(meghanada.reflect.CandidateUnit) Objects.isNull(java.util.Objects.isNull) FunctionUtils.wrapIO(meghanada.utils.FunctionUtils.wrapIO) RemovalNotification(com.google.common.cache.RemovalNotification) ClassIndex(meghanada.reflect.ClassIndex) IOException(java.io.IOException) ProjectDatabaseHelper(meghanada.store.ProjectDatabaseHelper) CachedASMReflector(meghanada.reflect.asm.CachedASMReflector) Collectors(java.util.stream.Collectors) File(java.io.File) CacheLoader(com.google.common.cache.CacheLoader) MemberDescriptor(meghanada.reflect.MemberDescriptor) List(java.util.List) Logger(org.apache.logging.log4j.Logger) RemovalCause(com.google.common.cache.RemovalCause) ClassNameUtils(meghanada.utils.ClassNameUtils) Optional(java.util.Optional) RemovalListener(com.google.common.cache.RemovalListener) ASMReflector(meghanada.reflect.asm.ASMReflector) Objects.nonNull(java.util.Objects.nonNull) Collections(java.util.Collections) Config(meghanada.config.Config) LogManager(org.apache.logging.log4j.LogManager) CachedASMReflector(meghanada.reflect.asm.CachedASMReflector)

Aggregations

MemberDescriptor (meghanada.reflect.MemberDescriptor)26 File (java.io.File)17 Map (java.util.Map)17 ClassIndex (meghanada.reflect.ClassIndex)16 Stopwatch (com.google.common.base.Stopwatch)15 List (java.util.List)15 Config (meghanada.config.Config)15 MethodDescriptor (meghanada.reflect.MethodDescriptor)13 Test (org.junit.Test)13 GradleTestBase (meghanada.GradleTestBase)12 Config.debugIt (meghanada.config.Config.debugIt)12 Config.timeIt (meghanada.config.Config.timeIt)12 AfterClass (org.junit.AfterClass)12 Assert.assertEquals (org.junit.Assert.assertEquals)12 Assert.assertNotNull (org.junit.Assert.assertNotNull)12 BeforeClass (org.junit.BeforeClass)12 CandidateUnit (meghanada.reflect.CandidateUnit)6 CachedASMReflector (meghanada.reflect.asm.CachedASMReflector)5 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4