< prev index next >
test/hotspot/jtreg/runtime/Nestmates/membership/PackagedNestHost.java
Print this page
@@ -28,19 +28,34 @@
* NestMembers attribute to claim that P2.PackagedNestHost.Member
* is a member of our nest.
*/
public class PackagedNestHost {
public static class Member {
- // jcod file will change this to private
+ // jcod file will change these to private
+ public Member() {}
+ public static int f;
public static void m() {
System.out.println("You should never see this!");
}
}
- // Entry point for main test
- public static void doAccess() {
- // this should fail at runtime as m() will now be private
- // and the nestmate access check should fail due to being in
- // a different package.
+ // Entry points for main test.
+ // These should fail at runtime as members will now be private
+ // and the nestmate access check should fail due to being in a
+ // different package.
+
+ public static void doInvoke() {
P2.PackagedNestHost2.Member.m();
}
+
+ public static void doConstruct() {
+ Object o = new P2.PackagedNestHost2.Member();
+ }
+
+ public static void doGetField() {
+ int x = P2.PackagedNestHost2.Member.f;
+ }
+
+ public static void doPutField() {
+ P2.PackagedNestHost2.Member.f = 42;
+ }
}
< prev index next >