Hi Egor,

This doesn't seem right to me sorry ...

On 2/04/2019 7:42 pm, Egor Ushakov wrote:
Please review the fix

this test started to fail after the fix of https://bugs.openjdk.java.net/browse/JDK-8146986 previously any call to ClassLoaderReference.visibleClasses as a side effect cached the results in VirtualMachineImpl.typesBySignature
and made them available to any VirtualMachine.classesByName call.
This is somewhat not consistent for unprepared classes, I reported that, check Bug 26148990 : JDI - VirtualMachine.allClasses does not return loaded but uninitialized class,

That issue is now a duplicate of this core-libs issue:

https://bugs.openjdk.java.net/browse/JDK-8212117

which is in the process of being fixed. Once it is fixed then this workaround would no longer be needed.

That said I'm not at all clear how the proposed workaround actually works-around the underlying issue.

but it seems that it allowed the ArrayTypeImpl.componentType to work even if the type was not prepared,
check how ArrayTypeImpl#findComponentType uses vm.classesByName.
It seems that ArrayTypeImpl#findComponentType should simply call findType for component signature. Just how the unused com.sun.tools.jdi.ArrayTypeImpl#type method works, not sure why it was dropped...

The package-private:

Type type() throws ClassNotLoadedException {
    return findType(elementSignature());
}

seems to have always existed but never been used as the implementation for the public componentType() method (previously elementType()). In fact the two methods appear to have different requirements with regards to what they should be returning. AFAICS:

- ArrayTypeImpl.type() returns the actual array type
- ArrayTypeImpl.componentType() returns the actual ultimate component type

i.e if I understand correctly, given double[][][] then
- ArrayTypeImpl.type() == double[][]
- ArrayTypeImpl.componentType() == double

so implementing them both the same way can't possibly be correct!

bugid https://bugs.openjdk.java.net/browse/JDK-8221503
cr http://cr.openjdk.java.net/~eushakov/8221503/webrev.00/

Thanks!
<http://cr.openjdk.java.net/~eushakov/8221503/webrev.00/>

You'd also need to update the ProblemList so the test gets re-enabled.

diff -r 532e88de77eb test/hotspot/jtreg/ProblemList.txt
--- a/test/hotspot/jtreg/ProblemList.txt
+++ b/test/hotspot/jtreg/ProblemList.txt
@@ -161,8 +161,6 @@

vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/TestDescription.java 8065773 generic-all

vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/TestDescription.java 8065773 generic-all

-vmTestbase/nsk/jdb/eval/eval001/eval001.java 8221503 generic-all
-
vmTestbase/metaspace/gc/firstGC_10m/TestDescription.java 8208250 generic-all vmTestbase/metaspace/gc/firstGC_50m/TestDescription.java 8208250 generic-all vmTestbase/metaspace/gc/firstGC_99m/TestDescription.java 8208250 generic-all

It also appears to me that the exception message of the ClassNotLoadedException will be different now. Have you re-run all the JDI tests?

Thanks,
David
-----


--
Egor Ushakov
Software Developer
JetBrains
http://www.jetbrains.com
The Drive to Develop

Reply via email to