Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
nimakarimipour committed Jul 23, 2024
1 parent 62c5e7a commit f5ef221
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ public static Set<Fix> computeFixesOnClassDeclarationForRawType(
ClassDeclarationLocation classDeclarationLocation =
new ClassDeclarationLocation(classType, inheritedType);
classDeclarationLocation.setTypeIndexSet(TypeIndex.setOf(index + 1, 0));
System.out.println(
"CLASS DECLARATION TYPE INDEX: " + classDeclarationLocation.getTypeIndexSet());
if (classDeclarationLocation.getTypeIndexSet().equals(TypeIndex.TOP_LEVEL)) {
System.out.println("ENTERED HERE: " + TypeIndex.TOP_LEVEL);
return Set.of();
}
return Set.of(new Fix(classDeclarationLocation));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ public Fix buildFixForElement(Element element, FoundRequired pair) {
classDeclarationLocation.setTypeIndexSet(
untaintedTypeMatchVisitor.visit(annotatedDeclaredType, pair.required, null));
});
System.out.println(
"CLASS DECLARATION TYPE INDEX: " + classDeclarationLocation.getTypeIndexSet());
System.out.println(
"CONDITION: "
+ (classDeclarationLocation.getTypeIndexSet().isEmpty()
|| classDeclarationLocation.getTypeIndexSet().equals(TypeIndex.TOP_LEVEL)));
return classDeclarationLocation.getTypeIndexSet().isEmpty()
|| classDeclarationLocation.getTypeIndexSet().equals(TypeIndex.TOP_LEVEL)
? null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ private FoundRequired translateToReceiverRequiredPair(ExpressionTree expr, Found
.map(t -> t.tsym.name.toString())
.collect(Collectors.toList());
List<AnnotatedTypeMirror> ata = new ArrayList<>(superTypeMirror.getTypeArguments());
if (ata.isEmpty()) {
return null;
}
int ii = tvnames.indexOf(typeVarName);
AnnotatedTypeMirror typeArgumentType = ata.get(ii);
typeFactory.makeUntainted(typeArgumentType, lists);
Expand Down
19 changes: 18 additions & 1 deletion tests/templatetest/foo/bar/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,21 @@
import java.lang.annotation.*;
import java.util.*;

public class Test {}
public class Test {

void run(Message message) {
// :: error: assignment
@RUntainted Object uncertain = message.get(String.class);
}
}

interface Message extends StringMap {}

interface StringMap extends Map<String, Object> {

<T> T get(Class<T> key);

<T> void put(Class<T> key, T value);

<T> T remove(Class<T> key);
}

0 comments on commit f5ef221

Please sign in to comment.