Package org.apache.aries.proxy

Examples of org.apache.aries.proxy.FinalModifierException


        return null;
     
      // found a method we should weave
      // We can't override a final method
      if((access & ACC_FINAL) != 0)
        throw new RuntimeException(new FinalModifierException(
            superToCopy, name));
      // We can't call up to a package protected method if we aren't in the same
      // package
      if((access & (ACC_PUBLIC | ACC_PROTECTED | ACC_PRIVATE)) == 0) {
        if(!!!samePackage)
View Full Code Here


   */
  public static final Object getProxyInstance(Bundle client, Class<?> superclass,
      Collection<Class<?>> ifaces, Callable<Object> dispatcher, InvocationListener listener) throws UnableToProxyException{
   
    if(superclass != null && (superclass.getModifiers() & Modifier.FINAL) != 0)
      throw new FinalModifierException(superclass);
   
    ProxyClassLoader pcl = null;
   
    SortedSet<Class<?>> interfaces = createSet(ifaces);
   
View Full Code Here

        LOGGER.debug("Found proxy subclass with key {} and name {}.", key, className);

        if (className.charAt(0) == FINAL_MODIFIER) {
          String[] exceptionParts = className.substring(1).split(":");
          if (exceptionParts.length == 1) {
            throw new FinalModifierException(aClass);
          } else {
            throw new FinalModifierException(aClass, exceptionParts[1]);
          }
        } else if (className.charAt(0) == UNABLE_TO_PROXY) {
          throw new UnableToProxyException(aClass);
        }
View Full Code Here

  private static void scanForFinalModifiers(Class<?> clazz) throws FinalModifierException
  {
    LOGGER.debug(Constants.LOG_ENTRY, "scanForFinalModifiers", new Object[] { clazz });

    if (isFinal(clazz.getModifiers())) {
      throw new FinalModifierException(clazz);
    }

    List<String> finalMethods = new ArrayList<String>();

    // we don't want to check for final methods on java.* or javax.* Class
    // also, clazz can never be null here (we will always hit
    // java.lang.Object first)
    while (!clazz.getName().startsWith("java.") && !clazz.getName().startsWith("javax.")) {
      for (Method m : clazz.getDeclaredMethods()) {
        //Static finals are ok, because we won't be overriding them :)
        if (isFinal(m.getModifiers()) && !Modifier.isStatic(m.getModifiers())) {
          finalMethods.add(m.toGenericString());
        }
      }
      clazz = clazz.getSuperclass();
    }

    if (!finalMethods.isEmpty()) {

      String methodList = finalMethods.toString();
      methodList = methodList.substring(1, methodList.length() - 1);
      throw new FinalModifierException(clazz, methodList);
    }

    LOGGER.debug(Constants.LOG_EXIT, "scanForFinalModifiers");

  }
View Full Code Here

        return null;
     
      // found a method we should weave
      // We can't override a final method
      if((access & ACC_FINAL) != 0)
        throw new RuntimeException(new FinalModifierException(
            superToCopy, name));
      // We can't call up to a default access method if we aren't in the same
      // package
      if((access & (ACC_PUBLIC | ACC_PROTECTED | ACC_PRIVATE)) == 0) {
        if(!!!samePackage)
View Full Code Here

          new Callable<Object>() {
        public Object call() throws Exception {
          return null;
        }} , null).getClass();
    } catch (RuntimeException re) {
      FinalModifierException e = (FinalModifierException) re.getCause();
      assertFalse("Should have found final method not final class", e.isFinalClass());
    }
  }
View Full Code Here

          new Callable<Object>() {
        public Object call() throws Exception {
          return null;
        }} , null).getClass();
    } catch (RuntimeException re) {
      FinalModifierException e = (FinalModifierException) re.getCause();
      assertFalse("Should have found final method not final class", e.isFinalClass());
    }
  }
View Full Code Here

        LOGGER.debug("Found proxy subclass with key {} and name {}.", key, className);

        if (className.charAt(0) == FINAL_MODIFIER) {
          String[] exceptionParts = className.substring(1).split(":");
          if (exceptionParts.length == 1) {
            throw new FinalModifierException(aClass);
          } else {
            throw new FinalModifierException(aClass, exceptionParts[1]);
          }
        } else if (className.charAt(0) == UNABLE_TO_PROXY) {
          throw new UnableToProxyException(aClass);
        }
View Full Code Here

  private static void scanForFinalModifiers(Class<?> clazz) throws FinalModifierException
  {
    LOGGER.debug(Constants.LOG_ENTRY, "scanForFinalModifiers", new Object[] { clazz });

    if (isFinal(clazz.getModifiers())) {
      throw new FinalModifierException(clazz);
    }

    List<String> finalMethods = new ArrayList<String>();

    // we don't want to check for final methods on java.* or javax.* Class
    // also, clazz can never be null here (we will always hit
    // java.lang.Object first)
    while (!clazz.getName().startsWith("java.") && !clazz.getName().startsWith("javax.")) {
      for (Method m : clazz.getDeclaredMethods()) {
        //Static finals are ok, because we won't be overriding them :)
        if (isFinal(m.getModifiers()) && !Modifier.isStatic(m.getModifiers())) {
          finalMethods.add(m.toGenericString());
        }
      }
      clazz = clazz.getSuperclass();
    }

    if (!finalMethods.isEmpty()) {

      String methodList = finalMethods.toString();
      methodList = methodList.substring(1, methodList.length() - 1);
      throw new FinalModifierException(clazz, methodList);
    }

    LOGGER.debug(Constants.LOG_EXIT, "scanForFinalModifiers");

  }
View Full Code Here

        LOGGER.debug("Found proxy subclass with key {} and name {}.", key, className);

        if (className.charAt(0) == FINAL_MODIFIER) {
          String[] exceptionParts = className.substring(1).split(":");
          if (exceptionParts.length == 1) {
            throw new FinalModifierException(aClass);
          } else {
            throw new FinalModifierException(aClass, exceptionParts[1]);
          }
        } else if (className.charAt(0) == UNABLE_TO_PROXY) {
          throw new UnableToProxyException(aClass);
        }
View Full Code Here

TOP

Related Classes of org.apache.aries.proxy.FinalModifierException

Copyright © 2018 www.massapicom. 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.