Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
nimakarimipour committed Jul 26, 2024
1 parent 6910c1d commit 94899a5
Show file tree
Hide file tree
Showing 6 changed files with 525 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public Config(UCRTaintingChecker checker) {
Boolean.TRUE.equals(
XMLUtil.getValueFromTag(document, "/serialization/localVarOpt", Boolean.class)
.orElse(true));
System.out.println("Local Variable Optimization: " + this.enableLocalVariableOptimization);
this.outputDir = outputDirString == null ? null : Paths.get(outputDirString);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public Set<Fix> visitMemberSelect(MemberSelectTree tree, FoundRequired pair) {
&& typeFactory.isUnannotatedField((Symbol.VarSymbol) symbol)) {
return answer(unannotatedCodeFixComputer.visitMemberSelect(tree, pair));
}
if (symbol.getKind().isField() && TypeUtils.containsTypeVariable(symbol.type)) {
return answer(tree.accept(new TypeArgumentFixVisitor(typeFactory, this, context), pair));
}
}
}
return defaultAction(tree, pair);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
package edu.ucr.cs.riple.taint.ucrtainting.serialization.visitors;

import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.IdentifierTree;
import com.sun.source.tree.MemberSelectTree;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.tools.javac.code.Symbol;
Expand Down Expand Up @@ -57,12 +56,6 @@ public TypeArgumentFixVisitor(
super(factory, fixComputer, context);
}

@Override
public Set<Fix> visitIdentifier(IdentifierTree node, FoundRequired pair) {
Fix fix = buildFixForElement(TreeUtils.elementFromTree(node), pair);
return fix == null ? Set.of() : Set.of(fix);
}

@Override
public Set<Fix> visitMemberSelect(MemberSelectTree node, FoundRequired pair) {
JCTree declaration =
Expand Down Expand Up @@ -90,7 +83,7 @@ public Set<Fix> visitMemberSelect(MemberSelectTree node, FoundRequired pair) {
if (updatedFoundRequiredPair == null) {
return Set.of();
}
return node.getExpression().accept(this, updatedFoundRequiredPair);
return node.getExpression().accept(fixComputer, updatedFoundRequiredPair);
}

@Override
Expand Down Expand Up @@ -127,7 +120,7 @@ public Set<Fix> visitMethodInvocation(MethodInvocationTree node, FoundRequired p
if (updatedFoundRequiredPair == null) {
return Set.of();
}
return receiver.accept(this, updatedFoundRequiredPair);
return receiver.accept(fixComputer, updatedFoundRequiredPair);
}

/**
Expand Down
17 changes: 17 additions & 0 deletions tests/enhancedforserialization/expected-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,23 @@
"kind": "LOCAL_VARIABLE",
"class": "foo.bar.Foo"
}
},
{
"annotation": "untainted",
"location": {
"path": "/Users/nima/Developer/UCRTaintingChecker/tests/enhancedforserialization/foo/bar/Foo.java",
"varName": "matchingInterfaces",
"type-variable-position": [
[
2,
1,
0
]
],
"method": "enhancedForLoopMixedWithTypeVar()",
"kind": "LOCAL_VARIABLE",
"class": "foo.bar.Foo"
}
}
]
},
Expand Down
Loading

0 comments on commit 94899a5

Please sign in to comment.