com.sun.org.apache.bcel.internal.Repository Java Examples

The following examples show how to use com.sun.org.apache.bcel.internal.Repository. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ObjectType.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference an interface, it references a class
 * or a non-existant entity.
 */
public boolean referencesInterface(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return !jc.isClass();
}
 
Example #2
Source File: ObjectType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference a class, it references an interface
 * or a non-existant entity.
 */
public boolean referencesClass(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return jc.isClass();
}
 
Example #3
Source File: ObjectType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference an interface, it references a class
 * or a non-existant entity.
 */
public boolean referencesInterface(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return !jc.isClass();
}
 
Example #4
Source File: ObjectType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Java Virtual Machine Specification edition 2, 5.4.4 Access Control
 */
public boolean accessibleTo(ObjectType accessor) {
  JavaClass jc = Repository.lookupClass(class_name);

  if(jc.isPublic()) {
    return true;
  } else {
    JavaClass acc = Repository.lookupClass(accessor.class_name);
    return acc.getPackageName().equals(jc.getPackageName());
  }
}
 
Example #5
Source File: BCELifier.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** Default _main method
 */
public static void _main(String[] argv) throws Exception {
  JavaClass java_class;
  String    name = argv[0];

  if((java_class = Repository.lookupClass(name)) == null)
    java_class = new ClassParser(name).parse(); // May throw IOException

  BCELifier bcelifier = new BCELifier(java_class, System.out);
  bcelifier.start();
}
 
Example #6
Source File: ObjectType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference a class, it references an interface
 * or a non-existant entity.
 */
public boolean referencesClass(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return jc.isClass();
}
 
Example #7
Source File: ObjectType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference an interface, it references a class
 * or a non-existant entity.
 */
public boolean referencesInterface(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return !jc.isClass();
}
 
Example #8
Source File: ObjectType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Java Virtual Machine Specification edition 2, 5.4.4 Access Control
 */
public boolean accessibleTo(ObjectType accessor) {
  JavaClass jc = Repository.lookupClass(class_name);

  if(jc.isPublic()) {
    return true;
  } else {
    JavaClass acc = Repository.lookupClass(accessor.class_name);
    return acc.getPackageName().equals(jc.getPackageName());
  }
}
 
Example #9
Source File: BCELifier.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** Default _main method
 */
public static void _main(String[] argv) throws Exception {
  JavaClass java_class;
  String    name = argv[0];

  if((java_class = Repository.lookupClass(name)) == null)
    java_class = new ClassParser(name).parse(); // May throw IOException

  BCELifier bcelifier = new BCELifier(java_class, System.out);
  bcelifier.start();
}
 
Example #10
Source File: ObjectType.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference a class, it references an interface
 * or a non-existant entity.
 * @deprecated (since 6.0) this method returns an inaccurate result
 *   if the class or interface referenced cannot
 *   be found: use referencesClassExact() instead
 */
@Deprecated
public boolean referencesClass() {
    try {
        final JavaClass jc = Repository.lookupClass(class_name);
        return jc.isClass();
    } catch (final ClassNotFoundException e) {
        return false;
    }
}
 
Example #11
Source File: ObjectType.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference an interface, it references a class
 * or a non-existant entity.
 * @deprecated (since 6.0) this method returns an inaccurate result
 *   if the class or interface referenced cannot
 *   be found: use referencesInterfaceExact() instead
 */
@Deprecated
public boolean referencesInterface() {
    try {
        final JavaClass jc = Repository.lookupClass(class_name);
        return !jc.isClass();
    } catch (final ClassNotFoundException e) {
        return false;
    }
}
 
Example #12
Source File: ObjectType.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Return true if this type is a subclass of given ObjectType.
 * @throws ClassNotFoundException if any of this class's superclasses
 *  can't be found
 */
public boolean subclassOf( final ObjectType superclass ) throws ClassNotFoundException {
    if (this.referencesInterfaceExact() || superclass.referencesInterfaceExact()) {
        return false;
    }
    return Repository.instanceOf(this.class_name, superclass.class_name);
}
 
Example #13
Source File: ObjectType.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Java Virtual Machine Specification edition 2,  5.4.4 Access Control
 * @throws ClassNotFoundException if the class referenced by this type
 *   can't be found
 */
public boolean accessibleTo( final ObjectType accessor ) throws ClassNotFoundException {
    final JavaClass jc = Repository.lookupClass(class_name);
    if (jc.isPublic()) {
        return true;
    }
    final JavaClass acc = Repository.lookupClass(accessor.class_name);
    return acc.getPackageName().equals(jc.getPackageName());
}
 
Example #14
Source File: BCELifier.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
static JavaClass getJavaClass(final String name) throws ClassNotFoundException, IOException {
    JavaClass java_class;
    if ((java_class = Repository.lookupClass(name)) == null) {
        java_class = new ClassParser(name).parse(); // May throw IOException
    }
    return java_class;
}
 
