Update to support new attributes: NestHost, NestMembers, contributed by: leonid.kuskov@oracle.com
This commit is contained in:
parent
ec2319539d
commit
c78c7b312c
@ -1,3 +1,4 @@
|
|||||||
|
re:data
|
||||||
re:data/.*
|
re:data/.*
|
||||||
re:asmtools-6.0-build/.*
|
re:asmtools-6.0-build/.*
|
||||||
re:.*~$
|
re:.*~$
|
||||||
|
@ -44,8 +44,8 @@ public class CFVersion implements Cloneable{
|
|||||||
minor_version = UNDEFINED_VERSION;
|
minor_version = UNDEFINED_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CFVersion(short major_version, short minor_version) {
|
public CFVersion(boolean frozenCFV, short major_version, short minor_version) {
|
||||||
frozen = true;
|
frozen = frozenCFV;
|
||||||
this.major_version = major_version;
|
this.major_version = major_version;
|
||||||
this.minor_version = minor_version;
|
this.minor_version = minor_version;
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,7 @@ public class Main {
|
|||||||
*/
|
*/
|
||||||
private synchronized boolean parseArgs(String argv[]) {
|
private synchronized boolean parseArgs(String argv[]) {
|
||||||
// Parse arguments
|
// Parse arguments
|
||||||
|
boolean frozenCFV = false;
|
||||||
for (int i = 0; i < argv.length; i++) {
|
for (int i = 0; i < argv.length; i++) {
|
||||||
String arg = argv[i];
|
String arg = argv[i];
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
@ -180,6 +181,10 @@ public class Main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "-fixcv":
|
||||||
|
// overrides cf version if it's defined in the source file.
|
||||||
|
frozenCFV = true;
|
||||||
|
// public options
|
||||||
case "-cv":
|
case "-cv":
|
||||||
if ((i + 1) >= argv.length) {
|
if ((i + 1) >= argv.length) {
|
||||||
error(i18n.getString("jasm.error.cv_requires_arg"));
|
error(i18n.getString("jasm.error.cv_requires_arg"));
|
||||||
@ -198,7 +203,7 @@ public class Main {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
cfv = new CFVersion(Short.parseShort(versions[0]), Short.parseShort(versions[1]) );
|
cfv = new CFVersion(frozenCFV, Short.parseShort(versions[0]), Short.parseShort(versions[1]) );
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
error(i18n.getString("jasm.error.invalid_major_minor_param"));
|
error(i18n.getString("jasm.error.invalid_major_minor_param"));
|
||||||
usage();
|
usage();
|
||||||
|
@ -188,7 +188,7 @@ public class Tables {
|
|||||||
// Constant for ME Spec (StackMap does not appear in SE VM Spec)
|
// Constant for ME Spec (StackMap does not appear in SE VM Spec)
|
||||||
ATT_Unrecognized (0, "ATT_Unrecognized", ""),
|
ATT_Unrecognized (0, "ATT_Unrecognized", ""),
|
||||||
ATT_StackMap (1, "ATT_StackMap", "StackMap"),
|
ATT_StackMap (1, "ATT_StackMap", "StackMap"),
|
||||||
// Numbers corespond to VM spec (chapter 4.7.X)
|
// Numbers corespond to VM spec (chapter 4.7.X)
|
||||||
ATT_ConstantValue (2, "ATT_ConstantValue", "ConstantValue"),
|
ATT_ConstantValue (2, "ATT_ConstantValue", "ConstantValue"),
|
||||||
ATT_Code (3, "ATT_Code", "Code"),
|
ATT_Code (3, "ATT_Code", "Code"),
|
||||||
ATT_StackMapTable (4, "ATT_StackMapTable", "StackMapTable"),
|
ATT_StackMapTable (4, "ATT_StackMapTable", "StackMapTable"),
|
||||||
@ -218,7 +218,10 @@ public class Tables {
|
|||||||
ATT_MainClass (28, "ATT_MainClass", "MainClass"),
|
ATT_MainClass (28, "ATT_MainClass", "MainClass"),
|
||||||
ATT_ModulePackages (29, "ATT_ModulePackages", "ModulePackages"),
|
ATT_ModulePackages (29, "ATT_ModulePackages", "ModulePackages"),
|
||||||
ATT_ModuleMainClass (30, "ATT_ModuleMainClass", "ModuleMainClass"),
|
ATT_ModuleMainClass (30, "ATT_ModuleMainClass", "ModuleMainClass"),
|
||||||
ATT_ModuleTarget (31, "ATT_ModuleTarget", "ModuleTarget");
|
ATT_ModuleTarget (31, "ATT_ModuleTarget", "ModuleTarget"),
|
||||||
|
// JEP 181: class file 55.0
|
||||||
|
ATT_NestHost (32, "ATT_NestHost", "NestHost"),
|
||||||
|
ATT_NestMembers (33, "ATT_NestMembers", "NestMembers");
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String printval;
|
private final String printval;
|
||||||
|
@ -355,7 +355,7 @@ class ClassData {
|
|||||||
if (printDetails) {
|
if (printDetails) {
|
||||||
out_println(" at " + toHex(pos));
|
out_println(" at " + toHex(pos));
|
||||||
} else {
|
} else {
|
||||||
out_println("");
|
out.println();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -928,6 +928,21 @@ class ClassData {
|
|||||||
out_end("}");
|
out_end("}");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
// JEP 181: class file 55.0
|
||||||
|
case ATT_NestHost:
|
||||||
|
decodeCPXAttr(in, len, AttrName, out);
|
||||||
|
break;
|
||||||
|
case ATT_NestMembers:
|
||||||
|
int cls_num = in.readUnsignedShort();
|
||||||
|
startArrayCmt(cls_num, AttrName);
|
||||||
|
try {
|
||||||
|
for (int i = 0; i < cls_num; i++) {
|
||||||
|
out_println("#" + in.readUnsignedShort() + ";" + getCommentPosCond());
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
out_end("}");
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (AttrName == null) {
|
if (AttrName == null) {
|
||||||
printBytes(out, in, len);
|
printBytes(out, in, len);
|
||||||
@ -985,7 +1000,7 @@ class ClassData {
|
|||||||
if (printDetails) {
|
if (printDetails) {
|
||||||
out_print(" : " + entityName);
|
out_print(" : " + entityName);
|
||||||
}
|
}
|
||||||
out_println("");
|
out.println();
|
||||||
|
|
||||||
// u2 module_flags
|
// u2 module_flags
|
||||||
int moduleFlags = in.readUnsignedShort();
|
int moduleFlags = in.readUnsignedShort();
|
||||||
@ -993,7 +1008,7 @@ class ClassData {
|
|||||||
if (printDetails) {
|
if (printDetails) {
|
||||||
out_print(" " + Module.Modifier.getModuleFlags(moduleFlags));
|
out_print(" " + Module.Modifier.getModuleFlags(moduleFlags));
|
||||||
}
|
}
|
||||||
out_println("");
|
out.println();
|
||||||
|
|
||||||
//u2 module_version
|
//u2 module_version
|
||||||
int versionIndex = in.readUnsignedShort();
|
int versionIndex = in.readUnsignedShort();
|
||||||
|
Loading…
Reference in New Issue
Block a user