本文整理汇总了Java中org.apache.bcel.classfile.DescendingVisitor类的典型用法代码示例。如果您正苦于以下问题:Java DescendingVisitor类的具体用法?Java DescendingVisitor怎么用?Java DescendingVisitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DescendingVisitor类属于org.apache.bcel.classfile包,在下文中一共展示了DescendingVisitor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: CPESSC_Visitor
import org.apache.bcel.classfile.DescendingVisitor; //导入依赖的package包/类
private CPESSC_Visitor(JavaClass _jc){
jc = _jc;
cp = _jc.getConstantPool();
cplen = cp.getLength();
CONST_Class = org.apache.bcel.classfile.ConstantClass.class;
/*
CONST_Fieldref = org.apache.bcel.classfile.ConstantFieldref.class;
CONST_Methodref = org.apache.bcel.classfile.ConstantMethodref.class;
CONST_InterfaceMethodref = org.apache.bcel.classfile.ConstantInterfaceMethodref.class;
*/
CONST_String = org.apache.bcel.classfile.ConstantString.class;
CONST_Integer = org.apache.bcel.classfile.ConstantInteger.class;
CONST_Float = org.apache.bcel.classfile.ConstantFloat.class;
CONST_Long = org.apache.bcel.classfile.ConstantLong.class;
CONST_Double = org.apache.bcel.classfile.ConstantDouble.class;
CONST_NameAndType = org.apache.bcel.classfile.ConstantNameAndType.class;
CONST_Utf8 = org.apache.bcel.classfile.ConstantUtf8.class;
carrier = new DescendingVisitor(_jc, this);
carrier.visit();
}
开发者ID:Hu6,项目名称:VestaClient,代码行数:23,代码来源:Pass2Verifier.java
示例2: walk
import org.apache.bcel.classfile.DescendingVisitor; //导入依赖的package包/类
/**
* Traverses a JavaClass parse tree and accepts all registered
* visitors.
* @param aJavaClass the root of the tree.
*/
public void walk(JavaClass aJavaClass)
{
DescendingVisitor visitor =
new DescendingVisitor(aJavaClass, mVisitor);
aJavaClass.accept(visitor);
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:JavaClassWalker.java
示例3: getRefClasses
import org.apache.bcel.classfile.DescendingVisitor; //导入依赖的package包/类
private String[] getRefClasses(String className, byte[] bytecode) {
String[] result = null;
try {
InputStream in = new ByteArrayInputStream(bytecode);
ClassParser parser = new ClassParser(in, className);
JavaClass javaClass = parser.parse();
ClassVisitor visitor;
if (searchClassForName) {
visitor = new ClassVisitorSearchCFN(javaClass);
}
else {
visitor = new ClassVisitor(javaClass);
}
// ConstantPoolGen pool = new ConstantPoolGen(javaClass.getConstantPool());
DescendingVisitor dvis = new DescendingVisitor(javaClass, visitor);
dvis.visit();
in.close();
result = visitor.getRefClasses();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:26,代码来源:AutoJarFilter.java
示例4: verifyClassAdheresToDesign
import org.apache.bcel.classfile.DescendingVisitor; //导入依赖的package包/类
private void verifyClassAdheresToDesign(Design d, InputStream in, String name, File originalClassOrJarFile)
throws ClassFormatException, IOException {
try {
verifiedAtLeastOne = true;
ClassParser parser = new ClassParser(in, name);
JavaClass javaClass = parser.parse();
className = javaClass.getClassName();
if (!d.needEvalCurrentClass(className))
return;
ConstantPool pool = javaClass.getConstantPool();
processConstantPool(pool);
VisitorImpl visitor = new VisitorImpl(pool, this, d, task.getLocation());
DescendingVisitor desc = new DescendingVisitor(javaClass, visitor);
desc.visit();
} catch (BuildException e) {
log(Design.getWrapperMsg(originalClassOrJarFile, e.getMessage()), Project.MSG_ERR);
designErrors.addElement(e);
}
}
开发者ID:cniweb,项目名称:ant-contrib,代码行数:22,代码来源:VerifyDesignDelegate.java
示例5: doParse
import org.apache.bcel.classfile.DescendingVisitor; //导入依赖的package包/类
@Override
protected JavaClass doParse(String place, InputStream is, String model) throws ParseClassException {
JavaClass jClass = null;
try {
ClassParser parser = new ClassParser(is, null);
org.apache.bcel.classfile.JavaClass javaClass = parser.parse();
jClass = new JavaClass("Unknown", true, javaClass.getAccessFlags());
jClass.setPlace(place);
JDependClassFileVisitor visitor = this.createVisitor(model);
visitor.setJavaClass(jClass);
visitor.setParser(this);
DescendingVisitor dvisitor = new DescendingVisitor(javaClass, visitor);
dvisitor.visit();
visitor.calImportedPackages();
this.debug("");
this.getWriter().flush();
return jClass;
} catch (Exception e) {
if (jClass != null) {
throw new ParseClassException(jClass.getName(), e);
} else {
throw new ParseClassException(e);
}
}
}
开发者ID:jdepend,项目名称:cooper,代码行数:37,代码来源:BCELClassFileParser.java
示例6: parse
import org.apache.bcel.classfile.DescendingVisitor; //导入依赖的package包/类
public XmlvmResource parse() {
if (!init()) {
return null;
}
new DescendingVisitor(clazz, visitor).visit();
return new XmlvmResource(org.xmlvm.proc.XmlvmResource.Type.JVM,
visitor.getXmlvmDocument());
}
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:ClassToXmlvmProcess.java
示例7: InnerClassDetector
import org.apache.bcel.classfile.DescendingVisitor; //导入依赖的package包/类
/** Constructs an InnerClassDetector working on the JavaClass _jc. */
public InnerClassDetector(JavaClass _jc){
jc = _jc;
cp = jc.getConstantPool();
(new DescendingVisitor(jc, this)).visit();
}
开发者ID:Hu6,项目名称:VestaClient,代码行数:7,代码来源:Pass2Verifier.java
示例8: parseJar
import org.apache.bcel.classfile.DescendingVisitor; //导入依赖的package包/类
JarMetadata parseJar(final File jarFile) throws IOException, NoSuchAlgorithmException {
List<ClassMetadata> list = new ArrayList<ClassMetadata>();
final JarFile jfile = new JarFile(jarFile);
Enumeration<JarEntry> entries = jfile.entries();
while (entries.hasMoreElements()) {
final JarEntry entry = entries.nextElement();
if (entry.isDirectory())
continue;
if (entry.getName().endsWith(".class")) {
JavaClass jclass = new ClassParser(jfile.getInputStream(entry), entry.getName()).parse();
DependencyEmitter visitor = new DependencyEmitter(jclass);
DescendingVisitor classWalker = new DescendingVisitor(jclass, visitor);
classWalker.visit();
HashCode hash = ByteStreams.hash(new InputSupplier<InputStream>() {
public InputStream getInput() throws IOException {
return jfile.getInputStream(entry);
}
}, Hashing.sha1());
visitor.deps.remove(jclass.getClassName());
ClassMetadata classInfo = new ClassMetadata(hash.toString(), jclass.getClassName(), visitor.deps);
list.add(classInfo);
}
}
HashCode jarHash = ByteStreams.hash(new InputSupplier<InputStream>() {
public InputStream getInput() throws IOException {
return new FileInputStream(jarFile);
}
}, Hashing.sha1());
return new JarMetadata(jarFile.getName(), jarHash.toString(), list);
}
开发者ID:keith-turner,项目名称:jinex,代码行数:42,代码来源:Parser.java
示例9: field_and_method_refs_are_valid
import org.apache.bcel.classfile.DescendingVisitor; //导入依赖的package包/类
/**
* Ensures that the ConstantCP-subclassed entries of the constant
* pool are valid. According to "Yellin: Low Level Security in Java",
* this method does not verify the existence of referenced entities
* (such as classes) but only the formal correctness (such as well-formed
* signatures).
* The visitXXX() methods throw ClassConstraintException instances otherwise.
* <B>Precondition: index-style cross referencing in the constant
* pool must be valid. Simply invoke constant_pool_entries_satisfy_static_constraints()
* before.</B>
*
* @throws ClassConstraintException otherwise.
* @see #constant_pool_entries_satisfy_static_constraints()
*/
private void field_and_method_refs_are_valid(){
try {
JavaClass jc = Repository.lookupClass(myOwner.getClassName());
DescendingVisitor v = new DescendingVisitor(jc, new FAMRAV_Visitor(jc));
v.visit();
} catch (ClassNotFoundException e) {
// FIXME: this might not be the best way to handle missing classes.
throw new AssertionViolatedException("Missing class: " + e.toString());
}
}
开发者ID:Hu6,项目名称:VestaClient,代码行数:26,代码来源:Pass2Verifier.java
示例10: resolve
import org.apache.bcel.classfile.DescendingVisitor; //导入依赖的package包/类
@Override
public Set<ClassName> resolve(ClassFile classFile) throws IOException {
eventBus.post(new ClassDependencyResolutionStartEvent("resolving: " + classFile.physicalFile().getAbsolutePath(), this.getClass()));
final JavaClass javaClass = new ClassParser(classFile.toString()).parse();
final DependencyVisitor dependencyVisitor = new DependencyVisitor(javaClass);
final DescendingVisitor classWalker = new DescendingVisitor(javaClass, dependencyVisitor);
classWalker.visit();
eventBus.post(new ClassDependencyResolutionEndEvent("resolved: " + dependencyVisitor.getFoundDependencies(), this.getClass()));
return dependencyVisitor.getFoundDependencies();
}
开发者ID:ayld,项目名称:Facade,代码行数:16,代码来源:ManualBinaryParseClassDependencyResolver.java
注:本文中的org.apache.bcel.classfile.DescendingVisitor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论