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

StrykerRepairSearchProblem: getSuccessors(FixCandidate s) throws null pointer exception when PRVO is involved #20

Closed
nmaguirre opened this issue Sep 23, 2014 · 2 comments

Comments

@nmaguirre
Copy link
Collaborator

When attempting to repair a program, getSuccessors throws a null pointer exception. PRVO is involved.

To reproduce the bug, enable PRV* in MuJavaAPI, and run test

programRepairWithSimpleIncorrectMethodDepthTwo()

from test class BasicProgramRepairTest.

For the moment, I'm commenting PRV* so that all tests pass.

@saiema
Copy link
Collaborator

saiema commented Sep 23, 2014

Error appears to be in line 693 of mujava.op.PRVO

boolean onlyPublic = t.getPackage() == null || !(t.getPackage().contains(getSelfType().getPackage()));

getSelfType().getPackage() must be null
t.getPackage() can't be null (otherwise the right part of the expression wouldn't be evaluated)

Posible solution:

boolean bothPackageAreNull = t.getPackage() == null && getSelfType().getPackage() == null;
boolean tPackageIsNull = t.getPackage() == null;
boolean thisPackageIsNull = getSelfType().getPackage() == null;
boolean tPackageContainsThisPackage = !thisPackageIsNull && t.getPackage().contains(getSelfType().getPackage());
boolean onlyPublic = !bothPackageAreNull && (tPackageIsNull || !tPackageContainsThisPackage);

I can make this change on muJava++ project but I don't know how to bring those changes to stryker

@saiema
Copy link
Collaborator

saiema commented Sep 24, 2014

fixed in 35a49d0

@saiema saiema closed this as completed Sep 24, 2014
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

2 participants