Changeset 17792 in josm for trunk


Ignore:
Timestamp:
2021-04-19T19:03:29+02:00 (3 years ago)
Author:
simon04
Message:

see #20744 - MapCSSTagCheckerAsserts: remove unused code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerAsserts.java

    r17758 r17792  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import java.lang.reflect.Method;
    54import java.text.MessageFormat;
    65import java.util.ArrayList;
     
    2221import org.openstreetmap.josm.data.osm.Way;
    2322import org.openstreetmap.josm.data.validation.TestError;
    24 import org.openstreetmap.josm.gui.mappaint.Environment;
    2523import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory;
    2624import org.openstreetmap.josm.gui.mappaint.mapcss.ExpressionFactory;
    27 import org.openstreetmap.josm.gui.mappaint.mapcss.Functions;
    2825import org.openstreetmap.josm.gui.mappaint.mapcss.LiteralExpression;
    2926import org.openstreetmap.josm.gui.mappaint.mapcss.Selector;
     
    5350    static void checkAsserts(final MapCSSTagCheckerRule check, final Map<String, Boolean> assertions,
    5451                             final MapCSSTagChecker.AssertionConsumer assertionConsumer) {
    55         final Method insideMethod = getFunctionMethod("inside");
    5652        final DataSet ds = new DataSet();
    5753        Logging.debug("Check: {0}", check);
    5854        for (final Map.Entry<String, Boolean> i : assertions.entrySet()) {
    5955            Logging.debug("- Assertion: {0}", i);
    60             final OsmPrimitive p = OsmUtils.createPrimitive(i.getKey(), getLocation(check, insideMethod), true);
     56            final OsmPrimitive p = OsmUtils.createPrimitive(i.getKey(), getLocation(check), true);
    6157            // Build minimal ordered list of checks to run to test the assertion
    6258            List<Set<MapCSSTagCheckerRule>> checksToRun = new ArrayList<>();
     
    9490    }
    9591
    96     private static Method getFunctionMethod(String method) {
    97         try {
    98             return Functions.class.getDeclaredMethod(method, Environment.class, String.class);
    99         } catch (NoSuchMethodException | SecurityException e) {
    100             Logging.error(e);
    101             return null;
    102         }
    103     }
    104 
    10592    private static void addPrimitive(DataSet ds, OsmPrimitive p) {
    10693        if (p instanceof Way) {
     
    11299    }
    113100
    114     private static LatLon getLocation(MapCSSTagCheckerRule check, Method insideMethod) {
    115         Optional<String> inside = getFirstInsideCountry(check, insideMethod);
     101    private static LatLon getLocation(MapCSSTagCheckerRule check) {
     102        Optional<String> inside = getFirstInsideCountry(check);
    116103        if (inside.isPresent()) {
    117104            GeoPropertyIndex<Boolean> index = Territories.getGeoPropertyIndex(inside.get());
     
    126113    }
    127114
    128     private static Optional<String> getFirstInsideCountry(MapCSSTagCheckerRule check, Method insideMethod) {
     115    private static Optional<String> getFirstInsideCountry(MapCSSTagCheckerRule check) {
    129116        return check.rule.selectors.stream()
    130117                .filter(s -> s instanceof Selector.GeneralSelector)
Note: See TracChangeset for help on using the changeset viewer.