Example #15
Source File: ObjectType.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference a class, it references an interface
 * or a non-existant entity.
 */
public boolean referencesClass(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return jc.isClass();
}
 
Example #16
Source File: ObjectType.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference an interface, it references a class
 * or a non-existant entity.
 */
public boolean referencesInterface(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return !jc.isClass();
}
 
Example #17
Source File: ObjectType.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Java Virtual Machine Specification edition 2, 5.4.4 Access Control
 */
public boolean accessibleTo(ObjectType accessor) {
  JavaClass jc = Repository.lookupClass(class_name);

  if(jc.isPublic()) {
    return true;
  } else {
    JavaClass acc = Repository.lookupClass(accessor.class_name);
    return acc.getPackageName().equals(jc.getPackageName());
  }
}
 
Example #18
Source File: BCELifier.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Default _main method
 */
public static void _main(String[] argv) throws Exception {
  JavaClass java_class;
  String    name = argv[0];

  if((java_class = Repository.lookupClass(name)) == null)
    java_class = new ClassParser(name).parse(); // May throw IOException

  BCELifier bcelifier = new BCELifier(java_class, System.out);
  bcelifier.start();
}
 
Example #19
Source File: ObjectType.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference a class, it references an interface
 * or a non-existant entity.
 */
public boolean referencesClass(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return jc.isClass();
}
 
Example #20
Source File: ObjectType.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference an interface, it references a class
 * or a non-existant entity.
 */
public boolean referencesInterface(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return !jc.isClass();
}
 
Example #21
Source File: ObjectType.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Java Virtual Machine Specification edition 2, 5.4.4 Access Control
 */
public boolean accessibleTo(ObjectType accessor) {
  JavaClass jc = Repository.lookupClass(class_name);

  if(jc.isPublic()) {
    return true;
  } else {
    JavaClass acc = Repository.lookupClass(accessor.class_name);
    return acc.getPackageName().equals(jc.getPackageName());
  }
}
 
Example #22
Source File: BCELifier.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** Default _main method
 */
public static void _main(String[] argv) throws Exception {
  JavaClass java_class;
  String    name = argv[0];

  if((java_class = Repository.lookupClass(name)) == null)
    java_class = new ClassParser(name).parse(); // May throw IOException

  BCELifier bcelifier = new BCELifier(java_class, System.out);
  bcelifier.start();
}
 
Example #23
Source File: ObjectType.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference a class, it references an interface
 * or a non-existant entity.
 */
public boolean referencesClass(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return jc.isClass();
}
 
Example #24
Source File: ObjectType.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference an interface, it references a class
 * or a non-existant entity.
 */
public boolean referencesInterface(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return !jc.isClass();
}
 
Example #25
Source File: ObjectType.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Java Virtual Machine Specification edition 2, 5.4.4 Access Control
 */
public boolean accessibleTo(ObjectType accessor) {
  JavaClass jc = Repository.lookupClass(class_name);

  if(jc.isPublic()) {
    return true;
  } else {
    JavaClass acc = Repository.lookupClass(accessor.class_name);
    return acc.getPackageName().equals(jc.getPackageName());
  }
}
 
Example #26
Source File: BCELifier.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** Default _main method
 */
public static void _main(String[] argv) throws Exception {
  JavaClass java_class;
  String    name = argv[0];

  if((java_class = Repository.lookupClass(name)) == null)
    java_class = new ClassParser(name).parse(); // May throw IOException

  BCELifier bcelifier = new BCELifier(java_class, System.out);
  bcelifier.start();
}
 
Example #27
Source File: ObjectType.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference a class, it references an interface
 * or a non-existant entity.
 */
public boolean referencesClass(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return jc.isClass();
}
 
Example #28
Source File: ObjectType.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If "this" doesn't reference an interface, it references a class
 * or a non-existant entity.
 */
public boolean referencesInterface(){
  JavaClass jc = Repository.lookupClass(class_name);
  if (jc == null)
    return false;
  else
    return !jc.isClass();
}
 
Example #29
Source File: ObjectType.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Java Virtual Machine Specification edition 2, 5.4.4 Access Control
 */
public boolean accessibleTo(ObjectType accessor) {
  JavaClass jc = Repository.lookupClass(class_name);

  if(jc.isPublic()) {
    return true;
  } else {
    JavaClass acc = Repository.lookupClass(accessor.class_name);
    return acc.getPackageName().equals(jc.getPackageName());
  }
}
 
Example #30
Source File: BCELifier.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Default _main method
 */
public static void _main(String[] argv) throws Exception {
  JavaClass java_class;
  String    name = argv[0];

  if((java_class = Repository.lookupClass(name)) == null)
    java_class = new ClassParser(name).parse(); // May throw IOException

  BCELifier bcelifier = new BCELifier(java_class, System.out);
  bcelifier.start();
}