import Analysis.Loops.LoopFinder;
import Analysis.Loops.Loops;
import IR.ClassDescriptor;
+import IR.Descriptor;
import IR.FieldDescriptor;
import IR.MethodDescriptor;
import IR.Operation;
import IR.State;
import IR.SymbolTable;
+import IR.VarDescriptor;
import IR.Flat.FKind;
import IR.Flat.FlatFieldNode;
import IR.Flat.FlatLiteralNode;
import IR.Flat.FlatMethod;
import IR.Flat.FlatNode;
import IR.Flat.FlatOpNode;
+import IR.Flat.FlatSetFieldNode;
import IR.Flat.TempDescriptor;
public class DefinitelyWrittenCheck {
static State state;
HashSet toanalyze;
- // maintains analysis results in the form of <tempDesc,<read statement,flag>>
- private Hashtable<FlatNode, Hashtable<TempDescriptor, Hashtable<FlatNode, Boolean>>> definitelyWrittenResults;
+ private Hashtable<FlatNode, Hashtable<Descriptor, Hashtable<FlatNode, Boolean>>> definitelyWrittenResults;
public DefinitelyWrittenCheck(State state) {
this.state = state;
this.toanalyze = new HashSet();
this.definitelyWrittenResults =
- new Hashtable<FlatNode, Hashtable<TempDescriptor, Hashtable<FlatNode, Boolean>>>();
+ new Hashtable<FlatNode, Hashtable<Descriptor, Hashtable<FlatNode, Boolean>>>();
}
public void definitelyWrittenCheck() {
Object obj = toanalyze.iterator().next();
ClassDescriptor cd = (ClassDescriptor) obj;
toanalyze.remove(cd);
+
if (cd.isClassLibrary()) {
// doesn't care about class libraries now
- continue;
+// continue;
}
for (Iterator method_it = cd.getMethods(); method_it.hasNext();) {
MethodDescriptor md = (MethodDescriptor) method_it.next();
FlatMethod fm = state.getMethodFlat(md);
-
- LoopFinder loopFinder = new LoopFinder(fm);
- Loops loops = loopFinder.getRootloop(fm);
- Set loopSet = loops.nestedLoops();
-
- for (Iterator iterator = loopSet.iterator(); iterator.hasNext();) {
- Loops rootLoops = (Loops) iterator.next();
- Set loopEntranceSet = rootLoops.loopEntrances();
- for (Iterator iterator2 = loopEntranceSet.iterator(); iterator2.hasNext();) {
- FlatNode loopEnter = (FlatNode) iterator2.next();
- definitelyWrittenForward(loopEnter);
+ if(fm!=null){
+ LoopFinder loopFinder = new LoopFinder(fm);
+ Loops loops = loopFinder.getRootloop(fm);
+ Set loopSet = loops.nestedLoops();
+
+ for (Iterator iterator = loopSet.iterator(); iterator.hasNext();) {
+ Loops rootLoops = (Loops) iterator.next();
+ Set loopEntranceSet = rootLoops.loopEntrances();
+ for (Iterator iterator2 = loopEntranceSet.iterator(); iterator2.hasNext();) {
+ FlatNode loopEnter = (FlatNode) iterator2.next();
+
+ String flatNodeLabel = (String) state.fn2labelMap.get(loopEnter);
+ if (flatNodeLabel != null && flatNodeLabel.equals("ssjava")) {
+ System.out.println("encounting ss loop:" + loopEnter);
+ definitelyWrittenForward(loopEnter);
+ }
+ }
}
}
+
}
}
lhs = fon.getDest();
rhs = fon.getLeft();
// read(rhs)
- Hashtable<TempDescriptor, Hashtable<FlatNode, Boolean>> map =
- definitelyWrittenResults.get(fn);
+ Hashtable<Descriptor, Hashtable<FlatNode, Boolean>> map = definitelyWrittenResults.get(fn);
if (map != null) {
if (map.get(rhs).get(fn).booleanValue()) {
- throw new Error("variable " + rhs
- + " was not overwritten in-between the same read statement by the out-most loop.");
+ // throw new Error("variable " + rhs
+ // +
+ // " was not overwritten in-between the same read statement by the out-most loop.");
}
}
FlatNode fn = (FlatNode) flatNodesToVisit.iterator().next();
flatNodesToVisit.remove(fn);
- Hashtable<TempDescriptor, Hashtable<FlatNode, Boolean>> prev =
- definitelyWrittenResults.get(fn);
+ Hashtable<Descriptor, Hashtable<FlatNode, Boolean>> prev = definitelyWrittenResults.get(fn);
- Hashtable<TempDescriptor, Hashtable<FlatNode, Boolean>> curr =
- new Hashtable<TempDescriptor, Hashtable<FlatNode, Boolean>>();
+ Hashtable<Descriptor, Hashtable<FlatNode, Boolean>> curr =
+ new Hashtable<Descriptor, Hashtable<FlatNode, Boolean>>();
for (int i = 0; i < fn.numPrev(); i++) {
FlatNode nn = fn.getPrev(i);
- Hashtable<TempDescriptor, Hashtable<FlatNode, Boolean>> dwIn =
- definitelyWrittenResults.get(nn);
+ Hashtable<Descriptor, Hashtable<FlatNode, Boolean>> dwIn = definitelyWrittenResults.get(nn);
if (dwIn != null) {
mergeResults(curr, dwIn);
}
}
}
- private void mergeResults(Hashtable<TempDescriptor, Hashtable<FlatNode, Boolean>> curr,
- Hashtable<TempDescriptor, Hashtable<FlatNode, Boolean>> in) {
+ private void mergeResults(Hashtable<Descriptor, Hashtable<FlatNode, Boolean>> curr,
+ Hashtable<Descriptor, Hashtable<FlatNode, Boolean>> in) {
- Set<TempDescriptor> inKeySet = in.keySet();
+ Set<Descriptor> inKeySet = in.keySet();
for (Iterator iterator = inKeySet.iterator(); iterator.hasNext();) {
- TempDescriptor inKey = (TempDescriptor) iterator.next();
+ Descriptor inKey = (Descriptor) iterator.next();
Hashtable<FlatNode, Boolean> inPair = in.get(inKey);
Set<FlatNode> pairKeySet = inPair.keySet();
}
private void definitelyWritten_nodeActions(FlatNode fn,
- Hashtable<TempDescriptor, Hashtable<FlatNode, Boolean>> curr, FlatNode entrance) {
+ Hashtable<Descriptor, Hashtable<FlatNode, Boolean>> curr, FlatNode entrance) {
if (fn == entrance) {
- Set<TempDescriptor> keySet = curr.keySet();
+ Set<Descriptor> keySet = curr.keySet();
for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
- TempDescriptor key = (TempDescriptor) iterator.next();
+ Descriptor key = (Descriptor) iterator.next();
Hashtable<FlatNode, Boolean> pair = curr.get(key);
if (pair != null) {
Set<FlatNode> pairKeySet = pair.keySet();
FlatOpNode fon = (FlatOpNode) fn;
lhs = fon.getDest();
+ rhs = fon.getLeft();
+ System.out.println("\nfon=" + fon);
+
if (fon.getOp().getOp() == Operation.ASSIGN) {
- rhs = fon.getLeft();
// read(rhs)
Hashtable<FlatNode, Boolean> gen = curr.get(rhs);
gen = new Hashtable<FlatNode, Boolean>();
curr.put(rhs, gen);
}
+ System.out.println("READ LOC=" + rhs.getType().getExtension());
Boolean currentStatus = gen.get(fn);
if (currentStatus == null) {
}
// write(lhs)
curr.put(lhs, new Hashtable<FlatNode, Boolean>());
+ System.out.println("WRITING LOC=" + lhs.getType().getExtension());
}
break;
// write(lhs)
curr.put(lhs, new Hashtable<FlatNode, Boolean>());
+ System.out.println("WRITING LOC=" + lhs.getType().getExtension());
+
}
break;
- case FKind.FlatFieldNode: {
+ case FKind.FlatFieldNode:
+ case FKind.FlatElementNode: {
FlatFieldNode ffn = (FlatFieldNode) fn;
- lhs = ffn.getDst();
- rhs = ffn.getSrc();
+ lhs = ffn.getSrc();
fld = ffn.getField();
- }
- break;
-
- case FKind.FlatElementNode: {
+ // read field
+ Hashtable<FlatNode, Boolean> gen = curr.get(fld);
+ if (gen == null) {
+ gen = new Hashtable<FlatNode, Boolean>();
+ curr.put(fld, gen);
+ }
+ Boolean currentStatus = gen.get(fn);
+ if (currentStatus == null) {
+ gen.put(fn, Boolean.FALSE);
+ }
- }
- break;
+ System.out.println("\nffn=" + ffn);
+ System.out.println("READ LOCfld=" + fld.getType().getExtension());
+ System.out.println("READ LOClhs=" + lhs.getType().getExtension());
- case FKind.FlatSetFieldNode: {
}
break;
+ case FKind.FlatSetFieldNode:
case FKind.FlatSetElementNode: {
+ FlatSetFieldNode fsfn = (FlatSetFieldNode) fn;
+ fld = fsfn.getField();
+
+ // write(field)
+ curr.put(fld, new Hashtable<FlatNode, Boolean>());
+
+ System.out.println("\nfsfn=" + fsfn);
+ System.out.println("WRITELOC LOC=" + fld.getType().getExtension());
+
}
break;
import IR.TypeDescriptor;
import IR.VarDescriptor;
import IR.Tree.ArrayAccessNode;
-import IR.Tree.ArrayInitializerNode;
import IR.Tree.AssignmentNode;
import IR.Tree.BlockExpressionNode;
import IR.Tree.BlockNode;
}
+ public Hashtable getMap() {
+ return td2loc;
+ }
+
private void checkDeclarationInMethodBody(ClassDescriptor cd, MethodDescriptor md) {
BlockNode bn = state.getMethodBody(md);
for (int i = 0; i < md.numParameters(); i++) {
private CompositeLocation checkLocationFromBlockStatementNode(MethodDescriptor md,
SymbolTable nametable, BlockStatementNode bsn) {
+ CompositeLocation compLoc = null;
switch (bsn.kind()) {
case Kind.BlockExpressionNode:
- return checkLocationFromBlockExpressionNode(md, nametable, (BlockExpressionNode) bsn);
+ compLoc = checkLocationFromBlockExpressionNode(md, nametable, (BlockExpressionNode) bsn);
+ break;
case Kind.DeclarationNode:
- return checkLocationFromDeclarationNode(md, nametable, (DeclarationNode) bsn);
+ compLoc = checkLocationFromDeclarationNode(md, nametable, (DeclarationNode) bsn);
+ break;
case Kind.IfStatementNode:
- return checkLocationFromIfStatementNode(md, nametable, (IfStatementNode) bsn);
+ compLoc = checkLocationFromIfStatementNode(md, nametable, (IfStatementNode) bsn);
+ break;
case Kind.LoopNode:
- return checkLocationFromLoopNode(md, nametable, (LoopNode) bsn);
+ compLoc = checkLocationFromLoopNode(md, nametable, (LoopNode) bsn);
+ break;
case Kind.ReturnNode:
// checkLocationFromReturnNode(md, nametable, (ReturnNode) bsn);
return null;
case Kind.SubBlockNode:
- return checkLocationFromSubBlockNode(md, nametable, (SubBlockNode) bsn);
+ compLoc = checkLocationFromSubBlockNode(md, nametable, (SubBlockNode) bsn);
+ break;
- // case Kind.ContinueBreakNode:
- // checkLocationFromContinueBreakNode(md, nametable,(ContinueBreakNode)
- // bsn);
- // return null;
+ // case Kind.ContinueBreakNode:
+ // checkLocationFromContinueBreakNode(md, nametable,(ContinueBreakNode)
+ // bsn);
+ // return null;
}
- return null;
+ return compLoc;
}
private CompositeLocation checkLocationFromLoopNode(MethodDescriptor md, SymbolTable nametable,
CompositeLocation condLoc =
checkLocationFromExpressionNode(md, nametable, ln.getCondition(), new CompositeLocation(
cd));
+ addTypeLocation(ln.getCondition().getType(), (condLoc));
+
CompositeLocation bodyLoc = checkLocationFromBlockNode(md, nametable, ln.getBody());
if (!CompositeLattice.isGreaterThan(condLoc, bodyLoc, cd)) {
CompositeLocation condLoc =
checkLocationFromExpressionNode(md, bn.getVarTable(), ln.getCondition(),
new CompositeLocation(cd));
+ addTypeLocation(ln.getCondition().getType(), condLoc);
+
CompositeLocation updateLoc =
checkLocationFromBlockNode(md, bn.getVarTable(), ln.getUpdate());
private CompositeLocation checkLocationFromSubBlockNode(MethodDescriptor md,
SymbolTable nametable, SubBlockNode sbn) {
- return checkLocationFromBlockNode(md, nametable, sbn.getBlockNode());
+ CompositeLocation compLoc = checkLocationFromBlockNode(md, nametable, sbn.getBlockNode());
+ return compLoc;
}
private CompositeLocation checkLocationFromIfStatementNode(MethodDescriptor md,
ClassDescriptor localCD = md.getClassDesc();
Set<CompositeLocation> glbInputSet = new HashSet<CompositeLocation>();
- CompositeLocation condLoc = new CompositeLocation(localCD);
- condLoc = checkLocationFromExpressionNode(md, nametable, isn.getCondition(), condLoc);
+ CompositeLocation condLoc =
+ checkLocationFromExpressionNode(md, nametable, isn.getCondition(), new CompositeLocation(
+ localCD));
+ addTypeLocation(isn.getCondition().getType(), condLoc);
glbInputSet.add(condLoc);
CompositeLocation locTrueBlock = checkLocationFromBlockNode(md, nametable, isn.getTrueBlock());
CompositeLocation locFalseBlock =
checkLocationFromBlockNode(md, nametable, isn.getFalseBlock());
glbInputSet.add(locFalseBlock);
- System.out.println(isn.getFalseBlock().printNode(0) + ":::falseLoc=" + locFalseBlock);
if (!CompositeLattice.isGreaterThan(condLoc, locFalseBlock, localCD)) {
// error
ClassDescriptor localCD = md.getClassDesc();
if (dn.getExpression() != null) {
- CompositeLocation expressionLoc = new CompositeLocation(localCD);
- expressionLoc =
- checkLocationFromExpressionNode(md, nametable, dn.getExpression(), expressionLoc);
+ CompositeLocation expressionLoc =
+ checkLocationFromExpressionNode(md, nametable, dn.getExpression(), new CompositeLocation(
+ localCD));
+ addTypeLocation(dn.getExpression().getType(), expressionLoc);
if (expressionLoc != null) {
// checking location order
private CompositeLocation checkLocationFromBlockExpressionNode(MethodDescriptor md,
SymbolTable nametable, BlockExpressionNode ben) {
- return checkLocationFromExpressionNode(md, nametable, ben.getExpression(), null);
+ CompositeLocation compLoc =
+ checkLocationFromExpressionNode(md, nametable, ben.getExpression(), null);
+ addTypeLocation(ben.getExpression().getType(), compLoc);
+ return compLoc;
}
private CompositeLocation checkLocationFromExpressionNode(MethodDescriptor md,
SymbolTable nametable, ExpressionNode en, CompositeLocation loc) {
+ CompositeLocation compLoc = null;
switch (en.kind()) {
case Kind.AssignmentNode:
- return checkLocationFromAssignmentNode(md, nametable, (AssignmentNode) en, loc);
+ compLoc = checkLocationFromAssignmentNode(md, nametable, (AssignmentNode) en, loc);
+ break;
case Kind.FieldAccessNode:
- return checkLocationFromFieldAccessNode(md, nametable, (FieldAccessNode) en, loc);
+ compLoc = checkLocationFromFieldAccessNode(md, nametable, (FieldAccessNode) en, loc);
+ break;
case Kind.NameNode:
- return checkLocationFromNameNode(md, nametable, (NameNode) en, loc);
+ compLoc = checkLocationFromNameNode(md, nametable, (NameNode) en, loc);
+ break;
case Kind.OpNode:
- return checkLocationFromOpNode(md, nametable, (OpNode) en);
+ compLoc = checkLocationFromOpNode(md, nametable, (OpNode) en);
+ break;
case Kind.CreateObjectNode:
- return checkLocationFromCreateObjectNode(md, nametable, (CreateObjectNode) en);
+ compLoc = checkLocationFromCreateObjectNode(md, nametable, (CreateObjectNode) en);
+ break;
case Kind.ArrayAccessNode:
- return checkLocationFromArrayAccessNode(md, nametable, (ArrayAccessNode) en);
+ compLoc = checkLocationFromArrayAccessNode(md, nametable, (ArrayAccessNode) en);
+ break;
case Kind.LiteralNode:
- return checkLocationFromLiteralNode(md, nametable, (LiteralNode) en, loc);
+ compLoc = checkLocationFromLiteralNode(md, nametable, (LiteralNode) en, loc);
+ break;
case Kind.MethodInvokeNode:
- return checkLocationFromMethodInvokeNode(md, nametable, (MethodInvokeNode) en);
+ compLoc = checkLocationFromMethodInvokeNode(md, nametable, (MethodInvokeNode) en);
+ break;
case Kind.TertiaryNode:
- return checkLocationFromTertiaryNode(md, nametable, (TertiaryNode) en);
+ compLoc = checkLocationFromTertiaryNode(md, nametable, (TertiaryNode) en);
+ break;
- // case Kind.InstanceOfNode:
- // checkInstanceOfNode(md, nametable, (InstanceOfNode) en, td);
- // return null;
+ // case Kind.InstanceOfNode:
+ // checkInstanceOfNode(md, nametable, (InstanceOfNode) en, td);
+ // return null;
- // case Kind.ArrayInitializerNode:
- // checkArrayInitializerNode(md, nametable, (ArrayInitializerNode) en,
- // td);
- // return null;
+ // case Kind.ArrayInitializerNode:
+ // checkArrayInitializerNode(md, nametable, (ArrayInitializerNode) en,
+ // td);
+ // return null;
- // case Kind.ClassTypeNode:
- // checkClassTypeNode(md, nametable, (ClassTypeNode) en, td);
- // return null;
+ // case Kind.ClassTypeNode:
+ // checkClassTypeNode(md, nametable, (ClassTypeNode) en, td);
+ // return null;
- // case Kind.OffsetNode:
- // checkOffsetNode(md, nametable, (OffsetNode)en, td);
- // return null;
+ // case Kind.OffsetNode:
+ // checkOffsetNode(md, nametable, (OffsetNode)en, td);
+ // return null;
default:
return null;
}
+ addTypeLocation(en.getType(), compLoc);
+ return compLoc;
+
}
private CompositeLocation checkLocationFromTertiaryNode(MethodDescriptor md,
CompositeLocation condLoc =
checkLocationFromExpressionNode(md, nametable, tn.getCond(), new CompositeLocation(cd));
+ addTypeLocation(tn.getCond().getType(), condLoc);
CompositeLocation trueLoc =
checkLocationFromExpressionNode(md, nametable, tn.getTrueExpr(), new CompositeLocation(cd));
+ addTypeLocation(tn.getTrueExpr().getType(), trueLoc);
CompositeLocation falseLoc =
checkLocationFromExpressionNode(md, nametable, tn.getFalseExpr(), new CompositeLocation(cd));
+ addTypeLocation(tn.getFalseExpr().getType(), falseLoc);
// check if condLoc is higher than trueLoc & falseLoc
if (!CompositeLattice.isGreaterThan(condLoc, trueLoc, cd)) {
boolean callerResult = CompositeLattice.isGreaterThan(callerArg1, callerArg2, cd);
boolean calleeResult =
CompositeLattice.isGreaterThan(calleeLoc1, calleeLoc2, calleecd);
-
+
if (calleeResult && !callerResult) {
// in callee, calleeLoc1 is higher than calleeLoc2
// then, caller should have same ordering relation in-bet
ExpressionNode en = min.getArg(i);
CompositeLocation argLoc =
checkLocationFromExpressionNode(md, nametable, en, new CompositeLocation(cd));
+ addTypeLocation(en.getType(), argLoc);
argLocSet.add(argLoc);
}
CompositeLocation arrayLoc =
checkLocationFromExpressionNode(md, nametable, aan.getExpression(), new CompositeLocation(
cd));
+ addTypeLocation(aan.getExpression().getType(), arrayLoc);
glbInputSet.add(arrayLoc);
CompositeLocation indexLoc =
checkLocationFromExpressionNode(md, nametable, aan.getIndex(), new CompositeLocation(cd));
glbInputSet.add(indexLoc);
+ addTypeLocation(aan.getIndex().getType(), indexLoc);
CompositeLocation glbLoc = CompositeLattice.calculateGLB(cd, glbInputSet, cd);
return glbLoc;
CompositeLocation argLoc =
checkLocationFromExpressionNode(md, nametable, en, new CompositeLocation(cd));
glbInputSet.add(argLoc);
+ addTypeLocation(en.getType(), argLoc);
}
// check array initializers
}
- private CompositeLocation checkLocationFromArrayInitializerNode(MethodDescriptor md,
- SymbolTable nametable, ArrayInitializerNode ain) {
-
- ClassDescriptor cd = md.getClassDesc();
- Vector<TypeDescriptor> vec_type = new Vector<TypeDescriptor>();
- for (int i = 0; i < ain.numVarInitializers(); ++i) {
- checkLocationFromExpressionNode(md, nametable, ain.getVarInitializer(i),
- new CompositeLocation(cd));
- vec_type.add(ain.getVarInitializer(i).getType());
- }
-
- return null;
- }
-
private CompositeLocation checkLocationFromOpNode(MethodDescriptor md, SymbolTable nametable,
OpNode on) {
ClassDescriptor cd = md.getClassDesc();
CompositeLocation leftLoc = new CompositeLocation(cd);
leftLoc = checkLocationFromExpressionNode(md, nametable, on.getLeft(), leftLoc);
+ addTypeLocation(on.getLeft().getType(), leftLoc);
CompositeLocation rightLoc = new CompositeLocation(cd);
if (on.getRight() != null) {
rightLoc = checkLocationFromExpressionNode(md, nametable, on.getRight(), rightLoc);
+ addTypeLocation(on.getRight().getType(), rightLoc);
}
System.out.println("checking op node=" + on.printNode(0));
NameDescriptor nd = nn.getName();
if (nd.getBase() != null) {
loc = checkLocationFromExpressionNode(md, nametable, nn.getExpression(), loc);
+ addTypeLocation(nn.getExpression().getType(), loc);
} else {
String varname = nd.toString();
private CompositeLocation checkLocationFromFieldAccessNode(MethodDescriptor md,
SymbolTable nametable, FieldAccessNode fan, CompositeLocation loc) {
+
FieldDescriptor fd = fan.getField();
Location fieldLoc = td2loc.get(fd);
loc.addLocation(fieldLoc);
ExpressionNode left = fan.getExpression();
- return checkLocationFromExpressionNode(md, nametable, left, loc);
+ CompositeLocation compLoc = checkLocationFromExpressionNode(md, nametable, left, loc);
+ addTypeLocation(left.getType(), compLoc);
+ return compLoc;
}
private CompositeLocation checkLocationFromAssignmentNode(MethodDescriptor md,
SymbolTable nametable, AssignmentNode an, CompositeLocation loc) {
-
ClassDescriptor cd = md.getClassDesc();
boolean postinc = true;
}
}
+ addTypeLocation(an.getSrc().getType(), srcLocation);
+ addTypeLocation(an.getDest().getType(), destLocation);
return destLocation;
}
- private Location createCompositeLocation(FieldAccessNode fan, Location loc) {
-
- FieldDescriptor field = fan.getField();
- ClassDescriptor fieldCD = field.getClassDescriptor();
-
- assert (field.getType().getAnnotationMarkers().size() == 1);
-
- AnnotationDescriptor locAnnotation = field.getType().getAnnotationMarkers().elementAt(0);
- if (locAnnotation.getType() == AnnotationDescriptor.SINGLE_ANNOTATION) {
- // single location
-
- } else {
- // delta location
- }
-
- // Location localLoc=new Location(field.getClassDescriptor(),field.get)
-
- // System.out.println("creatingComposite's field="+field+" localLoc="+localLoc);
- ExpressionNode leftNode = fan.getExpression();
- System.out.println("creatingComposite's leftnode=" + leftNode.printNode(0));
-
- return loc;
- }
-
private void assignLocationOfVarDescriptor(VarDescriptor vd, MethodDescriptor md,
SymbolTable nametable, TreeNode n) {
Location loc = new Location(cd, locationID);
td2loc.put(vd, loc);
+ addTypeLocation(vd.getType(), loc);
} else if (ad.getType() == AnnotationDescriptor.SINGLE_ANNOTATION) {
if (ad.getMarker().equals(SSJavaAnalysis.DELTA)) {
}
td2loc.put(vd, compLoc);
- System.out.println("vd=" + vd + " is assigned by " + compLoc);
+ addTypeLocation(vd.getType(), compLoc);
}
}
Location localLoc = new Location(cd, locationID);
td2loc.put(fd, localLoc);
+ addTypeLocation(fd.getType(), localLoc);
} else if (ad.getType() == AnnotationDescriptor.SINGLE_ANNOTATION) {
if (ad.getMarker().equals(SSJavaAnalysis.DELTA)) {
}
compLoc.addLocation(deltaLoc);
td2loc.put(fd, compLoc);
+ addTypeLocation(fd.getType(), compLoc);
}
}
}
+ private void addTypeLocation(TypeDescriptor type, Location loc) {
+ if (type != null) {
+ type.setExtension(loc);
+ }
+ }
+
static class CompositeLattice {
public static boolean isGreaterThan(Location loc1, Location loc2, ClassDescriptor priorityCD) {