Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. private void analyzeConnectionState(IdentifiedClass clazz) {
  2. for (MethodInfo methodInfo : clazz.getClassInfo().methods()) {
  3. if (methodInfo.descriptor().contains("V") && !Modifier.isStatic(methodInfo.accessFlags())) {
  4. AbstractInstruction debugMessage = methodInfo.instructions().first(new InstructionFilter() {
  5. @Override
  6. public boolean accept(AbstractInstruction abstractInstruction) {
  7. if (abstractInstruction instanceof ConstantInstruction) {
  8. if (((ConstantInstruction) abstractInstruction).constant() != null) {
  9. if (((ConstantInstruction) abstractInstruction).constant().equals("js5crc")) {
  10. return true;
  11. }
  12. }
  13. }
  14.  
  15. return false;
  16. }
  17. });
  18.  
  19. if (debugMessage != null) {
  20. FieldInstruction putstatic = (FieldInstruction) debugMessage.next(new InstructionFilter() {
  21. @Override
  22. public boolean accept(AbstractInstruction abstractInstruction) {
  23. return abstractInstruction.opcode() == Opcode.PUTSTATIC;
  24. }
  25. });
  26.  
  27. if (putstatic != null) {
  28. FieldInstruction nextInstance = (FieldInstruction) methodInfo.instructions().firstAfter(putstatic.index(), new Filter<AbstractInstruction>() {
  29. @Override
  30. public boolean accept(AbstractInstruction abstractInstruction) {
  31. if (abstractInstruction instanceof FieldInstruction) {
  32. FieldInstruction fieldInstruction = (FieldInstruction) abstractInstruction;
  33. return fieldInstruction.owner().equals(putstatic.owner()) && fieldInstruction.descriptor().equals(putstatic.descriptor()) && fieldInstruction.name().equals(putstatic.name());
  34. }
  35. return false;
  36. }
  37. });
  38.  
  39. ConstantInstruction ldc = null;
  40.  
  41. if (nextInstance.next().opcode() == Opcode.LDC_W) {
  42. ldc = (ConstantInstruction) nextInstance.next();
  43. }
  44.  
  45. if (nextInstance.previous().opcode() == Opcode.LDC_W) {
  46. ldc = (ConstantInstruction) nextInstance.previous();
  47. }
  48. this.add(new IdentifiedField("getConnectionState", putstatic.descriptor(), putstatic.name(), putstatic.descriptor(), clazz.getNonRefactoredName(), (Integer) ldc.constant()));
  49. return;
  50. }
  51. }
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement