Open ttho opened 1 month ago
[This is just to document my first analysis. I don't have a complete understanding yet.]
The byte code of try-catch blocks can be quite a beast.
incorrectReporting()
actually has two calls to Field.setBoolean(java.lang.Object, boolean)
– one for the case where int a = 0
succeeds, and one for the case where it throws an exception. The issue somehow seems to arise with 771df0615f382bfd1e5e560b1834c60c9f62089d, where Dependency.tryCreateFromAccess
was changed to produce a Dependency.FromAccess
instead of a plain Dependency
:
static Set<Dependency> tryCreateFromAccess(JavaAccess<?> access) {
JavaClass originOwner = access.getOriginOwner();
JavaClass targetOwner = access.getTargetOwner();
ImmutableSet.Builder<Dependency> dependencies = ImmutableSet.<Dependency>builder()
.addAll(createComponentTypeDependencies(originOwner, access.getOrigin().getDescription(), targetOwner, access.getSourceCodeLocation()));
- dependencies.addAll(asSet(tryCreateDependency(originOwner, targetOwner, access.getDescription(), access.getSourceCodeLocation())));
+ if (!originOwner.equals(targetOwner) && !targetOwner.isPrimitive()) {
+ dependencies.add(new Dependency.FromAccess(access));
+ }
return dependencies.build();
}
Since 1.3.0, the following test prints duplicate messages for the incorrect() method:
Actual output:
Expected output: