• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yahoo / elide / #7464

06 Dec 2025 12:01AM UTC coverage: 84.293% (-0.1%) from 84.409%
#7464

push

justin-tay
Update to Spring Boot 3.5.8 and align dependencies

0 of 51 new or added lines in 3 files covered. (0.0%)

3 existing lines in 2 files now uncovered.

19744 of 23423 relevant lines covered (84.29%)

0.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.33
/elide-core/src/main/java/com/yahoo/elide/core/utils/ClassScannerCache.java
1
/*
2
 * Copyright 2023, Yahoo Inc.
3
 * Licensed under the Apache License, Version 2.0
4
 * See LICENSE file in project root for terms.
5
 */
6
package com.yahoo.elide.core.utils;
7

8
import com.yahoo.elide.annotation.Include;
9
import com.yahoo.elide.annotation.SecurityCheck;
10
import com.yahoo.elide.core.utils.coerce.converters.ElideTypeConverter;
11

12
import io.github.classgraph.ClassGraph;
13
import io.github.classgraph.ClassInfo;
14
import io.github.classgraph.ScanResult;
15

16
import java.util.HashMap;
17
import java.util.LinkedHashSet;
18
import java.util.Map;
19
import java.util.Set;
20
import java.util.stream.Collectors;
21

22

23
/**
24
 * Caches a set of classes with certain annotations.
25
 *
26
 * For the native code path this will be initialized at build time.
27
 */
28
public class ClassScannerCache {
29
    private static final Map<String, Set<Class<?>>> INSTANCE;
30

31
    private static final String [] CACHE_ANNOTATIONS  = {
1✔
32
        //Elide Core Annotations
33
        Include.class.getCanonicalName(),
1✔
34
        SecurityCheck.class.getCanonicalName(),
1✔
35
        ElideTypeConverter.class.getCanonicalName(),
1✔
36

37
        //GraphQL annotations.  Strings here to avoid dependency.
38
        "com.yahoo.elide.graphql.subscriptions.annotations.Subscription",
39

40
        //Aggregation Store Annotations.  Strings here to avoid dependency.
41
        "com.yahoo.elide.datastores.aggregation.queryengines.sql.annotation.FromTable",
42
        "com.yahoo.elide.datastores.aggregation.queryengines.sql.annotation.FromSubquery",
43
        "org.hibernate.annotations.Subselect",
44

45
        //JPA
46
        "jakarta.persistence.Entity",
47
        "jakarta.persistence.Table"
48
    };
49

50
    static {
51
        Map<String, Set<Class<?>>> result = new HashMap<>();
1✔
52
        try (ScanResult scanResult = new ClassGraph().enableClassInfo().enableAnnotationInfo().scan()) {
1✔
53
            for (String annotationName : CACHE_ANNOTATIONS) {
1✔
54
                result.put(annotationName, scanResult.getClassesWithAnnotation(annotationName)
1✔
55
                        .stream()
1✔
56
                        .map(ClassInfo::loadClass)
1✔
57
                        .collect(Collectors.toCollection(LinkedHashSet::new)));
1✔
58
            }
59
        }
60
        INSTANCE = result;
1✔
61
    }
1✔
62

63
    private ClassScannerCache() {
64
    }
65

66
    public static Map<String, Set<Class<?>>> getInstance() {
67
        return INSTANCE;
1✔
68
    }
69

70
    public static String[] getCachedAnnotations() {
NEW
71
        return CACHE_ANNOTATIONS;
×
72
    }
73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc