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.vm.serialize;
21 import gov.nasa.jpf.Config;
22 import gov.nasa.jpf.annotation.FilterField;
23 import gov.nasa.jpf.annotation.FilterFrame;
24 import gov.nasa.jpf.vm.AnnotationInfo;
25 import gov.nasa.jpf.vm.FieldInfo;
26 import gov.nasa.jpf.vm.ClassInfo;
27 import gov.nasa.jpf.vm.MethodInfo;
28 import gov.nasa.jpf.vm.serialize.AmmendableFilterConfiguration.FieldAmmendment;
29 import gov.nasa.jpf.vm.serialize.AmmendableFilterConfiguration.FrameAmmendment;
31 public class SmartThingsConfig
32 implements FieldAmmendment, FrameAmmendment {
34 public boolean staticClass(ClassInfo ci) {
35 String pName = ci.getName();
36 if (pName.startsWith("java."))
39 if (pName.startsWith("sun."))
42 if (pName.startsWith("com.sun"))
45 if (pName.startsWith("org."))
48 if (pName.startsWith("groovy."))
51 if (pName.startsWith("groovyjarjarasm."))
54 if (pName.startsWith("gov."))
57 if (pName.startsWith("["))
62 public boolean ignoreClass(ClassInfo ci) {
63 String pName = ci.getName();
64 if (pName.startsWith("org")) {
65 if (pName.startsWith("org.codehaus.groovy")) {
66 // System.out.println("Ignoring "+pName);
69 if (pName.startsWith("org.apache.groovy")) {
70 // System.out.println("Ignoring "+pName);
73 } else if (pName.startsWith("java")) {
74 if (pName.startsWith("java.lang")) {
75 if (pName.startsWith("java.lang.reflect")) {
78 if (pName.startsWith("java.lang.ref")) {
81 if (pName.startsWith("java.lang.ClassLoader")) {
84 if (pName.startsWith("java.lang.Class"))
86 if (pName.startsWith("java.lang.Thread"))
88 if (pName.startsWith("java.lang.Package"))
91 if (pName.startsWith("java.util.concurrent")) {
92 // System.out.println("Ignoring "+pName);
95 if (pName.startsWith("java.util.logging")) {
96 // System.out.println("Ignoring "+pName);
99 if (pName.startsWith("java.beans")) {
102 if (pName.startsWith("java.io.OutputStreamWriter"))
104 if (pName.startsWith("java.io.PrintStream"))
106 if (pName.startsWith("java.io.BufferedWriter"))
109 if (pName.startsWith("java.nio.charset"))
112 } else if (pName.startsWith("groovy")) {
113 if (pName.startsWith("groovy.lang")) {
114 // System.out.println("Ignoring "+pName);
117 if (pName.startsWith("groovyjarjarasm.asm")) {
118 // System.out.println("Ignoring "+pName);
122 if (pName.startsWith("com.sun.beans")) {
125 if (pName.startsWith("sun.reflect")) {
128 if (pName.startsWith("sun.misc.SharedSecrets"))
130 if (pName.startsWith("sun.util.logging"))
132 if (pName.startsWith("sun.net.www"))
134 if (pName.startsWith("gov.nasa"))
140 public boolean ammendFieldInclusion(FieldInfo fi, boolean sofar) {
141 ClassInfo ci = fi.getClassInfo();
143 return POLICY_IGNORE;
144 ClassInfo civ = fi.getTypeClassInfo();
145 if (ignoreClass(civ))
146 return POLICY_IGNORE;
151 public FramePolicy ammendFramePolicy(MethodInfo mi, FramePolicy sofar) {
152 ClassInfo ci = mi.getClassInfo();
153 if (ignoreClass(ci)) {
154 sofar.includeLocals = false;
155 sofar.includeOps = false;
156 sofar.includePC = false;
158 // System.out.println("Including M: " +mi);
164 public static final SmartThingsConfig instance = new SmartThingsConfig();