Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void analyzeConnectionState(IdentifiedClass clazz) {
- for (MethodInfo methodInfo : clazz.getClassInfo().methods()) {
- if (methodInfo.descriptor().contains("V") && !Modifier.isStatic(methodInfo.accessFlags())) {
- AbstractInstruction debugMessage = methodInfo.instructions().first(new InstructionFilter() {
- @Override
- public boolean accept(AbstractInstruction abstractInstruction) {
- if (abstractInstruction instanceof ConstantInstruction) {
- if (((ConstantInstruction) abstractInstruction).constant() != null) {
- if (((ConstantInstruction) abstractInstruction).constant().equals("js5crc")) {
- return true;
- }
- }
- }
- return false;
- }
- });
- if (debugMessage != null) {
- FieldInstruction putstatic = (FieldInstruction) debugMessage.next(new InstructionFilter() {
- @Override
- public boolean accept(AbstractInstruction abstractInstruction) {
- return abstractInstruction.opcode() == Opcode.PUTSTATIC;
- }
- });
- if (putstatic != null) {
- FieldInstruction nextInstance = (FieldInstruction) methodInfo.instructions().firstAfter(putstatic.index(), new Filter<AbstractInstruction>() {
- @Override
- public boolean accept(AbstractInstruction abstractInstruction) {
- if (abstractInstruction instanceof FieldInstruction) {
- FieldInstruction fieldInstruction = (FieldInstruction) abstractInstruction;
- return fieldInstruction.owner().equals(putstatic.owner()) && fieldInstruction.descriptor().equals(putstatic.descriptor()) && fieldInstruction.name().equals(putstatic.name());
- }
- return false;
- }
- });
- ConstantInstruction ldc = null;
- if (nextInstance.next().opcode() == Opcode.LDC_W) {
- ldc = (ConstantInstruction) nextInstance.next();
- }
- if (nextInstance.previous().opcode() == Opcode.LDC_W) {
- ldc = (ConstantInstruction) nextInstance.previous();
- }
- this.add(new IdentifiedField("getConnectionState", putstatic.descriptor(), putstatic.name(), putstatic.descriptor(), clazz.getNonRefactoredName(), (Integer) ldc.constant()));
- return;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement