8287808: javac generates illegal class file for pattern matching switch with records
Reviewed-by: sundar
This commit is contained in:
parent
905bcbe34e
commit
2f62f15b09
src/jdk.compiler/share/classes/com/sun/tools/javac/comp
test/langtools/tools/javac
annotations/typeAnnotations/classfile
patterns
@ -354,7 +354,7 @@ public class TransPatterns extends TreeTranslator {
|
||||
types.erasure(component.type),
|
||||
List.nil(),
|
||||
syms.methodClass);
|
||||
MethodSymbol proxy = new MethodSymbol(Flags.STATIC | Flags.SYNTHETIC,
|
||||
MethodSymbol proxy = new MethodSymbol(Flags.PRIVATE | Flags.STATIC | Flags.SYNTHETIC,
|
||||
names.fromString("$proxy$" + component.name),
|
||||
type,
|
||||
currentClass);
|
||||
|
@ -245,9 +245,9 @@ public class Patterns {
|
||||
value=[@Patterns$DeconstructionPattern$A,@Patterns$DeconstructionPattern$A]
|
||||
)
|
||||
|
||||
static java.lang.String $proxy$s(Patterns$DeconstructionPattern$R);
|
||||
private static java.lang.String $proxy$s(Patterns$DeconstructionPattern$R);
|
||||
descriptor: (LPatterns$DeconstructionPattern$R;)Ljava/lang/String;
|
||||
flags: (0x1008) ACC_STATIC, ACC_SYNTHETIC
|
||||
flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
|
||||
|
||||
static {};
|
||||
descriptor: ()V
|
||||
|
@ -112,6 +112,9 @@ public class SimpleDeconstructionPattern {
|
||||
if (!testGen3(new GenRecord1<>(3, ""))) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
if (!I.testInInterface(new P2(new P(0), ""))) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
private static void exp(Object o) throws Throwable {
|
||||
@ -188,6 +191,11 @@ public class SimpleDeconstructionPattern {
|
||||
return o instanceof GenRecord1<Integer, String>(var i, var s) && i.intValue() == 3 && s.length() == 0;
|
||||
}
|
||||
|
||||
interface I {
|
||||
public static boolean testInInterface(Object o) {
|
||||
return o instanceof P2(P(int i), var s) && i == 0;
|
||||
}
|
||||
}
|
||||
public record P(int i) {
|
||||
}
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
SimpleDeconstructionPattern.java:118:27: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.deconstruction.patterns)
|
||||
SimpleDeconstructionPattern.java:121:27: compiler.err.preview.feature.disabled.plural: (compiler.misc.feature.deconstruction.patterns)
|
||||
1 error
|
||||
|
Loading…
x
Reference in New Issue
Block a user