Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ Type toArray() {
}

Type getComponent() {
if (sym.isArray()) {
if (isArray()) {
var comp = sym.componentType();
if (comp.isPrimitive()) {
return switch (comp.descriptorString().charAt(0)) {
Expand Down
15 changes: 13 additions & 2 deletions test/jdk/jdk/classfile/StackMapsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/*
* @test
* @summary Testing Classfile stack maps generator.
* @bug 8305990 8320222
* @bug 8305990 8320222 8320618
* @build testdata.*
* @run junit StackMapsTest
*/
Expand All @@ -43,7 +43,6 @@
import java.lang.constant.ClassDesc;
import java.lang.constant.ConstantDescs;
import java.lang.constant.MethodTypeDesc;
import java.util.List;
import java.lang.reflect.AccessFlag;

/**
Expand Down Expand Up @@ -237,6 +236,18 @@ void testClassVersions() throws Exception {
.verify(null));
}

@Test
void testInvalidAALOADStack() {
Classfile.of().build(ClassDesc.of("Test"), clb
-> clb.withMethodBody("test", ConstantDescs.MTD_void, 0, cob
-> cob.bipush(10)
.anewarray(ConstantDescs.CD_Object)
.lconst_1() //long on stack caused NPE, see 8320618
.aaload()
.astore(2)
.return_()));
}

private static final FileSystem JRT = FileSystems.getFileSystem(URI.create("jrt:/"));

private static void testTransformedStackMaps(String classPath, Classfile.Option... options) throws Exception {
Expand Down