Commit 324661e7 authored by Andreas Sewe's avatar Andreas Sewe
Browse files

Using java.util.Deques instead of the deprecated j.u.Stack. (No performance impact.)

parent e9b127b9
package ch.usi.dag.disl.example.fieldsImmutabilityAnalysis;
import java.util.Stack;
import java.util.ArrayDeque;
import java.util.Deque;
import ch.usi.dag.disl.annotation.After;
import ch.usi.dag.disl.annotation.AfterReturning;
......@@ -18,13 +19,13 @@ import ch.usi.dag.disl.staticcontext.MethodSC;
public class DiSLClass {
@ThreadLocal
private static Stack<Object> stackTL;
private static Deque<Object> stackTL;
/** STACK MAINTENANCE **/
@Before(marker = BodyMarker.class, scope = "*.*", guard = OnlyInit.class, order = 1)
public static void before(DynamicContext dc, MethodSC sc) {
if(stackTL == null) {
stackTL = new Stack<Object>();
stackTL = new ArrayDeque<Object>();
}
Object alloc = dc.thisValue();
stackTL.push(alloc);
......
......@@ -4,7 +4,7 @@ import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.util.Iterator;
import java.util.Stack;
import java.util.Deque;
import ch.usi.dag.jborat.runtime.DynamicBypass;
......@@ -77,7 +77,7 @@ public class ImmutabilityAnalysis {
}
public static void onFieldWrite(Object accessedObj, String accessedFieldName, Stack<Object> stack) {
public static void onFieldWrite(Object accessedObj, String accessedFieldName, Deque<Object> stack) {
try{
boolean isInDynamicExtendOfConstructor = false;
if(stack != null) {
......@@ -121,7 +121,7 @@ public class ImmutabilityAnalysis {
public static boolean isIncluded(Stack<Object> stack, Object accessedObject) {
public static boolean isIncluded(Deque<Object> stack, Object accessedObject) {
for(Iterator<Object> iter = stack.iterator(); iter.hasNext();) {
if(iter.next() == accessedObject) {
return true;
......@@ -144,7 +144,7 @@ public class ImmutabilityAnalysis {
}
}
public static void popStackIfNonNull(Stack<Object> stackTL) {
public static void popStackIfNonNull(Deque<Object> stackTL) {
if(stackTL != null) {
stackTL.pop();
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment