{"action":"created","issue":{"url":"https://api.github.com/repos/hcoles/pitest/issues/221","labels_url":"https://api.github.com/repos/hcoles/pitest/issues/221/labels{/name}","comments_url":"https://api.github.com/repos/hcoles/pitest/issues/221/comments","events_url":"https://api.github.com/repos/hcoles/pitest/issues/221/events","html_url":"https://github.com/hcoles/pitest/pull/221","id":97418796,"number":221,"title":"Initial DSL mutator concept","user":{"login":"velo","id":136590,"avatar_url":"https://avatars.githubusercontent.com/u/136590?v=3","gravatar_id":"","url":"https://api.github.com/users/velo","html_url":"https://github.com/velo","followers_url":"https://api.github.com/users/velo/followers","following_url":"https://api.github.com/users/velo/following{/other_user}","gists_url":"https://api.github.com/users/velo/gists{/gist_id}","starred_url":"https://api.github.com/users/velo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/velo/subscriptions","organizations_url":"https://api.github.com/users/velo/orgs","repos_url":"https://api.github.com/users/velo/repos","events_url":"https://api.github.com/users/velo/events{/privacy}","received_events_url":"https://api.github.com/users/velo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-07-27T09:10:22Z","updated_at":"2015-09-27T19:52:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/hcoles/pitest/pulls/221","html_url":"https://github.com/hcoles/pitest/pull/221","diff_url":"https://github.com/hcoles/pitest/pull/221.diff","patch_url":"https://github.com/hcoles/pitest/pull/221.patch"},"body":"Also on users lists:\r\nhttps://groups.google.com/forum/#!topic/pitusers/o4Vpb_KI9Fc\r\n\r\nI'm looking into mutating DSLs, for instance camel DSL:\r\n````\r\nfrom(\"file:src/data?noop=true\")\r\n  .to(\"file:target/messages/uk\")\r\n  .to(\"file:target/messages/others\");\r\n````\r\n\r\nSo I wanna mutations to remove DSL steps to make sure all my configurations (or at least most) are meaningful and being tested somewhere.  So that piece of code would be mutated into something like:\r\n````\r\nfrom(\"file:src/data?noop=true\")\r\n  .to(\"file:target/messages/others\");\r\n````\r\nAND/OR\r\n````\r\nfrom(\"file:src/data?noop=true\")\r\n  .to(\"file:target/messages/uk\");\r\n````\r\n\r\nI also wanna test @Builders and queries DSL.\r\n\r\nSo pitest would remove query conditions or builder parameters.\r\n\r\n\r\nI started creating my own mutator for it (which I will submit as a pull request once properly tested)\r\n\r\nRight now, it does remove any method that return the same type as the class that declares it.\r\nhttps://github.com/hcoles/pitest/pull/221/files#diff-abcacb866451ca350bef8b81ef634c9bR35\r\n\r\nIt is not merge ready, it is just to illustrate what I'm doing.\r\n\r\nBut when I do that, dsl.chain(1) become to have the same effect as dsl = null would be\r\nhttps://github.com/hcoles/pitest/pull/221/files#diff-0f0887a036c22255aa52f202e494fe58R90\r\n\r\nAnd a NPE happen:\r\n````\r\njava.lang.NullPointerException\r\n\tat org.pitest.mutationtest.engine.gregor.mutators.DSLMethodCallMutatorTest$HasDslMethodCall.call(DSLMethodCallMutatorTest.java:90)\r\n\tat org.pitest.mutationtest.engine.gregor.mutators.DSLMethodCallMutatorTest$HasDslMethodCall.call(DSLMethodCallMutatorTest.java:1)\r\n\tat org.pitest.mutationtest.engine.gregor.MutatorTestBase.runInClassLoader(MutatorTestBase.java:151)\r\n\tat org.pitest.mutationtest.engine.gregor.MutatorTestBase.mutateAndCall(MutatorTestBase.java:117)\r\n\tat org.pitest.mutationtest.engine.gregor.MutatorTestBase.assertMutantCallableReturns(MutatorTestBase.java:106)\r\n\tat org.pitest.mutationtest.engine.gregor.mutators.DSLMethodCallMutatorTest.shouldRemoveDslMethods(DSLMethodCallMutatorTest.java:128)\r\n````\r\n\r\nI think I can find the problem by myself if is there any way to get ASMifier running on a class after mutated, is that possible?\r\nOr, if what I'm doing wrong is obvious, can someone point out?\r\n\r\nIs there anything obviously wrong that you guys see on my code?\r\n\r\nKeep in mind this is just my initial work, as I master what need to be done I will fix checkstyle and make the design as similar as possible to what is already there.\r\n\r\nAlso, is this functionality something that worth incorporating to pitest?\r\n\r\n\r\nMarvin"},"comment":{"url":"https://api.github.com/repos/hcoles/pitest/issues/comments/143590537","html_url":"https://github.com/hcoles/pitest/pull/221#issuecomment-143590537","issue_url":"https://api.github.com/repos/hcoles/pitest/issues/221","id":143590537,"user":{"login":"UrsMetz","id":1553875,"avatar_url":"https://avatars.githubusercontent.com/u/1553875?v=3","gravatar_id":"","url":"https://api.github.com/users/UrsMetz","html_url":"https://github.com/UrsMetz","followers_url":"https://api.github.com/users/UrsMetz/followers","following_url":"https://api.github.com/users/UrsMetz/following{/other_user}","gists_url":"https://api.github.com/users/UrsMetz/gists{/gist_id}","starred_url":"https://api.github.com/users/UrsMetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UrsMetz/subscriptions","organizations_url":"https://api.github.com/users/UrsMetz/orgs","repos_url":"https://api.github.com/users/UrsMetz/repos","events_url":"https://api.github.com/users/UrsMetz/events{/privacy}","received_events_url":"https://api.github.com/users/UrsMetz/received_events","type":"User","site_admin":false},"created_at":"2015-09-27T19:52:49Z","updated_at":"2015-09-27T19:52:49Z","body":"@velo today I tried to tackle the problem with subtying: I played around with an approach inspired by http://stackoverflow.com/a/14723212. But I think the problem is that removing method calls having a return type that is a sub or super type of the receiver can produce invalid byte code. E.g. mutating (when `Bar` extends `Foo`)\r\n```java\r\nBar bar = new Foo().bar()\r\n```\r\nto\r\n```java\r\nBar bar = new Foo()\r\n```\r\nwould lead to an byte code validation error (marked blue in the HTML report)."}}