< prev index next >
src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELifier.java
Print this page
@@ -44,11 +44,10 @@
* Java program that creates that very class using BCEL. This
* gives new users of BCEL a useful example showing how things
* are done with BCEL. It does not cover all features of BCEL,
* but tries to mimic hand-written code as close as possible.
*
- * @version $Id$
*/
public class BCELifier extends com.sun.org.apache.bcel.internal.classfile.EmptyVisitor {
/**
* Enum corresponding to flag source.
@@ -111,10 +110,12 @@
_out.println(" _cg = new ClassGen(\""
+ (("".equals(package_name)) ? class_name : package_name + "." + class_name)
+ "\", \"" + super_name + "\", " + "\"" + clazz.getSourceFileName() + "\", "
+ printFlags(clazz.getAccessFlags(), FLAGS.CLASS) + ", "
+ "new String[] { " + inter + " });");
+ _out.println(" _cg.setMajor(" + clazz.getMajor() +");");
+ _out.println(" _cg.setMinor(" + clazz.getMinor() +");");
_out.println();
_out.println(" _cp = _cg.getConstantPool();");
_out.println(" _factory = new InstructionFactory(_cg, _cp);");
_out.println(" }");
_out.println();
@@ -214,11 +215,11 @@
public static String printFlags( final int flags, final FLAGS location ) {
if (flags == 0) {
return "0";
}
final StringBuilder buf = new StringBuilder();
- for (int i = 0, pow = 1; pow <= Const.MAX_ACC_FLAG; i++) {
+ for (int i = 0, pow = 1; pow <= Const.MAX_ACC_FLAG_I; i++) {
if ((flags & pow) != 0) {
if ((pow == Const.ACC_SYNCHRONIZED) && (location == FLAGS.CLASS)) {
buf.append(CONSTANT_PREFIX+"ACC_SUPER | ");
} else if ((pow == Const.ACC_VOLATILE) && (location == FLAGS.METHOD)) {
buf.append(CONSTANT_PREFIX+"ACC_BRIDGE | ");
< prev index next >