Lines 44-49
Link Here
|
44 |
import org.apache.bcel.generic.PUTSTATIC; |
44 |
import org.apache.bcel.generic.PUTSTATIC; |
45 |
import org.apache.bcel.generic.RET; |
45 |
import org.apache.bcel.generic.RET; |
46 |
import org.apache.bcel.generic.ReturnInstruction; |
46 |
import org.apache.bcel.generic.ReturnInstruction; |
|
|
47 |
import org.apache.bcel.generic.SWITCH; |
47 |
import org.apache.bcel.generic.Select; |
48 |
import org.apache.bcel.generic.Select; |
48 |
import org.apache.bcel.generic.Type; |
49 |
import org.apache.bcel.generic.Type; |
49 |
import org.aspectj.bridge.IMessage; |
50 |
import org.aspectj.bridge.IMessage; |
Lines 462-468
Link Here
|
462 |
dest = ret.append(fact.createBranchInstruction(Constants.GOTO, end)); |
463 |
dest = ret.append(fact.createBranchInstruction(Constants.GOTO, end)); |
463 |
} |
464 |
} |
464 |
} else if (fresh instanceof BranchInstruction) { |
465 |
} else if (fresh instanceof BranchInstruction) { |
465 |
dest = ret.append((BranchInstruction) fresh); |
466 |
if (fresh instanceof Select) { |
|
|
467 |
// Bugzilla #39479 |
468 |
// Need to manually copy Select instructions - if we rely on the the 'fresh' object |
469 |
// created by copy() above, the InstructionHandle array 'targets' inside the Select |
470 |
// object will not have been deep copied, so modifying targets in fresh will modify |
471 |
// the original Select - not what we want ! (It is a bug in BCEL to do with cloning |
472 |
// Select objects). |
473 |
Select freshSelect = (Select)fresh; |
474 |
|
475 |
// Create a new targets array that looks just like the existing one |
476 |
InstructionHandle[] targets = new InstructionHandle[freshSelect.getTargets().length]; |
477 |
for (int i = 0; i < targets.length; i++) { |
478 |
targets[i] = freshSelect.getTargets()[i]; |
479 |
} |
480 |
|
481 |
// Create a new select statement with the new targets array |
482 |
SWITCH switchStatement = new SWITCH(freshSelect.getMatchs(),targets,freshSelect.getTarget()); |
483 |
Select sel = (Select)switchStatement.getInstruction(); |
484 |
dest = ret.append((BranchInstruction)sel); |
485 |
} else { |
486 |
dest = ret.append((BranchInstruction) fresh); |
487 |
} |
466 |
} else if ( |
488 |
} else if ( |
467 |
fresh instanceof LocalVariableInstruction || fresh instanceof RET) { |
489 |
fresh instanceof LocalVariableInstruction || fresh instanceof RET) { |
468 |
IndexedInstruction indexed = (IndexedInstruction) fresh; |
490 |
IndexedInstruction indexed = (IndexedInstruction) fresh; |