1 /* |
1 /* |
2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
71 * @since 1.3 |
72 * @since 1.3 |
72 */ |
73 */ |
73 public interface VirtualMachine extends Mirror { |
74 public interface VirtualMachine extends Mirror { |
74 |
75 |
75 /** |
76 /** |
|
77 * Returns all modules. For each module in the target |
|
78 * VM a {@link ModuleReference} will be placed in the returned list. |
|
79 * <P> |
|
80 * |
|
81 * Not all target virtual machines support this operation. |
|
82 * Use {@link VirtualMachine#canGetModuleInfo()} |
|
83 * to determine if the operation is supported. |
|
84 * |
|
85 * @implSpec |
|
86 * The default implementation throws {@code UnsupportedOperationException}. |
|
87 * |
|
88 * @return a list of {@link ModuleReference} objects, each mirroring |
|
89 * a module in the target VM. |
|
90 * |
|
91 * @throws java.lang.UnsupportedOperationException if |
|
92 * the target virtual machine does not support this |
|
93 * operation. |
|
94 * |
|
95 * @since 9 |
|
96 */ |
|
97 default List<ModuleReference> allModules() { |
|
98 throw new java.lang.UnsupportedOperationException( |
|
99 "The method allModules() must be implemented"); |
|
100 } |
|
101 |
|
102 /** |
76 * Returns the loaded reference types that |
103 * Returns the loaded reference types that |
77 * match a given name. The name must be fully qualified |
104 * match a given name. The name must be fully qualified |
78 * (for example, java.lang.String). The returned list |
105 * (for example, java.lang.String). The returned list |
79 * will contain a {@link ReferenceType} for each class |
106 * will contain a {@link ReferenceType} for each class |
80 * or interface found with the given name. The search |
107 * or interface found with the given name. The search |
731 * @since 1.6 |
758 * @since 1.6 |
732 */ |
759 */ |
733 boolean canGetConstantPool(); |
760 boolean canGetConstantPool(); |
734 |
761 |
735 /** |
762 /** |
|
763 * Determines if the target VM supports getting information about modules. |
|
764 * |
|
765 * @return {@code true} if the feature is supported, {@code false} otherwise |
|
766 * |
|
767 * @implSpec |
|
768 * The default implementation returns {@code false}. |
|
769 * |
|
770 * @see VirtualMachine#allModules() |
|
771 * @see ReferenceType#module() |
|
772 * @see ModuleReference |
|
773 * |
|
774 * @since 9 |
|
775 */ |
|
776 default boolean canGetModuleInfo() { |
|
777 return false; |
|
778 } |
|
779 |
|
780 /** |
736 * Set this VM's default stratum (see {@link Location} for a |
781 * Set this VM's default stratum (see {@link Location} for a |
737 * discussion of strata). Overrides the per-class default set |
782 * discussion of strata). Overrides the per-class default set |
738 * in the class file. |
783 * in the class file. |
739 * <P> |
784 * <P> |
740 * Affects location queries (such as, |
785 * Affects location queries (such as, |