aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder/src
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2017-09-20 16:16:48 -0700
committerAndy Clement <aclement@pivotal.io>2017-09-20 16:16:48 -0700
commit951295ab099c5243640d4b349403289578ea5a1b (patch)
treede24b36c609cab36ac3479427c7a896ae8210603 /bcel-builder/src
parentd159d8d96ba83edca8ca7aefdd1ad785912f9164 (diff)
downloadaspectj-951295ab099c5243640d4b349403289578ea5a1b.tar.gz
aspectj-951295ab099c5243640d4b349403289578ea5a1b.zip
Upgrading bcel to latest J9 attributes
Diffstat (limited to 'bcel-builder/src')
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/Constants.java33
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/Attribute.java6
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassParser.java1
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassVisitor.java9
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/Constant.java2
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantModule.java111
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantPackage.java111
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantPool.java22
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/Module.java357
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/ModuleMainClass.java106
-rw-r--r--bcel-builder/src/org/aspectj/apache/bcel/classfile/ModulePackages.java126
11 files changed, 812 insertions, 72 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/Constants.java b/bcel-builder/src/org/aspectj/apache/bcel/Constants.java
index 8d8427006..41d75a7cf 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/Constants.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/Constants.java
@@ -114,10 +114,19 @@ public interface Constants {
public final static short ACC_BRIDGE = 0x0040;
public final static short ACC_VARARGS = 0x0080;
- // module related
- public final static int MODULE_ACC_PUBLIC = 0x0020;
- public final static int MODULE_ACC_SYNTHETIC = 0x1000;
- public final static int MODULE_ACC_MANDATED = 0x8000;
+ // Module related
+ // Indicates that any module which depends on the current module,
+ // implicitly declares a dependence on the module indicated by this entry.
+ public final static int MODULE_ACC_TRANSITIVE = 0x0020;
+ // Indicates that this dependence is mandatory in the static phase, i.e., at
+ // compile time, but is optional in the dynamic phase, i.e., at run time.
+ public final static int MODULE_ACC_STATIC_PHASE = 0x0040;
+ // Indicates that this dependence was not explicitly or implicitly declared
+ // in the source of the module declaration.
+ public final static int MODULE_ACC_SYNTHETIC = 0x1000;
+ // Indicates that this dependence was implicitly declared in the source of
+ // the module declaration
+ public final static int MODULE_ACC_MANDATED = 0x8000;
// Applies to classes compiled by new compilers only
public final static short ACC_SUPER = 0x0020;
@@ -143,6 +152,11 @@ public interface Constants {
public final static byte CONSTANT_MethodHandle = 15;
public final static byte CONSTANT_MethodType = 16;
public final static byte CONSTANT_InvokeDynamic = 18;
+
+ // Java 9
+ public final static byte CONSTANT_Module = 19;
+ public final static byte CONSTANT_Package = 20;
+
public final static String[] CONSTANT_NAMES = { "", "CONSTANT_Utf8", "", "CONSTANT_Integer", "CONSTANT_Float", "CONSTANT_Long",
"CONSTANT_Double", "CONSTANT_Class", "CONSTANT_String", "CONSTANT_Fieldref", "CONSTANT_Methodref",
@@ -624,8 +638,13 @@ public interface Constants {
public static final byte ATTR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = 20;
public static final byte ATTR_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = 21;
public static final byte ATTR_METHOD_PARAMETERS = 22;
-
- public static final short KNOWN_ATTRIBUTES = 23;
+
+ // J9:
+ public static final byte ATTR_MODULE = 23;
+ public static final byte ATTR_MODULE_PACKAGES = 24;
+ public static final byte ATTR_MODULE_MAIN_CLASS = 25;
+
+ public static final short KNOWN_ATTRIBUTES = 26;
public static final String[] ATTRIBUTE_NAMES = {
"SourceFile", "ConstantValue", "Code", "Exceptions", "LineNumberTable", "LocalVariableTable",
@@ -633,7 +652,7 @@ public interface Constants {
"RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations", "RuntimeVisibleParameterAnnotations",
"RuntimeInvisibleParameterAnnotations", "LocalVariableTypeTable", "EnclosingMethod",
"AnnotationDefault","BootstrapMethods", "RuntimeVisibleTypeAnnotations", "RuntimeInvisibleTypeAnnotations",
- "MethodParameters"
+ "MethodParameters", "Module", "ModulePackages", "ModuleMainClass"
};
/**
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/Attribute.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/Attribute.java
index 34ed08f5e..edc8d22c9 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/Attribute.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/Attribute.java
@@ -167,6 +167,12 @@ public abstract class Attribute implements Cloneable, Node, Serializable {
return new RuntimeInvisTypeAnnos(idx, len, file, cpool);
case Constants.ATTR_METHOD_PARAMETERS:
return new MethodParameters(idx, len, file, cpool);
+ case Constants.ATTR_MODULE:
+ return new Module(idx, len, file, cpool);
+ case Constants.ATTR_MODULE_PACKAGES:
+ return new ModulePackages(idx, len, file, cpool);
+ case Constants.ATTR_MODULE_MAIN_CLASS:
+ return new ModuleMainClass(idx, len, file, cpool);
default:
throw new IllegalStateException();
}
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassParser.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassParser.java
index f7e794c8c..54882beee 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassParser.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassParser.java
@@ -180,7 +180,6 @@ public final class ClassParser {
superclassnameIndex = file.readUnsignedShort();
}
- /** Read constant pool entries */
private final void readConstantPool() throws IOException {
try {
cpool = new ConstantPool(file);
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassVisitor.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassVisitor.java
index f72da47ee..0a9340649 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassVisitor.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ClassVisitor.java
@@ -103,6 +103,10 @@ public interface ClassVisitor {
public void visitConstantString(ConstantString obj);
+ public void visitConstantModule(ConstantModule obj);
+
+ public void visitConstantPackage(ConstantPackage obj);
+
public void visitConstantUtf8(ConstantUtf8 obj);
public void visitConstantValue(ConstantValue obj);
@@ -163,5 +167,8 @@ public interface ClassVisitor {
public void visitMethodParameters(MethodParameters methodParameters);
- public void visitModule(Module m);
+ // J9:
+ public void visitModule(Module module);
+ public void visitModulePackages(ModulePackages modulePackage);
+ public void visitModuleMainClass(ModuleMainClass moduleMainClass);
}
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/Constant.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/Constant.java
index 2110bdc08..6fbbff3a3 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/Constant.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/Constant.java
@@ -135,6 +135,8 @@ public abstract class Constant implements Cloneable, Node {
return new ConstantMethodType(dis);
case Constants.CONSTANT_InvokeDynamic:
return new ConstantInvokeDynamic(dis);
+ case Constants.CONSTANT_Module: return new ConstantModule(dis);
+ case Constants.CONSTANT_Package: return new ConstantPackage(dis);
default:
throw new ClassFormatException("Invalid byte tag in constant pool: " + b);
}
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantModule.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantModule.java
new file mode 100644
index 000000000..efe4d3a1b
--- /dev/null
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantModule.java
@@ -0,0 +1,111 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2017 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache BCEL" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache BCEL", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.aspectj.apache.bcel.classfile;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.aspectj.apache.bcel.Constants;
+
+/**
+ * Represents a module.
+ *
+ * See http://cr.openjdk.java.net/~mr/jigsaw/spec/java-se-9-jvms-diffs.pdf 4.4.11
+ *
+ * @author Andy Clement
+ */
+public final class ConstantModule extends Constant {
+
+ private int nameIndex;
+
+ ConstantModule(DataInputStream file) throws IOException {
+ this(file.readUnsignedShort());
+ }
+
+ public ConstantModule(int nameIndex) {
+ super(Constants.CONSTANT_Module);
+ this.nameIndex = nameIndex;
+ }
+
+ @Override
+ public void accept(ClassVisitor v) {
+ v.visitConstantModule(this);
+ }
+
+ @Override
+ public final void dump(DataOutputStream file) throws IOException {
+ file.writeByte(tag);
+ file.writeShort(nameIndex);
+ }
+
+ @Override
+ public Integer getValue() {
+ return nameIndex;
+ }
+
+ public final int getNameIndex() {
+ return nameIndex;
+ }
+
+ @Override
+ public final String toString() {
+ return super.toString() + "(name_index = " + nameIndex + ")";
+ }
+
+ public String getModuleName(ConstantPool cpool) {
+ Constant c = cpool.getConstant(nameIndex, Constants.CONSTANT_Utf8);
+ return ((ConstantUtf8) c).getValue();
+ }
+}
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantPackage.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantPackage.java
new file mode 100644
index 000000000..70f22c749
--- /dev/null
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantPackage.java
@@ -0,0 +1,111 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2017 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache BCEL" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache BCEL", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.aspectj.apache.bcel.classfile;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.aspectj.apache.bcel.Constants;
+
+/**
+ * Represents a module.
+ *
+ * See http://cr.openjdk.java.net/~mr/jigsaw/spec/java-se-9-jvms-diffs.pdf 4.4.12
+ *
+ * @author Andy Clement
+ */
+public final class ConstantPackage extends Constant {
+
+ private int nameIndex;
+
+ ConstantPackage(DataInputStream file) throws IOException {
+ this(file.readUnsignedShort());
+ }
+
+ public ConstantPackage(int nameIndex) {
+ super(Constants.CONSTANT_Package);
+ this.nameIndex = nameIndex;
+ }
+
+ @Override
+ public void accept(ClassVisitor v) {
+ v.visitConstantPackage(this);
+ }
+
+ @Override
+ public final void dump(DataOutputStream file) throws IOException {
+ file.writeByte(tag);
+ file.writeShort(nameIndex);
+ }
+
+ @Override
+ public Integer getValue() {
+ return nameIndex;
+ }
+
+ public final int getNameIndex() {
+ return nameIndex;
+ }
+
+ @Override
+ public final String toString() {
+ return super.toString() + "(name_index = " + nameIndex + ")";
+ }
+
+ public String getPackageName(ConstantPool cpool) {
+ Constant c = cpool.getConstant(nameIndex, Constants.CONSTANT_Utf8);
+ return ((ConstantUtf8) c).getValue();
+ }
+}
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantPool.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantPool.java
index 4e160ba3d..be5b84564 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantPool.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantPool.java
@@ -275,6 +275,20 @@ public class ConstantPool implements Node {
assert c.tag == Constants.CONSTANT_Utf8;
return (ConstantUtf8) c;
}
+
+ public ConstantModule getConstantModule(int index) {
+ Constant c = getConstant(index);
+ assert c != null;
+ assert c.tag == Constants.CONSTANT_Module;
+ return (ConstantModule)c;
+ }
+
+ public ConstantPackage getConstantPackage(int index) {
+ Constant c = getConstant(index);
+ assert c != null;
+ assert c.tag == Constants.CONSTANT_Package;
+ return (ConstantPackage)c;
+ }
public String getConstantString_CONSTANTClass(int index) {
ConstantClass c = (ConstantClass) getConstant(index, Constants.CONSTANT_Class);
@@ -770,4 +784,12 @@ public class ConstantPool implements Node {
System.arraycopy(pool, 0, cs, 0, poolSize);
return new ConstantPool(cs);
}
+
+ public String getModuleName(int moduleIndex) {
+ return getConstantModule(moduleIndex).getModuleName(this);
+ }
+
+ public String getPackageName(int packageIndex) {
+ return getConstantPackage(packageIndex).getPackageName(this);
+ }
} \ No newline at end of file
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/Module.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/Module.java
index 3041add34..5eef18cde 100644
--- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/Module.java
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/Module.java
@@ -1,7 +1,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2016-17 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -53,18 +53,17 @@
*/
package org.aspectj.apache.bcel.classfile;
-import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.aspectj.apache.bcel.Constants;
-import org.aspectj.apache.bcel.classfile.Module.Export;
/**
* This class is derived from <em>Attribute</em> and represents the module
* information captured in a class file.
* http://cr.openjdk.java.net/~mr/jigsaw/spec/lang-vm.html
+ * http://cr.openjdk.java.net/~mr/jigsaw/spec/java-se-9-jvms-diffs.pdf 4.7.25
*
* @author Andy Clement
*/
@@ -72,89 +71,143 @@ public final class Module extends Attribute {
private static final String[] NO_MODULE_NAMES = {};
- private byte[] moduleInfo;
- private int ptr;
- private boolean unpacked = false;
+ private int moduleNameIndex; // u2 module_name_index
+ private int moduleFlags; // u2 module_flags
+ private int moduleVersionIndex; // u2 module_version_index
private Require[] requires;
private Export[] exports;
+ private Open[] opens;
private Uses[] uses;
private Provide[] provides;
- /**
- * Build a Module attribute from a previously Unknown attribute.
- */
- public Module(Unknown unknown) {
- super(unknown.getTag(), unknown.getNameIndex(), unknown.getLength(), unknown.getConstantPool());
- moduleInfo = unknown.getBytes();
- }
+ private byte[] moduleInfo;
+ private int ptr;
+ private boolean unpacked = false;
+ public Module(Module module) {
+ super(module.getTag(), module.getNameIndex(), module.getLength(), module.getConstantPool());
+ moduleInfo = module.getBytes();
+ }
+
+ public Module(int nameIndex, int length, byte[] data, ConstantPool cp) {
+ super(Constants.ATTR_MODULE, nameIndex, length, cp);
+ }
+
+ Module(int nameIndex, int length, DataInputStream stream, ConstantPool cp) throws IOException {
+ this(nameIndex, length, (byte[])null, cp);
+ moduleInfo = new byte[length];
+ stream.read(moduleInfo);
+ unpacked = false;
+ }
+
public class Require {
- private final int moduleNameIndex;
- private final int requiresFlags;
+ private final int moduleIndex;
+ private final int flags;
+ private final int versionIndex;
- public Require(int moduleNameIndex, int requiresFlags) {
- this.moduleNameIndex = moduleNameIndex;
- this.requiresFlags = requiresFlags;
+ public Require(int moduleIndex, int flags, int versionIndex) {
+ this.moduleIndex = moduleIndex;
+ this.flags = flags;
+ this.versionIndex = versionIndex;
}
public String getModuleName() {
- return cpool.getConstantUtf8(moduleNameIndex).getStringValue();
+ return cpool.getModuleName(moduleIndex);
+ }
+
+ public int getFlags() {
+ return flags;
}
- public int getRequiresFlags() {
- return requiresFlags;
+ public int getVersionIndex() {
+ return versionIndex;
+ }
+
+ public String getVersionString() {
+ if (versionIndex == 0) {
+ return null;
+ } else {
+ return cpool.getConstantUtf8(versionIndex).getValue();
+ }
}
- public String getRequiresFlagsAsString() {
+ public String getFlagsAsString() {
StringBuilder s = new StringBuilder();
- if ((requiresFlags & Constants.MODULE_ACC_PUBLIC)!=0) {
- s.append("public ");
+ if ((flags & Constants.MODULE_ACC_TRANSITIVE)!=0) {
+ s.append(" transitive");
+ }
+ if ((flags & Constants.MODULE_ACC_STATIC_PHASE)!=0) {
+ s.append(" static");
}
- if ((requiresFlags & Constants.MODULE_ACC_SYNTHETIC)!=0) {
- s.append("synthetic ");
+ if ((flags & Constants.MODULE_ACC_SYNTHETIC)!=0) {
+ s.append(" synthetic");
}
- if ((requiresFlags & Constants.MODULE_ACC_MANDATED)!=0) {
- s.append("mandated ");
+ if ((flags & Constants.MODULE_ACC_MANDATED)!=0) {
+ s.append(" mandated");
}
return s.toString();
}
public String toString() {
- return "requires "+getRequiresFlagsAsString()+getModuleName();
+ return "requires"+getFlagsAsString()+" "+getModuleName()+(versionIndex==0?"":" "+getVersionString());
}
-
}
public class Export {
- private final int exportedPackageNameIndex;
- private final int[] toModuleNameIndices;
+ private final int packageIndex;
+ private final int flags;
+ private final int[] toModuleIndices;
- public Export(int exportedPackageNameIndex, int[] toModuleNameIndices) {
- this.exportedPackageNameIndex = exportedPackageNameIndex;
- this.toModuleNameIndices = toModuleNameIndices;
+ public Export(int packageIndex, int flags, int[] toModuleIndices) {
+ this.packageIndex = packageIndex;
+ this.flags = flags;
+ this.toModuleIndices = toModuleIndices;
}
- public String getExportedPackage() {
- return cpool.getConstantUtf8(exportedPackageNameIndex).getStringValue();
+ public int getPackageIndex() {
+ return packageIndex;
+ }
+
+ public int getFlags() {
+ return flags;
+ }
+
+ public int[] getToModuleIndices() {
+ return toModuleIndices;
+ }
+
+ public String getPackage() {
+ return cpool.getPackageName(packageIndex);
+ }
+
+ public String getFlagsAsString() {
+ StringBuilder s = new StringBuilder();
+ if ((flags & Constants.MODULE_ACC_SYNTHETIC)!=0) {
+ s.append(" synthetic");
+ }
+ if ((flags & Constants.MODULE_ACC_MANDATED)!=0) {
+ s.append(" synthetic");
+ }
+ return s.toString();
}
public String[] getToModuleNames() {
- if (toModuleNameIndices==null) {
+ if (toModuleIndices==null) {
return NO_MODULE_NAMES;
}
- String[] toModuleNames = new String[toModuleNameIndices.length];
- for (int i=0;i<toModuleNameIndices.length;i++) {
- toModuleNames[i] = cpool.getConstantUtf8(toModuleNameIndices[i]).getStringValue();
+ String[] toModuleNames = new String[toModuleIndices.length];
+ for (int i=0;i<toModuleIndices.length;i++) {
+ toModuleNames[i] = cpool.getModuleName(toModuleIndices[i]);
}
return toModuleNames;
}
public String toString() {
StringBuilder s =new StringBuilder();
- s.append("exports ").append(getExportedPackage().replace('/', '.'));
+ s.append("exports").append(getFlagsAsString()).append(" ").append(getPackage().replace('/', '.'));
String[] toModules = getToModuleNames();
if (toModules.length!=0) {
s.append(" to ");
@@ -168,14 +221,82 @@ public final class Module extends Attribute {
return s.toString().trim();
}
}
+
+
+ public class Open {
+
+ private final int packageIndex;
+ private final int flags;
+ private final int[] toModuleIndices;
+
+ public Open(int packageIndex, int flags, int[] toModuleIndices) {
+ this.packageIndex = packageIndex;
+ this.flags = flags;
+ this.toModuleIndices = toModuleIndices;
+ }
+ public int getPackageIndex() {
+ return packageIndex;
+ }
+
+ public int getFlags() {
+ return flags;
+ }
+
+ public int[] getToModuleIndices() {
+ return toModuleIndices;
+ }
+
+ public String getPackage() {
+ return cpool.getPackageName(packageIndex);
+ }
+
+ public String getFlagsAsString() {
+ StringBuilder s = new StringBuilder();
+ if ((flags & Constants.MODULE_ACC_SYNTHETIC)!=0) {
+ s.append(" synthetic");
+ }
+ if ((flags & Constants.MODULE_ACC_MANDATED)!=0) {
+ s.append(" synthetic");
+ }
+ return s.toString();
+ }
+
+ public String[] getToModuleNames() {
+ if (toModuleIndices==null) {
+ return NO_MODULE_NAMES;
+ }
+ String[] toModuleNames = new String[toModuleIndices.length];
+ for (int i=0;i<toModuleIndices.length;i++) {
+ toModuleNames[i] = cpool.getModuleName(toModuleIndices[i]);
+ }
+ return toModuleNames;
+ }
+
+ public String toString() {
+ StringBuilder s =new StringBuilder();
+ s.append("opens").append(getFlagsAsString()).append(" ").append(getPackage().replace('/', '.'));
+ String[] toModules = getToModuleNames();
+ if (toModules.length!=0) {
+ s.append(" to ");
+ for (int i=0;i<toModules.length;i++) {
+ if (i>0) {
+ s.append(", ");
+ }
+ s.append(toModules[i]);
+ }
+ }
+ return s.toString().trim();
+ }
+ }
+
public class Provide {
private final int providedTypeIndex;
- private final int withTypeIndex;
+ private final int[] withTypeIndices;
- public Provide(int providedTypeIndex, int withTypeIndex) {
+ public Provide(int providedTypeIndex, int[] withTypeIndices) {
this.providedTypeIndex = providedTypeIndex;
- this.withTypeIndex = withTypeIndex;
+ this.withTypeIndices = withTypeIndices;
}
public String getProvidedType() {
@@ -186,18 +307,27 @@ public final class Module extends Attribute {
return providedTypeIndex;
}
- public String getWithType() {
- return cpool.getConstantString_CONSTANTClass(withTypeIndex);
+ public String[] getWithTypeStrings() {
+ String[] result = new String[withTypeIndices.length];
+ for (int i=0;i<withTypeIndices.length;i++) {
+ result[i] = cpool.getConstantString_CONSTANTClass(withTypeIndices[i]);
+ }
+ return result;
}
- public int getWithTypeIndex() {
- return withTypeIndex;
+ public int[] getWithTypeIndices() {
+ return withTypeIndices;
}
public String toString() {
StringBuilder s =new StringBuilder();
s.append("provides ").append(getProvidedType().replace('/', '.'));
- s.append(" with ").append(getWithType().replace('/','.'));
+ s.append(" with ");
+ String[] withtypes = getWithTypeStrings();
+ for (int i=0;i< withtypes.length;i++) {
+ if (i>0) s.append(",");
+ s.append(withtypes[i].replace('/','.'));
+ }
return s.toString();
}
}
@@ -237,24 +367,44 @@ public final class Module extends Attribute {
return ((moduleInfo[offset++] & 0xff) << 8) + (moduleInfo[offset] & 0xff);
}
+ // Format: http://cr.openjdk.java.net/~mr/jigsaw/spec/java-se-9-jvms-diffs.pdf 4.7.25
private void ensureUnpacked() {
if (!unpacked) {
ptr = 0;
+ moduleNameIndex = readUnsignedShort();
+ moduleFlags = readUnsignedShort();
+ moduleVersionIndex = readUnsignedShort();
+
int count = readUnsignedShort();
requires = new Require[count];
for (int i = 0; i < count; i++) {
- requires[i] = new Require(readUnsignedShort(), readUnsignedShort());
+ requires[i] = new Require(readUnsignedShort(), readUnsignedShort(), readUnsignedShort());
}
+
count = readUnsignedShort();
exports = new Export[count];
for (int i = 0; i < count; i++) {
int index = readUnsignedShort();
+ int flags = readUnsignedShort();
int toCount = readUnsignedShort();
int[] to = new int[toCount];
for (int j = 0; j < toCount; j++) {
to[j] = readUnsignedShort();
}
- exports[i] = new Export(index, to);
+ exports[i] = new Export(index, flags, to);
+ }
+
+ count = readUnsignedShort();
+ opens = new Open[count];
+ for (int i = 0; i < count; i++) {
+ int index = readUnsignedShort();
+ int flags = readUnsignedShort();
+ int toCount = readUnsignedShort();
+ int[] to = new int[toCount];
+ for (int j = 0; j < toCount; j++) {
+ to[j] = readUnsignedShort();
+ }
+ opens[i] = new Open(index, flags, to);
}
count = readUnsignedShort();
uses = new Uses[count];
@@ -264,7 +414,13 @@ public final class Module extends Attribute {
count = readUnsignedShort();
provides = new Provide[count];
for (int i = 0; i < count; i++) {
- provides[i] = new Provide(readUnsignedShort(), readUnsignedShort());
+ int index = readUnsignedShort();
+ int toCount = readUnsignedShort();
+ int[] to = new int[toCount];
+ for (int j = 0; j < toCount; j++) {
+ to[j] = readUnsignedShort();
+ }
+ provides[i] = new Provide(index, to);
}
unpacked = true;
}
@@ -276,15 +432,30 @@ public final class Module extends Attribute {
if (!unpacked) {
file.write(moduleInfo);
} else {
+
+ file.writeShort(moduleNameIndex);
+ file.writeShort(moduleFlags);
+ file.writeShort(moduleVersionIndex);
+
file.writeShort(requires.length);
for (int i = 0; i < requires.length; i++) {
- file.writeShort(requires[i].moduleNameIndex);
- file.writeShort(requires[i].requiresFlags);
+ file.writeShort(requires[i].moduleIndex);
+ file.writeShort(requires[i].flags);
+ file.writeShort(requires[i].versionIndex);
}
file.writeShort(exports.length);
for (Export export : exports) {
- file.writeShort(export.exportedPackageNameIndex);
- int[] toIndices = export.toModuleNameIndices;
+ file.writeShort(export.packageIndex);
+ int[] toIndices = export.toModuleIndices;
+ file.writeShort(toIndices.length);
+ for (int index : toIndices) {
+ file.writeShort(index);
+ }
+ }
+ file.writeShort(opens.length);
+ for (Open open : opens) {
+ file.writeShort(open.packageIndex);
+ int[] toIndices = open.toModuleIndices;
file.writeShort(toIndices.length);
for (int index : toIndices) {
file.writeShort(index);
@@ -297,7 +468,11 @@ public final class Module extends Attribute {
file.writeShort(provides.length);
for (Provide provide : provides) {
file.writeShort(provide.providedTypeIndex);
- file.writeShort(provide.withTypeIndex);
+ int[] toIndices = provide.withTypeIndices;
+ file.writeShort(toIndices.length);
+ for (int index : toIndices) {
+ file.writeShort(index);
+ }
}
}
}
@@ -308,7 +483,7 @@ public final class Module extends Attribute {
if (requires.length > 0) {
for (Require require : requires) {
s.append(' ');
- s.append(require.moduleNameIndex).append(':').append(require.requiresFlags);
+ s.append(require.moduleIndex).append(':').append(require.flags);
}
}
return s.toString();
@@ -320,8 +495,27 @@ public final class Module extends Attribute {
if (exports.length > 0) {
for (Export export : exports) {
s.append(' ');
- s.append(export.exportedPackageNameIndex).append(":[");
- int[] toIndices = export.toModuleNameIndices;
+ s.append(export.packageIndex).append(":[");
+ int[] toIndices = export.toModuleIndices;
+ for (int i = 0; i < toIndices.length; i++) {
+ if (i > 0)
+ s.append(',');
+ s.append(toIndices[i]);
+ }
+ s.append("]");
+ }
+ }
+ return s.toString();
+ }
+
+ public String toStringOpens() {
+ StringBuilder s = new StringBuilder();
+ s.append('#').append(opens.length);
+ if (opens.length > 0) {
+ for (Open open : opens) {
+ s.append(' ');
+ s.append(open.packageIndex).append(":[");
+ int[] toIndices = open.toModuleIndices;
for (int i = 0; i < toIndices.length; i++) {
if (i > 0)
s.append(',');
@@ -351,7 +545,14 @@ public final class Module extends Attribute {
if (provides.length > 0) {
for (Provide provide : provides) {
s.append(' ');
- s.append(provide.providedTypeIndex).append(':').append(provide.withTypeIndex);
+ s.append(provide.providedTypeIndex).append(":[");
+ int[] indices = provide.withTypeIndices;
+ for (int i = 0; i < indices.length; i++) {
+ if (i > 0)
+ s.append(',');
+ s.append(indices[i]);
+ }
+ s.append("]");
}
}
return s.toString();
@@ -372,6 +573,11 @@ public final class Module extends Attribute {
s.append(toStringExports());
s.append(" ");
}
+ if (opens.length != 0) {
+ s.append("opens=");
+ s.append(toStringOpens());
+ s.append(" ");
+ }
if (uses.length != 0) {
s.append("uses=");
s.append(toStringUses());
@@ -407,7 +613,7 @@ public final class Module extends Attribute {
ensureUnpacked();
String[] results = new String[requires.length];
for (int i=0;i<requires.length;i++) {
- results[i] = cpool.getConstantUtf8(requires[i].moduleNameIndex).getStringValue();
+ results[i] = cpool.getModuleName(requires[i].moduleIndex);
}
return results;
}
@@ -420,6 +626,11 @@ public final class Module extends Attribute {
ensureUnpacked();
return exports;
}
+
+ public Open[] getOpens() {
+ ensureUnpacked();
+ return opens;
+ }
public Uses[] getUses() {
ensureUnpacked();
@@ -430,4 +641,24 @@ public final class Module extends Attribute {
ensureUnpacked();
return provides;
}
+
+ public String getModuleName() {
+ return ((ConstantModule)cpool.getConstant(moduleNameIndex)).getModuleName(cpool);
+ }
+
+ public int getModuleFlags() {
+ // 0x0020 (ACC_OPEN) - Indicates that this module is open.
+ // 0x1000 (ACC_SYNTHETIC) - Indicates that this module was not explicitly or implicitly declared.
+ // 0x8000 (ACC_MANDATED) - Indicates that this module was implicitly declared
+ return moduleFlags;
+ }
+
+ /** @return the module version or null if no version information specified */
+ public String getModuleVersion() {
+ if (moduleVersionIndex == 0) {
+ return null;
+ } else {
+ return cpool.getConstantUtf8(moduleVersionIndex).getValue();
+ }
+ }
}
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ModuleMainClass.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ModuleMainClass.java
new file mode 100644
index 000000000..3fa500a8e
--- /dev/null
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ModuleMainClass.java
@@ -0,0 +1,106 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2017 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache BCEL" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache BCEL", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.aspectj.apache.bcel.classfile;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.aspectj.apache.bcel.Constants;
+
+/**
+ * Indicates the main class of a module.
+ * http://cr.openjdk.java.net/~mr/jigsaw/spec/java-se-9-jvms-diffs.pdf 4.7.26
+ *
+ * @author Andy Clement
+ */
+public final class ModuleMainClass extends Attribute {
+
+ private int mainClassIndex;
+
+ public ModuleMainClass(ModuleMainClass c) {
+ this(c.getNameIndex(), c.getLength(), c.getMainClassIndex(), c.getConstantPool());
+ }
+
+ public ModuleMainClass(int nameIndex, int length, int mainClassIndex, ConstantPool cp) {
+ super(Constants.ATTR_MODULE_MAIN_CLASS, nameIndex, length, cp);
+ this.mainClassIndex = mainClassIndex;
+ }
+
+ ModuleMainClass(int nameIndex, int length, DataInputStream stream, ConstantPool cp) throws IOException {
+ this(nameIndex, length, 0, cp);
+ this.mainClassIndex = stream.readUnsignedShort();
+ }
+
+ @Override
+ public void accept(ClassVisitor v) {
+ v.visitModuleMainClass(this);
+ }
+
+ @Override
+ public final void dump(DataOutputStream stream) throws IOException {
+ super.dump(stream);
+ stream.writeShort(mainClassIndex);
+ }
+
+ public final int getMainClassIndex() {
+ return mainClassIndex;
+ }
+
+ @Override
+ public final String toString() {
+ return cpool.getConstantString_CONSTANTClass(mainClassIndex);
+ }
+
+}
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/ModulePackages.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ModulePackages.java
new file mode 100644
index 000000000..37da4bc47
--- /dev/null
+++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/ModulePackages.java
@@ -0,0 +1,126 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2017 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache BCEL" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache BCEL", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.aspectj.apache.bcel.classfile;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.aspectj.apache.bcel.Constants;
+
+/**
+ * Indicates all the packages of a module that are exported or opened by the module attribute.
+ * http://cr.openjdk.java.net/~mr/jigsaw/spec/java-se-9-jvms-diffs.pdf 4.7.26
+ *
+ * @author Andy Clement
+ */
+public final class ModulePackages extends Attribute {
+
+ private static int[] NO_PACKAGES = new int[0];
+ private int[] packageIndices;
+
+ public ModulePackages(ModulePackages c) {
+ this(c.getNameIndex(), c.getLength(), c.getPackageIndices(), c.getConstantPool());
+ }
+
+ public ModulePackages(int nameIndex, int length, int[] packageIndices, ConstantPool cp) {
+ super(Constants.ATTR_MODULE_PACKAGES, nameIndex, length, cp);
+ setPackageIndices(packageIndices);
+ }
+
+ ModulePackages(int nameIndex, int length, DataInputStream stream, ConstantPool cp) throws IOException {
+ this(nameIndex, length, (int[]) null, cp);
+ int packageIndicesCount = stream.readUnsignedShort();
+ packageIndices = new int[packageIndicesCount];
+ for (int i = 0; i < packageIndicesCount; i++) {
+ packageIndices[i] = stream.readUnsignedShort();
+ }
+ }
+
+ @Override
+ public void accept(ClassVisitor v) {
+ v.visitModulePackages(this);
+ }
+
+ @Override
+ public final void dump(DataOutputStream stream) throws IOException {
+ super.dump(stream);
+ stream.writeShort(packageIndices.length);
+ for (int i = 0; i < packageIndices.length; i++) {
+ stream.writeShort(packageIndices[i]);
+ }
+ }
+
+ public final int[] getPackageIndices() {
+ return packageIndices;
+ }
+
+ public final void setPackageIndices(int[] packageIndices) {
+ if (packageIndices == null) {
+ this.packageIndices = NO_PACKAGES;
+ } else {
+ this.packageIndices = packageIndices;
+ }
+ }
+
+ @Override
+ public final String toString() {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < packageIndices.length; i++) {
+ buf.append(cpool.getPackageName(packageIndices[i]) + "\n");
+ }
+ return buf.toString();
+ }
+
+}