Changeset 7103 in josm for trunk/src


Ignore:
Timestamp:
2014-05-11T01:32:10+02:00 (6 years ago)
Author:
Don-vip
Message:

fix potential exception in ExpressionFactory initialization (not sure if this is the root cause of tests failing since r7099 with a NoClassDefFoundError)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    r7099 r7103  
    4545    static @interface NullableArguments {}
    4646
    47     private static final List<Method> arrayFunctions;
    48     private static final List<Method> parameterFunctions;
    49     private static final List<Method> parameterFunctionsEnv;
     47    private static final List<Method> arrayFunctions = new ArrayList<>();
     48    private static final List<Method> parameterFunctions = new ArrayList<>();
     49    private static final List<Method> parameterFunctionsEnv = new ArrayList<>();
    5050
    5151    static {
    52         arrayFunctions = new ArrayList<>();
    53         parameterFunctions = new ArrayList<>();
    54         parameterFunctionsEnv = new ArrayList<>();
    5552        for (Method m : Functions.class.getDeclaredMethods()) {
    5653            Class<?>[] paramTypes = m.getParameterTypes();
    5754            if (paramTypes.length == 1 && paramTypes[0].isArray()) {
    5855                arrayFunctions.add(m);
     56            } else if (paramTypes.length >= 1 && paramTypes[0].equals(Environment.class)) {
     57                parameterFunctionsEnv.add(m);
    5958            } else {
    60                 if (paramTypes[0].equals(Environment.class)) {
    61                     parameterFunctionsEnv.add(m);
    62                 } else {
    63                     parameterFunctions.add(m);
    64                 }
     59                parameterFunctions.add(m);
    6560            }
    6661        }
     
    9893    /**
    9994     * List of functions that can be used in MapCSS expressions.
    100      * 
     95     *
    10196     * First parameter can be of type {@link Environment} (if needed). This is
    10297     * automatically filled in by JOSM and the user only sees the remaining
     
    280275            return Utils.color_int2float(c.getAlpha());
    281276        }
    282        
     277
    283278        /**
    284279         * Assembles the strings to one.
     
    736731        }
    737732    }
    738    
     733
    739734    /**
    740735     * Function that takes a certain number of argument with specific type.
     
    762757        public Object evaluate(Environment env) {
    763758            Object[] convertedArgs;
    764            
     759
    765760            if (needsEnvironment) {
    766761                convertedArgs = new Object[args.size()+1];
Note: See TracChangeset for help on using the changeset viewer.