com.sun.enterprise.tools.verifier.apiscan.classfile
Class BCELClosureCompilerImpl

java.lang.Object
  extended by com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImplBase
      extended by com.sun.enterprise.tools.verifier.apiscan.classfile.BCELClosureCompilerImpl
All Implemented Interfaces:
ClosureCompiler

public class BCELClosureCompilerImpl
extends ClosureCompilerImplBase

An implementation of ClosureCompilerImplBase based on BCEL.

Author:
Sanjeeb.Sahoo@Sun.COM

Field Summary
 
Fields inherited from class com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImplBase
excludedClasses, excludedPackages, excludedPatterns, loader, logger, visitedClasses
 
Constructor Summary
BCELClosureCompilerImpl(ClassFileLoader loader)
           
 
Method Summary
 boolean buildClosure(String className)
           
 Collection getClosure()
           
 Map getFailed()
           
 Collection<String> getNativeMethods()
           
 void reset()
          Reset the closure for next closure computation.
 String toString()
           
 
Methods inherited from class com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImplBase
addExcludedClass, addExcludedPackage, addExcludedPattern, buildClosure, getPackageName, needToBuildClosure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BCELClosureCompilerImpl

public BCELClosureCompilerImpl(ClassFileLoader loader)
Parameters:
loader - the ClassFileLoader that is used to load the referenced classes.
Method Detail

buildClosure

public boolean buildClosure(String className)
Parameters:
className - class name (in external format) whose closure will be computed.
Returns:
true if it can compute the closure for all the classes that are new to it, else false. In other words, this operation is not idempotent. e.g. ClosureCompiler cc; cc.reset(); boolean first=cc.buildClosure("a.B"); boolean second=cc.buildClosure("a.B"); second will always be true irrespective of value of first. This is because it uses list of classes that it has already visited. That list gets cleared when ClosureCompiler.reset() is called).

getClosure

public Collection getClosure()
Returns:
unmodifiable collection of class names which it visited during closure computation. e.g. Let's say a.class references b1.class and b2.class. b1.class references c1.class, c2.class and c3.class b2.class references d1.class, d2.class and d3.class. c1/c2/d1/d2.class are all not loadable where as c3 and d3.class are loadable. When we build the closure of a.class, closure will contain the following... {"a", "b1", "b2", "c3", "d3"}

getFailed

public Map getFailed()
Returns:
unmodifiable collection of class names whose closure could not be computed. The typical reason for not able to build closure for a class is that class not being found in loader's search path. See it returns a map which is keyed by the access path and the value is a list of class names which could not be loaded. e.g. Let's say a.class references b1.class and b2.class. b1.class references c1.class, c2.class and c3.class b2.class references d1.class, d2.class and d3.class. c1/c2/d1/d2.class are all not loadable where as c3 and d3.class are loadable. When we build the closure of a.class, failed map will contain the following... {("a:b1", {"c1","c2"}), ("a.b2", {"d1","d2"})}

reset

public void reset()
Reset the closure for next closure computation. Clear the internal cache. It includes the result it has collected since last reset(). But it does not clear the excludedd list. If you want to reset the excluded list, create a new ClosureCompiler.


getNativeMethods

public Collection<String> getNativeMethods()
Overrides:
getNativeMethods in class ClosureCompilerImplBase

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 Oracle Corporation. All Rights Reserved.