This commit is contained in:
Alan Bateman 2017-05-04 09:43:12 +01:00
commit a737285fbf
3 changed files with 8 additions and 25 deletions

View File

@ -616,8 +616,7 @@ public class ClassWriter {
@Override
public Void visitModuleTarget(ModuleTarget_attribute attr, ClassOutputStream out) {
out.writeShort(attr.os_name_index);
out.writeShort(attr.os_arch_index);
out.writeShort(attr.target_platform_index);
return null;
}

View File

@ -38,8 +38,7 @@ import java.io.IOException;
public class ModuleTarget_attribute extends Attribute {
ModuleTarget_attribute(ClassReader cr, int name_index, int length) throws IOException {
super(name_index, length);
os_name_index = cr.readUnsignedShort();
os_arch_index = cr.readUnsignedShort();
target_platform_index = cr.readUnsignedShort();
}
@Override
@ -47,6 +46,5 @@ public class ModuleTarget_attribute extends Attribute {
return visitor.visitModuleTarget(this, data);
}
public final int os_name_index;
public final int os_arch_index;
public final int target_platform_index;
}

View File

@ -668,33 +668,19 @@ public class AttributeWriter extends BasicWriter
public Void visitModuleTarget(ModuleTarget_attribute attr, Void ignore) {
println("ModuleTarget:");
indent(+1);
print("os_name: #" + attr.os_name_index);
if (attr.os_name_index != 0) {
print("target_platform: #" + attr.target_platform_index);
if (attr.target_platform_index != 0) {
tab();
print("// " + getOSName(attr));
}
println();
print("os_arch: #" + attr.os_arch_index);
if (attr.os_arch_index != 0) {
tab();
print("// " + getOSArch(attr));
print("// " + getTargetPlatform(attr));
}
println();
indent(-1);
return null;
}
private String getOSName(ModuleTarget_attribute attr) {
private String getTargetPlatform(ModuleTarget_attribute attr) {
try {
return constant_pool.getUTF8Value(attr.os_name_index);
} catch (ConstantPoolException e) {
return report(e);
}
}
private String getOSArch(ModuleTarget_attribute attr) {
try {
return constant_pool.getUTF8Value(attr.os_arch_index);
return constant_pool.getUTF8Value(attr.target_platform_index);
} catch (ConstantPoolException e) {
return report(e);
}