Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't analyse things that are surrounded by catch (ClassNotFound) #7

Open
pettermahlen opened this issue Jun 11, 2015 · 1 comment
Open

Comments

@pettermahlen
Copy link
Member

If a code block has:

try {
  foo();
} catch (ClassNotFoundException e) {
}

then there is no point in analyzing foo(); because it may be an optional dependency

Similarly, we could try to do more advanced analysis by keeping track of infected variables and method calls.
Something is infected if it is mutated or invoked within a ClassNotFound-try block.
Furthermore, something is also infected if it's reading a variable that is infected.

Example:

static {
  try {
    Class.forName("Bar");
    hasClass = true; // infected
  } catch (ClassNotFoundException e) {
    hasClass = false;
  }
}

// ...
void foo() {
  if (hasClass) { // infected
   Bar.bar();
  }
}

We could also try to find references to Class.forName(CONSTANT_STRING) and mark all such classes as infected.

@pettermahlen
Copy link
Member Author

We should probably analyse the benefits of this before doing too much implementation - this feels like something that can be quite complex to build, so we should try to understand if it's going to give value before building it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant