Conversation
| @@ -263,41 +263,51 @@ public void mutate(Representation<G> variant) throws GiveUpException { | |||
|
|
|||
There was a problem hiding this comment.
opefully I'm not too offbase with this mutate function.... it was a very confusing time but after reading the code and messing with the code and then rereading the code, I think the old version of the code was functional in a convoluted way (I was not convinced of that statement when I started changing this mutate function).
I kinda just took a cue from what used to be line 284 (not sure if it was a todo, but it seemed like a todo).
I think the main functional difference now is that a variant will always have promut number of mutations, whereas before, some of the locations found would not work, causing mutations < promut.
| if(proMutList.size()>=faultyAtoms.size()){ | ||
| localization.setAllPossibleStmtsToFixLocalization(); | ||
| alreadySetAllStmtsToFixLoc = true; | ||
| faultyAtoms = localization.getFaultLocalization(); |
There was a problem hiding this comment.
Not sure if this was the right thing to do here. I'm not entirely sure how localization.setAllPossibleStmtsToFixLocation actually affects the fault localization; looking at the code, it seems that method affects a field called this.fixLocations or something, but the way we used to query for locations, localization.getRandomLocation, uses this.faultLocalization
| alreadyOnList = proMutList.contains(wa); | ||
| } while(alreadyOnList); | ||
| proMutList.add((Location)wa); | ||
| wa = (Location) GlobalUtils.chooseOneWeighted(new ArrayList(faultyAtoms), Configuration.randomizer.nextDouble()); |
There was a problem hiding this comment.
Significantly uglier; I just copied what was in localization.getRandomLocation and pasted it here except changed the list of choices to faultyAtoms; open to suggestions
| List<WeightedAtom> inScopeThere = this.scopeHelper(variant.instantiateLocation(atom, item.getRight()), variant, editType); | ||
| for (WeightedAtom there : inScopeThere) { | ||
| if (there.getAtom() != location.getId()) { | ||
| if (there.getAtom() == location.getId()) { |
There was a problem hiding this comment.
not sure who uses SWAP but it doesn't make sense to swap statements when the location of the third expr is not the same as the original location
…d a ton of stuff; addressed Claire's request for lowercase package name
…n JavaEditFactory
| //Heuristic: Swapping, Appending or Replacing a return stmt to the middle of a block will make the code after it unreachable | ||
| ASTNode parentBlock = potentiallyBuggyStmt.blockThatContainsThisStatement(); | ||
| if(parentBlock != null && parentBlock instanceof Block) { | ||
| List<ASTNode> statementsInBlock = ((Block)parentBlock).statements(); | ||
| ASTNode lastStmtInTheBlock = statementsInBlock.get(statementsInBlock.size()-1); | ||
| if(!lastStmtInTheBlock.equals(faultAST)){ | ||
| continue; | ||
| } | ||
| } else { | ||
| continue; | ||
| } | ||
|
|
There was a problem hiding this comment.
I just noticed that this was here before and was my initial idea; I guess the assumption of no floating blocks was not a good one
|
|
||
| // oneday FIXME: lowercase the package name because it annoys me... |
|
Intellij autoformatted everything which is great but I'm so sorry if you are looking through the diffs |
also fixing things that I think might be bugs.
this is a draft (for now) mostly because I am using this to document changes I make with comments.