Examples of EnhanceException


Examples of net.sf.joafip.store.service.bytecode.EnhanceException

        break;
      case LRETURN:
        methodVisitor.visitInsn(LCONST_0);
        break;
      default:
        throw new EnhanceException("bad return opcode " + opcode);
      }
      methodVisitor.visitInsn(opcode);

      final int maxs = paramSize + returnTypeSize;
      methodVisitor.visitMaxs(maxs, maxs);
View Full Code Here

Examples of net.sf.joafip.store.service.bytecode.EnhanceException

            .getToNotCheckMethodSet(currentClassName);
        checkCurrentClass();
        currentClassName = classInfoFactory
            .superClassName(currentClassName);
      } catch (ClassInfoException exception) {
        throw new EnhanceException(exception);
      } catch (ClassNotFoundException exception) {
        throw new EnhanceException(exception);
      }
    }

    final List<OpcodeNodeMethod> list = checkMethodListener
        .getOtherInstancePrivateCallList();
    if (checkMethodListener.hasDirectAccess() || !list.isEmpty()) {
      final StringBuilder stringBuilder = new StringBuilder();
      stringBuilder.append('\n');
      if (!list.isEmpty()) {
        stringBuilder.append("private method call:\n");
        for (OpcodeNodeMethod opcodeNodeMethod : list) {
          stringBuilder.append(opcodeNodeMethod.getClassName());
          stringBuilder.append('#');
          stringBuilder.append(opcodeNodeMethod.getMethodName());
          stringBuilder.append(' ');
          stringBuilder.append(opcodeNodeMethod.getDesc());
          stringBuilder.append(" line ");
          stringBuilder.append(opcodeNodeMethod.getLineNumber());
          stringBuilder.append('\n');
        }
      }

      if (checkMethodListener.hasDirectAccess()) {
        stringBuilder.append("direct field access:\n");
        // String previousMethodAbsoluteName = null;
        for (DirectAccessInfo directAccessInfo : checkMethodListener
            .getDirectAccessSet()) {
          stringBuilder.append(directAccessInfo.toString());
          stringBuilder.append('\n');
          // if (previousMethodAbsoluteName != null
          // && !previousMethodAbsoluteName.equals(directAccessInfo
          // .getMethodAbsoluteName())) {
          // stringBuilder.append(checkMethodListener
          // .unassembled(directAccessInfo
          // .getMethodAbsoluteName()));
          // }
          // previousMethodAbsoluteName = directAccessInfo
          // .getMethodAbsoluteName();
        }
        // stringBuilder.append(checkMethodListener
        // .unassembled(previousMethodAbsoluteName));
        stringBuilder.append('\n');
      }

      throw new EnhanceException(stringBuilder.toString());
    }
  }
View Full Code Here

Examples of net.sf.joafip.store.service.bytecode.EnhanceException

      final int len = originalCode.length;
      final ClassReader classReader = new ClassReader(originalCode, off,
          len);
      classReader.accept(this, ClassReader.SKIP_FRAMES);
    } catch (IOException exception) {
      throw new EnhanceException(exception);
    } catch (RuntimeEnhanceException exception) {
      throw (EnhanceException) exception.getCause();
    }
  }
View Full Code Here

Examples of net.sf.joafip.store.service.bytecode.EnhanceException

        writeByteCode("runtime/class/" + toEnhanceClassName + ".class",
            generatedCode);
      }
      defineClass = defineClass(toEnhanceClassName, generatedCode);
    } catch (EnhanceException exception) {
      throw new EnhanceException("for " + objectClassInfo, exception);
    }
    return defineClass;
  }
View Full Code Here

Examples of net.sf.joafip.store.service.bytecode.EnhanceException

              .getNoProxyClassInfo(superClass);
        }
      } while (currentClassInfo != null);
      return methodsList;
    } catch (ClassInfoException exception) {
      throw new EnhanceException(exception);
    }
  }
View Full Code Here

