{"action":"opened","issue":{"url":"https://api.github.com/repos/spotify/missinglink/issues/7","labels_url":"https://api.github.com/repos/spotify/missinglink/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/spotify/missinglink/issues/7/comments","events_url":"https://api.github.com/repos/spotify/missinglink/issues/7/events","html_url":"https://github.com/spotify/missinglink/issues/7","id":87259954,"number":7,"title":"Don't analyse things that are surrounded by catch (ClassNotFound)","user":{"login":"pettermahlen","id":353687,"avatar_url":"https://avatars.githubusercontent.com/u/353687?v=3","gravatar_id":"","url":"https://api.github.com/users/pettermahlen","html_url":"https://github.com/pettermahlen","followers_url":"https://api.github.com/users/pettermahlen/followers","following_url":"https://api.github.com/users/pettermahlen/following{/other_user}","gists_url":"https://api.github.com/users/pettermahlen/gists{/gist_id}","starred_url":"https://api.github.com/users/pettermahlen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pettermahlen/subscriptions","organizations_url":"https://api.github.com/users/pettermahlen/orgs","repos_url":"https://api.github.com/users/pettermahlen/repos","events_url":"https://api.github.com/users/pettermahlen/events{/privacy}","received_events_url":"https://api.github.com/users/pettermahlen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-11T08:32:56Z","updated_at":"2015-06-11T08:32:56Z","closed_at":null,"body":"If a code block has:\r\n\r\n```java\r\ntry {\r\n  foo();\r\n} catch (ClassNotFoundException e) {\r\n}\r\n```\r\nthen there is no point in analyzing `foo();` because it may be an optional dependency\r\n\r\nSimilarly, we could try to do more advanced analysis by keeping track of infected variables and method calls.\r\nSomething is infected if it is mutated or invoked within a ClassNotFound-try block.\r\nFurthermore, something is also infected if it's reading a variable that is infected.\r\n\r\nExample:\r\n```java\r\nstatic {\r\n  try {\r\n    Class.forName(\"Bar\");\r\n    hasClass = true; // infected\r\n  } catch (ClassNotFoundException e) {\r\n    hasClass = false;\r\n  }\r\n}\r\n\r\n// ...\r\nvoid foo() {\r\n  if (hasClass) { // infected\r\n   Bar.bar();\r\n  }\r\n}\r\n```\r\n\r\nWe could also try to find references to `Class.forName(CONSTANT_STRING)` and mark all such classes as infected."}}