Package org.aspectj.apache.bcel.classfile

Examples of org.aspectj.apache.bcel.classfile.JavaClass


    // annotations
    // so we bail out to Bcel and then chuck away the JavaClass so that we
    // don't hog
    // memory.
    try {
      JavaClass jc = bcelRepository.loadClass(forClass);
      org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[] anns = jc.getAnnotations();
      bcelRepository.clear();
      if (anns == null)
        return new ResolvedType[0];
      ResolvedType[] ret = new ResolvedType[anns.length];
      for (int i = 0; i < ret.length; i++) {
View Full Code Here


  public String[] getParameterNames(Member forMember) {
    if (!(forMember instanceof AccessibleObject))
      return null;

    try {
      JavaClass jc = bcelRepository.loadClass(forMember.getDeclaringClass());
      LocalVariableTable lvt = null;
      int numVars = 0;
      if (forMember instanceof Method) {
        org.aspectj.apache.bcel.classfile.Method bcelMethod = jc.getMethod((Method) forMember);
        lvt = bcelMethod.getLocalVariableTable();
        numVars = bcelMethod.getArgumentTypes().length;
      } else if (forMember instanceof Constructor) {
        org.aspectj.apache.bcel.classfile.Method bcelCons = jc.getMethod((Constructor) forMember);
        lvt = bcelCons.getLocalVariableTable();
        numVars = bcelCons.getArgumentTypes().length;
      }
      return getParameterNamesFromLVT(lvt, numVars);
    } catch (ClassNotFoundException cnfEx) {
View Full Code Here

    // annotations
    // so we bail out to Bcel and then chuck away the JavaClass so that we
    // don't hog
    // memory.
    try {
      JavaClass jc = bcelRepository.loadClass(onMember.getDeclaringClass());
      org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[][] anns = null;
      if (onMember instanceof Method) {
        org.aspectj.apache.bcel.classfile.Method bcelMethod = jc.getMethod((Method) onMember);
        if (bcelMethod == null) {
          // pr220430
          // System.err.println(
          // "Unexpected problem in Java15AnnotationFinder: cannot retrieve annotations on method '"
          // +
          // onMember.getName()+"' in class '"+jc.getClassName()+"'");
        } else {
          anns = bcelMethod.getParameterAnnotations();
        }
      } else if (onMember instanceof Constructor) {
        org.aspectj.apache.bcel.classfile.Method bcelCons = jc.getMethod((Constructor) onMember);
        anns = bcelCons.getParameterAnnotations();
      } else if (onMember instanceof Field) {
        // anns = null;
      }
      // the answer is cached and we don't want to hold on to memory
View Full Code Here

    }

    // Must be last since the above calls may still add something to it
    ConstantPool cp = this.cpool.getFinalConstantPool();

    return new JavaClass(classnameIndex, superclassnameIndex, filename, major, minor, modifiers, cp, interfaces, fields,
        methods, attributes.toArray(new Attribute[attributes.size()]));// OPTIMIZE avoid toArray()?
  }
View Full Code Here

  /**
   * If "this" doesn't reference a class, it references an interface or a non-existant entity.
   */
  public boolean referencesClass() {
    JavaClass jc = Repository.lookupClass(classname);
    if (jc == null) {
      return false;
    } else {
      return jc.isClass();
    }
  }
View Full Code Here

  /**
   * If "this" doesn't reference an interface, it references a class or a non-existant entity.
   */
  public boolean referencesInterface() {
    JavaClass jc = Repository.lookupClass(classname);
    if (jc == null) {
      return false;
    } else {
      return !jc.isClass();
    }
  }
View Full Code Here

  /**
   * Java Virtual Machine Specification edition 2, � 5.4.4 Access Control
   */
  public boolean accessibleTo(ObjectType accessor) {
    JavaClass jc = Repository.lookupClass(classname);

    if (jc.isPublic()) {
      return true;
    } else {
      JavaClass acc = Repository.lookupClass(accessor.classname);
      return acc.getPackageName().equals(jc.getPackageName());
    }
  }
View Full Code Here

  /**
   * Lookup a JavaClass object from the Class Name provided.
   */
  public JavaClass loadClass(String className) throws ClassNotFoundException {

    JavaClass javaClass = findClass(className);
    if (javaClass != null) {
      return javaClass;
    }

    javaClass = loadJavaClass(className);
View Full Code Here

    return loadClass(clazz.getResourceAsStream(name + ".class"), className);
  }

  private JavaClass loadClass(InputStream is, String className) throws ClassNotFoundException {
    JavaClass clazz = findClass(className);

    if (clazz != null) {
      return clazz;
    }
View Full Code Here

    java.net.URL url = toURL(className);
    timeManipulatingURLs += (System.currentTimeMillis() - time);
    if (url == null)
      throw new ClassNotFoundException(className + " not found - unable to determine URL");

    JavaClass clazz = null;

    // Look in the appropriate cache
    if (useSharedCache) {
      clazz = findClassShared(url);
      if (clazz != null) {
View Full Code Here

TOP

Related Classes of org.aspectj.apache.bcel.classfile.JavaClass

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.