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

Constructor Call Mutator cannot mutate creations of super class in constructor #34

Open
hcoles opened this issue Jan 7, 2014 · 0 comments

Comments

@hcoles
Copy link
Owner

hcoles commented Jan 7, 2014

From stefan.p...@googlemail.com on February 29, 2012 21:43:38

The MethodCallMethodVisitor has one draw back/problem: In a constructor it cannot mutate creations of the super class as they do not differ from the own constructor call:

public class A extends B {
   private B b;
   public A() {
     super();
     this.b = new B();
   }
}

does not result in any mutation because the visitor cannot distinguish
between "super()" and "new B()". I don't have a solution to this
problem. Both method calls can only be distinguished by their
context/position.

A use case for that issue would be an object used as lock:

public class MyThreadSafeClass { // note: extends java.lang.Object
  private final Object lock;
  public MyThreadSafeClass() {
    super();
    this.lock = new Object();
  }
  // some code using lock in synchronized blocks
}

Original issue: http://code.google.com/p/pitestrunner/issues/detail?id=34

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