Check if any field or any method call is incompatible and declare the whole class unfit for Java-TX type system
This commit is contained in:
parent
4c94a9b869
commit
6c1f306dd6
@ -39,10 +39,12 @@ public class WildcardFinderPlugin extends TreeScanner<Void, Void> implements Plu
|
||||
javacTask.addTaskListener(this);
|
||||
}
|
||||
|
||||
Boolean noIncompatibleMethods = true;
|
||||
String currentClassName = "";
|
||||
Boolean noIncompatibleFields = true;
|
||||
@Override
|
||||
public Void visitClass(ClassTree node, Void unused) {
|
||||
noIncompatibleMethods = true;
|
||||
noIncompatibleFields = true;
|
||||
try {
|
||||
currentClassName = currentPackage + "." + node.getSimpleName().toString();
|
||||
@ -58,12 +60,14 @@ public class WildcardFinderPlugin extends TreeScanner<Void, Void> implements Plu
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {}
|
||||
if(noIncompatibleFields){
|
||||
super.visitClass(node, unused); //Visit class afterwards check if incompatible Fields or Method calls are used:
|
||||
if(noIncompatibleMethods && noIncompatibleFields){
|
||||
logger.accept(preText + "Wildcard compatible class");
|
||||
}else{
|
||||
logger.accept(preText + "Wildcard incompatible class");
|
||||
logger.accept(preText + "Wildcard incompatible class Reason: "
|
||||
+ (noIncompatibleMethods?"Field":(noIncompatibleFields?"Method":"Field,Method")));
|
||||
}
|
||||
return super.visitClass(node, unused);
|
||||
return null;
|
||||
}
|
||||
|
||||
String currentPackage = "";
|
||||
@ -154,6 +158,7 @@ public class WildcardFinderPlugin extends TreeScanner<Void, Void> implements Plu
|
||||
if(ownerName.equals(currentClassName)){
|
||||
logger.accept(preText + " in same class");
|
||||
}
|
||||
noIncompatibleMethods = false;
|
||||
}else if(typeText.contains("capture#")) {
|
||||
logger.accept(preText + "CC: "+ "Arg#"+argumentNumber + ": " + typeText + " in " + currentSource + " " + lineOfPosition(currentClassContent,methodPos) + " of method " + methString);
|
||||
}else{
|
||||
|
Loading…
x
Reference in New Issue
Block a user