Executing the main method of a nested class?
Jonathan Gibbons
jonathan.gibbons at oracle.com
Fri Sep 15 17:02:07 UTC 2017
On 09/14/2017 09:38 PM, David Holmes wrote:
> I have the following:
>
> /*
> * @test
> * @bug 8046171
> * @compile -XDdisablePrivateAccessors CrashTheJIT.java
> * @run main/othervm -Xcomp CrashTheJIT$Nested
> */
>
> public class CrashTheJIT {
>
> static class Nested2 {
> private Nested2() { }
> }
>
> public static class Nested {
> public static void main(String[] args) {
> run();
> }
> private static void run() {
> Nested2 n = new Nested2();
> }
> }
> }
>
> but it fails because it seems as part of @run jtreg wants to compile
> CrashTheJIT$Nested:
>
> ACTION: compile -- Passed. Compilation successful
> REASON: User specified action: run compile -XDdisablePrivateAccessors
> CrashTheJIT.java
> TIME: 1.591 seconds
> messages:
> command: compile -XDdisablePrivateAccessors
> /export/users/dh198349/valhalla/valhalla-base/hotspot/test/runtime/Nestmates/CrashTheJIT.java
> reason: User specified action: run compile -XDdisablePrivateAccessors
> CrashTheJIT.java
> Mode: othervm
> elapsed time (seconds): 1.591
> ...
> STDOUT:
> STDERR:
>
> ACTION: build -- Not run. Test running...
> REASON: Named class compiled on demand
> TIME: JIT$Nested seconds
> messages:
> command: build CrashTheJIT$Nested
> reason: Named class compiled on demand
>
> TEST RESULT: Error. can't find CrashTheJIT$Nested in test directory or
> libraries
>
> ----
>
> Note the messed up "TIME: JIT$Nested seconds" as well!
>
> Is there any way to tell jtreg the @compile already handled everything ??
>
> Thanks,
> David
David,
Sorry, executing nested classes is not supported.
-- Jon
More information about the jtreg-use
mailing list