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

pmd / pmd / 4553

25 Apr 2025 06:55AM UTC coverage: 77.84% (+0.008%) from 77.832%
4553

push

github

adangel
[core] Support language dialects (#5438)

Merge pull request #5438 from Monits:lang-dialects

17661 of 23654 branches covered (74.66%)

Branch coverage included in aggregate %.

113 of 137 new or added lines in 12 files covered. (82.48%)

20 existing lines in 5 files now uncovered.

38710 of 48765 relevant lines covered (79.38%)

0.8 hits per line

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

85.71
/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/xpath/impl/XPathHandler.java
1
/*
2
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3
 */
4

5
package net.sourceforge.pmd.lang.rule.xpath.impl;
6

7
import java.util.Collections;
8
import java.util.HashSet;
9
import java.util.Set;
10

11
import net.sourceforge.pmd.lang.rule.xpath.internal.DefaultXPathFunctions;
12
import net.sourceforge.pmd.util.CollectionUtil;
13

14

15
/**
16
 * Interface for performing Language specific XPath handling, such as
17
 * initialization and navigation.
18
 */
19
public interface XPathHandler {
20

21
    /**
22
     * Returns the set of extension functions for this language module.
23
     * These are the additional functions available in XPath queries.
24
     */
25
    Set<XPathFunctionDefinition> getRegisteredExtensionFunctions();
26

27

28
    static XPathHandler noFunctionDefinitions() {
UNCOV
29
        return DefaultXPathFunctions::getDefaultFunctions;
×
30
    }
31

32
    /**
33
     * Returns a default XPath handler.
34
     */
35
    static XPathHandler getHandlerForFunctionDefs(XPathFunctionDefinition first, XPathFunctionDefinition... defs) {
36
        Set<XPathFunctionDefinition> set = new HashSet<>(CollectionUtil.setOf(first, defs));
1✔
37
        set.addAll(DefaultXPathFunctions.getDefaultFunctions());
1✔
38

39
        return () -> Collections.unmodifiableSet(set);
1✔
40
    }
41

42
    /**
43
     * Return a new XPath handler combining all available functions from this and another handler.
44
     * @param other The handler whose functions to merge with this one.
45
     * @return A new handler exposing all functions from both XPath handlers.
46
     * @since 7.13.0
47
     */
48
    default XPathHandler combine(XPathHandler other) {
49
        Set<XPathFunctionDefinition> set = new HashSet<>(getRegisteredExtensionFunctions());
1✔
50
        set.addAll(other.getRegisteredExtensionFunctions());
1✔
51

52
        return () -> Collections.unmodifiableSet(set);
1✔
53
    }
54
}
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

© 2026 Coveralls, Inc