Examples of net.sf.joafip.store.service.bytecode.EnhanceException

    final int modifiers = method.getModifiers();
    if (!Modifier.isPrivate(modifiers) && !Modifier.isStatic(modifiers)
        && !Modifier.isAbstract(modifiers) && isEnhancable(method)) {
      final boolean finalMethod = Modifier.isFinal(modifiers);
      if (!forceEnhance && finalMethod) {// NOPMD
        throw new EnhanceException("can not enhance: method of \""
            + method.toString() + "\" is final and is public: "
            + method);
      }
      if (!finalMethod) {
        final MethodKey methodKey = new MethodKey(method);// NOPMD
View Full Code Here

Examples of net.sf.joafip.store.service.bytecode.EnhanceException

  }

  public StackElement pop(final StackElement pointer, final EnumType type)
      throws EnhanceException {
    if (pointer == null) {
      throw new EnhanceException(EMPTY_STACK);
    }
    EnumStackEltType stackEltType = pointer.getType();
    if (!stackEltType.equals(type.getLowType())) {
      throw new EnhanceException("type mismatch " + stackEltType
          + " in the stack for " + type.getLowType() + " expected");
    }
    StackElement newPointer = pointer.getPrevious();
    if (type.getCategory() == 2) {
      if (newPointer == null) {
        throw new EnhanceException(EMPTY_STACK);
      }
      stackEltType = newPointer.getType();
      if (!stackEltType.equals(type.getHighType())) {
        throw new EnhanceException("type mismatch " + stackEltType
            + " in the stack for " + type.getHighType()
            + " expected");
      }
      newPointer = newPointer.getPrevious();
    }
View Full Code Here

Examples of net.sf.joafip.store.service.bytecode.EnhanceException

  }

  private StackElement pop(final StackElement currentStackElement)
      throws EnhanceException {
    if (currentStackElement == null) {
      throw new EnhanceException(EMPTY_STACK);
    }
    return currentStackElement.getPrevious();
  }
View Full Code Here

Examples of net.sf.joafip.store.service.bytecode.EnhanceException

    }
    if (opcode == Opcodes.INVOKESTATIC) {
      internalCall = true;
    } else {
      if (!EnumStackEltType.REF.equals(pointer.getType())) {
        throw new EnhanceException("bad type " + pointer.getType()
            + " for opcode " + opcode);
      }
      internalCall = !ownedMethodCall || pointer.isThisReference();
      pointer = pop(pointer);
    }
View Full Code Here

Examples of net.sf.joafip.store.service.bytecode.EnhanceException

      for (Map.Entry<OpcodeNode, Set<Label>> entry : gotoMap.entrySet()) {
        final OpcodeNode opcodeNode = entry.getKey();
        for (Label label : entry.getValue()) {
          final OpcodeNode next = opcodeByLabelMap.get(label);
          if (next == null) {
            throw new RuntimeEnhanceException(new EnhanceException(
                "undefined label " + label.toString()
                    + " for goto of "
                    + opcodeNode.toString()));
          }
          opcodeNode.addNext(next);
        }
      }

      final List<OpcodeNode> nextOpcodeNodeList = startOpcodeNode
          .getNextOpcodeNodeList();
      for (OpcodeNode opcodeNode : nextOpcodeNodeList) {
        check(opcodeNode, null);
      }

      for (Label label : handlerEntrySet) {
        final OpcodeNode handlerOpcode = opcodeByLabelMap.get(label);
        if (handlerOpcode == null) {
          throw new EnhanceException("undefined label "
              + label.toString());
        }
        check(handlerOpcode, HANDLER_START_STACK_ELEMENT);
      }
    } catch (Exception exception) {
      final String unassembled = listener.unassembled(methodAbsoluteName);
      throw new RuntimeEnhanceException(new EnhanceException(
          "checking:\n" + unassembled, exception));
    } catch (Error error) {
      LOGGER.error(listener.unassembled(methodAbsoluteName));
      throw error;
    } finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.