2 * Copyright (C) 2014, United States Government, as represented by the
3 * Administrator of the National Aeronautics and Space Administration.
6 * The Java Pathfinder core (jpf-core) platform is licensed under the
7 * Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0.
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 package gov.nasa.jpf.tool;
21 import java.lang.reflect.InvocationTargetException;
22 import java.lang.reflect.Method;
23 import java.lang.reflect.Modifier;
26 * common base for Run* classes
30 protected static void error (String msg){
31 System.err.print("error: ");
32 System.err.println(msg);
36 protected static void warning (String msg){
37 System.err.print("warning: ");
38 System.err.println(msg);
41 // filter out leading '+' arguments (Config initialization)
42 protected static String[] removeConfigArgs(String[]args){
44 for (i=0; i<args.length; i++){
46 if (a != null && a.length() > 0 && a.charAt(0) != '+'){
51 String[] newArgs = new String[args.length - i];
52 System.arraycopy(args,i,newArgs,0,newArgs.length);
57 protected static String checkClassName (String cls){
58 if (cls == null || cls.isEmpty()){
62 if (cls.charAt(0) == '.'){
63 cls = "gov.nasa.jpf" + cls;
69 protected static boolean call( Class<?> cls, String mthName, Object[] args) throws InvocationTargetException {
71 Class<?>[] argTypes = new Class<?>[args.length];
72 for (int i=0; i<args.length; i++){
73 argTypes[i] = args[i].getClass();
76 Method m = cls.getMethod(mthName, argTypes);
78 int modifiers = m.getModifiers();
79 if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)){
84 } catch (NoSuchMethodException nsmx){
86 } catch (IllegalAccessException iax){