{"action":"created","issue":{"url":"https://api.github.com/repos/powermock/powermock/issues/587","repository_url":"https://api.github.com/repos/powermock/powermock","labels_url":"https://api.github.com/repos/powermock/powermock/issues/587/labels{/name}","comments_url":"https://api.github.com/repos/powermock/powermock/issues/587/comments","events_url":"https://api.github.com/repos/powermock/powermock/issues/587/events","html_url":"https://github.com/powermock/powermock/issues/587","id":112214031,"number":587,"title":"Defer Everything to System Class Loader Not Marked for Mock","user":{"login":"EarthCitizen","id":1094129,"avatar_url":"https://avatars3.githubusercontent.com/u/1094129?v=3","gravatar_id":"","url":"https://api.github.com/users/EarthCitizen","html_url":"https://github.com/EarthCitizen","followers_url":"https://api.github.com/users/EarthCitizen/followers","following_url":"https://api.github.com/users/EarthCitizen/following{/other_user}","gists_url":"https://api.github.com/users/EarthCitizen/gists{/gist_id}","starred_url":"https://api.github.com/users/EarthCitizen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EarthCitizen/subscriptions","organizations_url":"https://api.github.com/users/EarthCitizen/orgs","repos_url":"https://api.github.com/users/EarthCitizen/repos","events_url":"https://api.github.com/users/EarthCitizen/events{/privacy}","received_events_url":"https://api.github.com/users/EarthCitizen/received_events","type":"User","site_admin":false},"labels":[{"id":102818832,"url":"https://api.github.com/repos/powermock/powermock/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":239548728,"url":"https://api.github.com/repos/powermock/powermock/labels/Priority:Medium","name":"Priority:Medium","color":"fef2c0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2015-10-19T19:23:37Z","updated_at":"2017-06-06T06:37:28Z","closed_at":"2017-06-06T06:37:28Z","body":"When I use `@PrepareForTest(MyClass.class)`, I also have to put ignores for classes that do not function when the class loader is `PowerMock`:\n\n`@PowerMockIgnore({\"org.hsqldb.*\", \"javax.*\", \"org.apache.*\", \"org.springframework.*\", \"org.xml.*\"})`\n\nThat gets excessive. I imagine this could also be done with a mock policy, but it is still a hassle. Is there a harm in `PowerMock` deferring everything to the system class loader that is not specifically marked for mock with `@PrepareForTest` or `@PrepareOnlyThisForTest`? This would greatly reduce the need for ignores.\n"},"comment":{"url":"https://api.github.com/repos/powermock/powermock/issues/comments/306395844","html_url":"https://github.com/powermock/powermock/issues/587#issuecomment-306395844","issue_url":"https://api.github.com/repos/powermock/powermock/issues/587","id":306395844,"user":{"login":"thekingnothing","id":13175296,"avatar_url":"https://avatars3.githubusercontent.com/u/13175296?v=3","gravatar_id":"","url":"https://api.github.com/users/thekingnothing","html_url":"https://github.com/thekingnothing","followers_url":"https://api.github.com/users/thekingnothing/followers","following_url":"https://api.github.com/users/thekingnothing/following{/other_user}","gists_url":"https://api.github.com/users/thekingnothing/gists{/gist_id}","starred_url":"https://api.github.com/users/thekingnothing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thekingnothing/subscriptions","organizations_url":"https://api.github.com/users/thekingnothing/orgs","repos_url":"https://api.github.com/users/thekingnothing/repos","events_url":"https://api.github.com/users/thekingnothing/events{/privacy}","received_events_url":"https://api.github.com/users/thekingnothing/received_events","type":"User","site_admin":false},"created_at":"2017-06-06T06:37:28Z","updated_at":"2017-06-06T06:37:28Z","body":"> Is there a harm in PowerMock deferring everything to the system class loader that is not specifically marked for mock with @PrepareForTest or @PrepareOnlyThisForTest\r\n\r\nIf PowerMock defers everything to the system class loader except classes that is pointed in `@PrepareForTest` or `@PrepareOnlyThisForTest`, when we have an issue with package-private classes, fields and methods.  Unfortunately, in Java class specified by pair <Class name, ClassLoader> and class can get access only to package-private classes/fields/methods which are loaded by the same ClassLoader. Otherwise, it's implied that class locates in other package even it has the same name.  \r\nFor example, if a class extends another package-private class. PowerMock cannot load only the class, but also should load its parent. In general it means that whole hierarchy should be scan during loading and loading other classes. And if this case, could be resolve (by introducing complexity, but could be), case with access to package-private fields/method cannot be resolve without scanning byte code of the class. \r\n\r\nI implemented ability to set global PowerMockIgnore via `configuration.properties` in PowerMock 1.7.0 (issue #801). So it partially fix your issues. You may now specify all ignores in one place.  \r\n\r\n"}}
{"actor":{"display_login":"thekingnothing"}}