8296329: jar validator doesn't account for minor class file version

Reviewed-by: jvernee
This commit is contained in:
Bo Zhang 2022-11-23 03:09:12 +00:00 committed by Jorn Vernee
parent 09f70dad2f
commit faf48e61be
3 changed files with 126 additions and 4 deletions

View file

@ -105,7 +105,7 @@ final class FingerPrint {
}
public boolean isCompatibleVersion(FingerPrint that) {
return attrs.version >= that.attrs.version;
return attrs.majorVersion >= that.attrs.majorVersion;
}
public boolean isSameAPI(FingerPrint that) {
@ -236,7 +236,7 @@ final class FingerPrint {
private String name;
private String outerClassName;
private String superName;
private int version;
private int majorVersion;
private int access;
private boolean publicClass;
private boolean nestedClass;
@ -255,7 +255,7 @@ final class FingerPrint {
@Override
public void visit(int version, int access, String name, String signature,
String superName, String[] interfaces) {
this.version = version;
this.majorVersion = version & 0xFFFF; // JDK-8296329: extract major version only
this.access = access;
this.name = name;
this.nestedClass = name.contains("$");