8292498: java/lang/invoke/lambda/LogGeneratedClassesTest.java failed with "AssertionError: only show error once expected [1] but found [0]"
Reviewed-by: psandoz, mchung, jpai, rriggs
This commit is contained in:
parent
d00e7b92b4
commit
f567fa0fd5
@ -92,6 +92,11 @@ import static java.util.Map.entry;
|
||||
*/
|
||||
@SuppressWarnings("doclint:reference") // cross-module link
|
||||
public enum AccessFlag {
|
||||
// Note to maintainers: anonymous class instances are used rather
|
||||
// than lambdas to initialize the functions used for the
|
||||
// cffvToLocations field to avoid using lambdas too early in JDK
|
||||
// initialization.
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_PUBLIC}, corresponding to the source
|
||||
* modifier {@link Modifier#PUBLIC public} with a mask value of
|
||||
@ -99,10 +104,13 @@ public enum AccessFlag {
|
||||
*/
|
||||
PUBLIC(Modifier.PUBLIC, true,
|
||||
Location.SET_PUBLIC_1,
|
||||
cffv -> {
|
||||
return (cffv == ClassFileFormatVersion.RELEASE_0) ?
|
||||
Location.SET_CLASS_FIELD_METHOD:
|
||||
Location.SET_PUBLIC_1;
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv == ClassFileFormatVersion.RELEASE_0) ?
|
||||
Location.SET_CLASS_FIELD_METHOD:
|
||||
Location.SET_PUBLIC_1;
|
||||
}
|
||||
}),
|
||||
|
||||
/**
|
||||
@ -111,10 +119,13 @@ public enum AccessFlag {
|
||||
* value of <code>{@value "0x%04x" Modifier#PRIVATE}</code>.
|
||||
*/
|
||||
PRIVATE(Modifier.PRIVATE, true, Location.SET_FIELD_METHOD_INNER_CLASS,
|
||||
cffv -> {
|
||||
return (cffv == ClassFileFormatVersion.RELEASE_0) ?
|
||||
Location.SET_FIELD_METHOD:
|
||||
Location.SET_FIELD_METHOD_INNER_CLASS;
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv == ClassFileFormatVersion.RELEASE_0) ?
|
||||
Location.SET_FIELD_METHOD:
|
||||
Location.SET_FIELD_METHOD_INNER_CLASS;
|
||||
}
|
||||
}),
|
||||
|
||||
/**
|
||||
@ -123,9 +134,14 @@ public enum AccessFlag {
|
||||
* value of <code>{@value "0x%04x" Modifier#PROTECTED}</code>.
|
||||
*/
|
||||
PROTECTED(Modifier.PROTECTED, true, Location.SET_FIELD_METHOD_INNER_CLASS,
|
||||
cffv -> {return (cffv == ClassFileFormatVersion.RELEASE_0) ?
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv == ClassFileFormatVersion.RELEASE_0) ?
|
||||
Location.SET_FIELD_METHOD:
|
||||
Location.SET_FIELD_METHOD_INNER_CLASS;}),
|
||||
Location.SET_FIELD_METHOD_INNER_CLASS;
|
||||
}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_STATIC}, corresponding to the source
|
||||
@ -133,9 +149,13 @@ public enum AccessFlag {
|
||||
* <code>{@value "0x%04x" Modifier#STATIC}</code>.
|
||||
*/
|
||||
STATIC(Modifier.STATIC, true, Location.SET_FIELD_METHOD_INNER_CLASS,
|
||||
cffv -> {return (cffv == ClassFileFormatVersion.RELEASE_0) ?
|
||||
Location.SET_FIELD_METHOD:
|
||||
Location.SET_FIELD_METHOD_INNER_CLASS;}),
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv == ClassFileFormatVersion.RELEASE_0) ?
|
||||
Location.SET_FIELD_METHOD:
|
||||
Location.SET_FIELD_METHOD_INNER_CLASS;}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_FINAL}, corresponding to the source
|
||||
@ -144,13 +164,16 @@ public enum AccessFlag {
|
||||
*/
|
||||
FINAL(Modifier.FINAL, true,
|
||||
Location.SET_FINAL_8,
|
||||
cffv -> {
|
||||
if (cffv.compareTo(ClassFileFormatVersion.RELEASE_8) >= 0) {
|
||||
return Location.SET_FINAL_8;
|
||||
} else {
|
||||
return (cffv == ClassFileFormatVersion.RELEASE_0) ?
|
||||
Location.SET_CLASS_FIELD_METHOD :
|
||||
Location.SET_CLASS_FIELD_METHOD_INNER_CLASS;
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
if (cffv.compareTo(ClassFileFormatVersion.RELEASE_8) >= 0) {
|
||||
return Location.SET_FINAL_8;
|
||||
} else {
|
||||
return (cffv == ClassFileFormatVersion.RELEASE_0) ?
|
||||
Location.SET_CLASS_FIELD_METHOD :
|
||||
Location.SET_CLASS_FIELD_METHOD_INNER_CLASS;
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
@ -170,9 +193,13 @@ public enum AccessFlag {
|
||||
* @see java.lang.module.ModuleDescriptor#isOpen
|
||||
*/
|
||||
OPEN(0x0000_0020, false, Location.SET_MODULE,
|
||||
cffv -> { return (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 ) ?
|
||||
Location.SET_MODULE:
|
||||
Location.EMPTY_SET;}),
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 ) ?
|
||||
Location.SET_MODULE:
|
||||
Location.EMPTY_SET;}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The module requires flag {@code ACC_TRANSITIVE} with a mask
|
||||
@ -180,9 +207,13 @@ public enum AccessFlag {
|
||||
* @see java.lang.module.ModuleDescriptor.Requires.Modifier#TRANSITIVE
|
||||
*/
|
||||
TRANSITIVE(0x0000_0020, false, Location.SET_MODULE_REQUIRES,
|
||||
cffv -> {return (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 ) ?
|
||||
Location.SET_MODULE_REQUIRES:
|
||||
Location.EMPTY_SET;}),
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 ) ?
|
||||
Location.SET_MODULE_REQUIRES:
|
||||
Location.EMPTY_SET;}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_SYNCHRONIZED}, corresponding to the
|
||||
@ -197,9 +228,13 @@ public enum AccessFlag {
|
||||
* @see java.lang.module.ModuleDescriptor.Requires.Modifier#STATIC
|
||||
*/
|
||||
STATIC_PHASE(0x0000_0040, false, Location.SET_MODULE_REQUIRES,
|
||||
cffv -> {return (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 ) ?
|
||||
Location.SET_MODULE_REQUIRES:
|
||||
Location.EMPTY_SET;}),
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 ) ?
|
||||
Location.SET_MODULE_REQUIRES:
|
||||
Location.EMPTY_SET;}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_VOLATILE}, corresponding to the
|
||||
@ -214,9 +249,13 @@ public enum AccessFlag {
|
||||
* @see Method#isBridge()
|
||||
*/
|
||||
BRIDGE(Modifier.BRIDGE, false, Location.SET_METHOD,
|
||||
cffv -> {return (cffv.compareTo(ClassFileFormatVersion.RELEASE_5) >= 0 ) ?
|
||||
Location.SET_METHOD:
|
||||
Location.EMPTY_SET;}),
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv.compareTo(ClassFileFormatVersion.RELEASE_5) >= 0 ) ?
|
||||
Location.SET_METHOD:
|
||||
Location.EMPTY_SET;}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_TRANSIENT}, corresponding to the
|
||||
@ -231,10 +270,13 @@ public enum AccessFlag {
|
||||
* @see Executable#isVarArgs()
|
||||
*/
|
||||
VARARGS(Modifier.VARARGS, false, Location.SET_METHOD,
|
||||
cffv -> {return (cffv.compareTo(ClassFileFormatVersion.RELEASE_5) >= 0 ) ?
|
||||
Location.SET_METHOD:
|
||||
Location.EMPTY_SET;}),
|
||||
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv.compareTo(ClassFileFormatVersion.RELEASE_5) >= 0 ) ?
|
||||
Location.SET_METHOD:
|
||||
Location.EMPTY_SET;}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_NATIVE}, corresponding to the source
|
||||
@ -249,9 +291,13 @@ public enum AccessFlag {
|
||||
* @see Class#isInterface()
|
||||
*/
|
||||
INTERFACE(Modifier.INTERFACE, false, Location.SET_CLASS_INNER_CLASS,
|
||||
cffv -> { return (cffv.compareTo(ClassFileFormatVersion.RELEASE_0) == 0 ) ?
|
||||
Location.SET_CLASS:
|
||||
Location.SET_CLASS_INNER_CLASS;}),
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv.compareTo(ClassFileFormatVersion.RELEASE_0) == 0 ) ?
|
||||
Location.SET_CLASS:
|
||||
Location.SET_CLASS_INNER_CLASS;}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_ABSTRACT}, corresponding to the
|
||||
@ -260,9 +306,13 @@ public enum AccessFlag {
|
||||
*/
|
||||
ABSTRACT(Modifier.ABSTRACT, true,
|
||||
Location.SET_CLASS_METHOD_INNER_CLASS,
|
||||
cffv -> { return (cffv.compareTo(ClassFileFormatVersion.RELEASE_0) == 0 ) ?
|
||||
Location.SET_CLASS_METHOD:
|
||||
Location.SET_CLASS_METHOD_INNER_CLASS;}),
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv.compareTo(ClassFileFormatVersion.RELEASE_0) == 0 ) ?
|
||||
Location.SET_CLASS_METHOD:
|
||||
Location.SET_CLASS_METHOD_INNER_CLASS;}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_STRICT}, corresponding to the source
|
||||
@ -275,11 +325,14 @@ public enum AccessFlag {
|
||||
* corresponding to Java SE 1.2 through 16.
|
||||
*/
|
||||
STRICT(Modifier.STRICT, true, Location.SET_METHOD,
|
||||
cffv -> {return (cffv.compareTo(ClassFileFormatVersion.RELEASE_2) >= 0 &&
|
||||
cffv.compareTo(ClassFileFormatVersion.RELEASE_16) <= 0) ?
|
||||
Location.SET_METHOD:
|
||||
Location.EMPTY_SET;}),
|
||||
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv.compareTo(ClassFileFormatVersion.RELEASE_2) >= 0 &&
|
||||
cffv.compareTo(ClassFileFormatVersion.RELEASE_16) <= 0) ?
|
||||
Location.SET_METHOD:
|
||||
Location.EMPTY_SET;}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_SYNTHETIC} with a mask value of
|
||||
@ -289,16 +342,19 @@ public enum AccessFlag {
|
||||
* @see java.lang.module.ModuleDescriptor.Modifier#SYNTHETIC
|
||||
*/
|
||||
SYNTHETIC(Modifier.SYNTHETIC, false, Location.SET_SYNTHETIC_9,
|
||||
cffv -> {
|
||||
if (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 )
|
||||
return Location.SET_SYNTHETIC_9;
|
||||
else {
|
||||
return
|
||||
switch(cffv) {
|
||||
case RELEASE_7 -> Location.SET_SYNTHETIC_7;
|
||||
case RELEASE_8 -> Location.SET_SYNTHETIC_8;
|
||||
default -> Location.EMPTY_SET;
|
||||
};
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
if (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 )
|
||||
return Location.SET_SYNTHETIC_9;
|
||||
else {
|
||||
return
|
||||
switch(cffv) {
|
||||
case RELEASE_7 -> Location.SET_SYNTHETIC_7;
|
||||
case RELEASE_8 -> Location.SET_SYNTHETIC_8;
|
||||
default -> Location.EMPTY_SET;
|
||||
};
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
@ -308,9 +364,13 @@ public enum AccessFlag {
|
||||
* @see Class#isAnnotation()
|
||||
*/
|
||||
ANNOTATION(Modifier.ANNOTATION, false, Location.SET_CLASS_INNER_CLASS,
|
||||
cffv -> {return (cffv.compareTo(ClassFileFormatVersion.RELEASE_5) >= 0 ) ?
|
||||
Location.SET_CLASS_INNER_CLASS:
|
||||
Location.EMPTY_SET;}),
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv.compareTo(ClassFileFormatVersion.RELEASE_5) >= 0 ) ?
|
||||
Location.SET_CLASS_INNER_CLASS:
|
||||
Location.EMPTY_SET;}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_ENUM} with a mask value of
|
||||
@ -318,22 +378,29 @@ public enum AccessFlag {
|
||||
* @see Class#isEnum()
|
||||
*/
|
||||
ENUM(Modifier.ENUM, false, Location.SET_CLASS_FIELD_INNER_CLASS,
|
||||
cffv -> {return (cffv.compareTo(ClassFileFormatVersion.RELEASE_5) >= 0 ) ?
|
||||
Location.SET_CLASS_FIELD_INNER_CLASS:
|
||||
Location.EMPTY_SET;}),
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv.compareTo(ClassFileFormatVersion.RELEASE_5) >= 0 ) ?
|
||||
Location.SET_CLASS_FIELD_INNER_CLASS:
|
||||
Location.EMPTY_SET;}
|
||||
}),
|
||||
|
||||
/**
|
||||
* The access flag {@code ACC_MANDATED} with a mask value of
|
||||
* <code>{@value "0x%04x" Modifier#MANDATED}</code>.
|
||||
*/
|
||||
MANDATED(Modifier.MANDATED, false, Location.SET_MANDATED_9,
|
||||
cffv -> {
|
||||
if (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 ) {
|
||||
return Location.SET_MANDATED_9;
|
||||
} else {
|
||||
return (cffv == ClassFileFormatVersion.RELEASE_8) ?
|
||||
Location.SET_METHOD_PARAM:
|
||||
Location.EMPTY_SET;
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
if (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 ) {
|
||||
return Location.SET_MANDATED_9;
|
||||
} else {
|
||||
return (cffv == ClassFileFormatVersion.RELEASE_8) ?
|
||||
Location.SET_METHOD_PARAM:
|
||||
Location.EMPTY_SET;
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
@ -342,9 +409,13 @@ public enum AccessFlag {
|
||||
* 0x8000}.
|
||||
*/
|
||||
MODULE(0x0000_8000, false, Location.SET_CLASS,
|
||||
cffv -> {return (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 ) ?
|
||||
Location.SET_CLASS:
|
||||
Location.EMPTY_SET;})
|
||||
new Function<ClassFileFormatVersion, Set<Location>>() {
|
||||
@Override
|
||||
public Set<Location> apply(ClassFileFormatVersion cffv) {
|
||||
return (cffv.compareTo(ClassFileFormatVersion.RELEASE_9) >= 0 ) ?
|
||||
Location.SET_CLASS:
|
||||
Location.EMPTY_SET;}
|
||||
})
|
||||
;
|
||||
|
||||
// May want to override toString for a different enum constant ->
|
||||
|
@ -496,7 +496,6 @@ java/lang/invoke/LFCaching/LFGarbageCollectedTest.java 8078602 generic-
|
||||
java/lang/invoke/lambda/LambdaFileEncodingSerialization.java 8249079 linux-x64
|
||||
java/lang/invoke/RicochetTest.java 8251969 generic-all
|
||||
java/lang/ProcessBuilder/PipelineLeaksFD.java 8291760 linux-all
|
||||
java/lang/invoke/lambda/LogGeneratedClassesTest.java 8292498 windows-x64
|
||||
|
||||
############################################################################
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user