// Path: analysis/src/main/java/uk/ac/cam/gpe21/droidssl/analysis/VulnerabilityState.java
// public enum VulnerabilityState {
// 	VULNERABLE,
// 	SAFE,
// 	UNKNOWN
// }
// 
// Path: analysis/src/main/java/uk/ac/cam/gpe21/droidssl/analysis/tag/VulnerabilityTag.java
// public abstract class VulnerabilityTag implements Tag {
// 	private final String name;
// 	private final VulnerabilityState state;
// 
// 	public VulnerabilityTag(String name, VulnerabilityState state) {
// 		this.name = name;
// 		this.state = state;
// 	}
// 
// 	@Override
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public VulnerabilityState getState() {
// 		return state;
// 	}
// 
// 	@Override
// 	public byte[] getValue() {
// 		return new byte[] {
// 			(byte) state.ordinal()
// 		};
// 	}
// }


import soot.*;
import uk.ac.cam.gpe21.droidssl.analysis.VulnerabilityState;
import uk.ac.cam.gpe21.droidssl.analysis.tag.VulnerabilityTag;
/*
 * Copyright 2013-2014 Graham Edgecombe
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package uk.ac.cam.gpe21.droidssl.analysis.util;


public final class PointsToUtils {
	public static boolean anyTypeVulnerable(PointsToSet set, final String tagName) {
		final boolean[] box = new boolean[1]; // TODO this is hacky

		for (Type type : set.possibleTypes()) {
			type.apply(new TypeSwitch() {
				@Override
				public void caseRefType(RefType type) {
					VulnerabilityTag tag = (VulnerabilityTag) type.getSootClass().getTag(tagName);
// Path: analysis/src/main/java/uk/ac/cam/gpe21/droidssl/analysis/VulnerabilityState.java
// public enum VulnerabilityState {
// 	VULNERABLE,
// 	SAFE,
// 	UNKNOWN
// }
// 
// Path: analysis/src/main/java/uk/ac/cam/gpe21/droidssl/analysis/tag/VulnerabilityTag.java
// public abstract class VulnerabilityTag implements Tag {
// 	private final String name;
// 	private final VulnerabilityState state;
// 
// 	public VulnerabilityTag(String name, VulnerabilityState state) {
// 		this.name = name;
// 		this.state = state;
// 	}
// 
// 	@Override
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public VulnerabilityState getState() {
// 		return state;
// 	}
// 
// 	@Override
// 	public byte[] getValue() {
// 		return new byte[] {
// 			(byte) state.ordinal()
// 		};
// 	}
// }


// Path: analysis/src/main/java/uk/ac/cam/gpe21/droidssl/analysis/util/PointsToUtils.java
import soot.*;
import uk.ac.cam.gpe21.droidssl.analysis.VulnerabilityState;
import uk.ac.cam.gpe21.droidssl.analysis.tag.VulnerabilityTag;

/*
 * Copyright 2013-2014 Graham Edgecombe
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package uk.ac.cam.gpe21.droidssl.analysis.util;


public final class PointsToUtils {
	public static boolean anyTypeVulnerable(PointsToSet set, final String tagName) {
		final boolean[] box = new boolean[1]; // TODO this is hacky

		for (Type type : set.possibleTypes()) {
			type.apply(new TypeSwitch() {
				@Override
				public void caseRefType(RefType type) {
					VulnerabilityTag tag = (VulnerabilityTag) type.getSootClass().getTag(tagName);
					if (tag != null && tag.getState() == VulnerabilityState.VULNERABLE)