< prev index next >

src/java.base/share/classes/java/lang/Module.java

Print this page
@@ -26,10 +26,12 @@
  package java.lang;
  
  import java.io.IOException;
  import java.io.InputStream;
  import java.lang.annotation.Annotation;
+ import java.lang.invoke.MethodHandle;
+ import java.lang.invoke.VarHandle;
  import java.lang.module.Configuration;
  import java.lang.module.ModuleReference;
  import java.lang.module.ModuleDescriptor;
  import java.lang.module.ModuleDescriptor.Exports;
  import java.lang.module.ModuleDescriptor.Opens;

@@ -66,10 +68,11 @@
  import jdk.internal.org.objectweb.asm.ClassWriter;
  import jdk.internal.org.objectweb.asm.ModuleVisitor;
  import jdk.internal.org.objectweb.asm.Opcodes;
  import jdk.internal.reflect.CallerSensitive;
  import jdk.internal.reflect.Reflection;
+ import jdk.internal.vm.annotation.Stable;
  import sun.security.util.SecurityConstants;
  
  /**
   * Represents a run-time module, either {@link #isNamed() named} or unnamed.
   *

@@ -107,12 +110,14 @@
      private final ClassLoader loader;
  
      // the module descriptor
      private final ModuleDescriptor descriptor;
  
-     // true, if this module allows restricted native access
-     private volatile boolean enableNativeAccess;
+     // true, if this module allows restricted native access; @Stable makes sure that modules that allow native
+     // access capture this property as a constant.
+     @Stable
+     private boolean enableNativeAccess;
  
      /**
       * Creates a new named Module. The resulting Module will be defined to the
       * VM but will not read any other modules, will not have any exports setup
       * and will not be registered in the service catalog.
< prev index next >