- Timestamp:
- 2026-07-23T18:26:32+02:00 (37 hours ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
-
gui/autofilter/AutoFilterRule.java (modified) (4 diffs)
-
gui/tagging/presets/items/ComboMultiSelect.java (modified) (2 diffs)
-
tools/ReflectionUtils.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterRule.java
r19592 r19597 83 83 /** 84 84 * Returns true if there should be a filter button for OSM primitives which have no value for the key. 85 * @since xxx85 * @since 19592 86 86 */ 87 87 public boolean getNoValueFilter() { … … 93 93 * @param value the numeric value to format 94 94 * @return the formatted value 95 * @since xxx95 * @since 19592 96 96 */ 97 97 public String formatValue(Integer value) { … … 147 147 * @return {@code this} 148 148 * @throws NullPointerException if {@code extraKeys} is null 149 * @since xxx149 * @since 19592 150 150 */ 151 151 public AutoFilterRule setExtraKeys(List<String> extraKeys) { … … 161 161 * @param directValuesOnly whether "inner" values from ranges (such as 6 and 7 for 5-8) should be omitted 162 162 * @return a stream of numeric values 163 * @since xxx163 * @since 19592 164 164 */ 165 165 public IntStream getTagValuesForPrimitive(OsmPrimitive osm, boolean directValuesOnly) { -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r19519 r19597 31 31 import org.openstreetmap.josm.tools.GBC; 32 32 import org.openstreetmap.josm.tools.Logging; 33 import org.openstreetmap.josm.tools.ReflectionUtils; 33 34 34 35 /** … … 232 233 if (classMethod.length == 2) { 233 234 try { 234 Method method = Class.forName(classMethod[0]).getMethod(classMethod[1]); 235 Class<?> cl = ReflectionUtils.findClass(classMethod[0]); 236 if (cl == null) { 237 Logging.error(tr("Broken tagging preset \"{0}-{1}\" - Java class {2} given in ''values_from'' was not found", 238 key, text, classMethod[0])); 239 return null; 240 } 241 Method method = cl.getMethod(classMethod[1]); 235 242 // Check method is public static String[] methodName() 236 243 int mod = method.getModifiers(); 237 244 if (Modifier.isPublic(mod) && Modifier.isStatic(mod) 238 && method.getReturnType().equals(String[].class) && method.getParameterTypes().length == 0) { 239 return Arrays.asList((String[]) method.invoke(null)); 240 } else { 241 Logging.error(tr("Broken tagging preset \"{0}-{1}\" - Java method given in ''values_from'' is not \"{2}\"", key, text, 242 "public static String[] methodName()")); 245 && method.getReturnType().equals(String[].class)) { 246 if (method.getParameterTypes().length == 0) { 247 return Arrays.asList((String[]) method.invoke(null)); 248 } else if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(String.class)) { 249 return Arrays.asList((String[]) method.invoke(key)); 250 } else if (method.getParameterTypes().length == 2 251 && method.getParameterTypes()[0].equals(String.class) 252 && method.getParameterTypes()[1].equals(String.class)) { 253 return Arrays.asList((String[]) method.invoke(key, originalValue)); 254 } else { 255 Logging.error(tr("Broken tagging preset \"{0}-{1}\" - Java method given in ''values_from'' is not \"{2}\"", key, text, 256 "public static String[] methodName()")); 257 } 243 258 } 244 259 } catch (ReflectiveOperationException e) { -
trunk/src/org/openstreetmap/josm/tools/ReflectionUtils.java
r18871 r19597 61 61 } 62 62 63 /** 64 * Find a class either in the default class loader or in plugins. 65 * @param name class name to search 66 * @return found class object, or null if it was not found 67 * @since 19597 68 */ 69 public static Class<?> findClass(String name) { 70 try { 71 return Class.forName(name); 72 } catch (ClassNotFoundException e) { 73 Logging.trace(e); 74 for (ClassLoader cl : PluginHandler.getPluginClassLoaders()) { 75 try { 76 return Class.forName(name, true, cl); 77 } catch (ClassNotFoundException ex) { 78 Logging.trace(e); 79 } 80 } 81 return null; 82 } 83 } 84 63 85 private static <T> T findCaller(Function<StackTraceElement, T> getter, Collection<T> exclusions) { 64 86 StackTraceElement[] stack = Thread.currentThread().getStackTrace();
Note:
See TracChangeset
for help on using the changeset viewer.
