@@ -1,3 +1,4 @@ | |||||
module dummy { | module dummy { | ||||
requires java.base; | requires java.base; | ||||
exports org.dummy; | |||||
} | } |
@@ -15,6 +15,8 @@ See the License for the specific language governing permissions and | |||||
limitations under the License. | limitations under the License. | ||||
*/ | */ | ||||
package org.dummy; | |||||
public class Foo { | public class Foo { | ||||
public static void main(final String[] args) { | public static void main(final String[] args) { | ||||
System.out.println("foo"); | System.out.println("foo"); |
@@ -74,6 +74,10 @@ public abstract class ConstantPoolEntry { | |||||
/** Tag value for CONSTANT_Module_info entry */ | /** Tag value for CONSTANT_Module_info entry */ | ||||
public static final int CONSTANT_MODULEINFO = 19; | public static final int CONSTANT_MODULEINFO = 19; | ||||
/** Tag value for CONSTANT_Package_info entry (within a module) */ | |||||
public static final int CONSTANT_PACKAGEINFO = 20; | |||||
/** | /** | ||||
* This entry's tag which identifies the type of this constant pool | * This entry's tag which identifies the type of this constant pool | ||||
* entry. | * entry. | ||||
@@ -168,6 +172,9 @@ public abstract class ConstantPoolEntry { | |||||
case CONSTANT_MODULEINFO: | case CONSTANT_MODULEINFO: | ||||
cpInfo = new ModuleCPInfo(); | cpInfo = new ModuleCPInfo(); | ||||
break; | break; | ||||
case CONSTANT_PACKAGEINFO: | |||||
cpInfo = new PackageCPInfo(); | |||||
break; | |||||
default: | default: | ||||
throw new ClassFormatError("Invalid Constant Pool entry Type " | throw new ClassFormatError("Invalid Constant Pool entry Type " | ||||
+ cpTag); | + cpTag); | ||||
@@ -0,0 +1,34 @@ | |||||
package org.apache.tools.ant.taskdefs.optional.depend.constantpool; | |||||
import java.io.DataInputStream; | |||||
import java.io.IOException; | |||||
/** | |||||
* Represents the package info (within a module) constant pool entry | |||||
*/ | |||||
public class PackageCPInfo extends ConstantCPInfo { | |||||
private int packageNameIndex; | |||||
private String packageName; | |||||
public PackageCPInfo() { | |||||
super(CONSTANT_PACKAGEINFO, 1); | |||||
} | |||||
@Override | |||||
public void read(final DataInputStream cpStream) throws IOException { | |||||
this.packageNameIndex = cpStream.readUnsignedShort(); | |||||
} | |||||
@Override | |||||
public void resolve(final ConstantPool constantPool) { | |||||
this.packageName = ((Utf8CPInfo) constantPool.getEntry(this.packageNameIndex)).getValue(); | |||||
super.resolve(constantPool); | |||||
} | |||||
@Override | |||||
public String toString() { | |||||
return "Package info Constant Pool Entry for " + this.packageName + "[" + this.packageNameIndex + "]"; | |||||
} | |||||
} |