Skip to content

Commit

Permalink
Mark SharedSecrets fields @stable
Browse files Browse the repository at this point in the history
  • Loading branch information
mpfaff committed Aug 10, 2024
1 parent b8beeb8 commit fc8dc71
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions src/java.base/share/classes/jdk/internal/access/SharedSecrets.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

package jdk.internal.access;

import jdk.internal.vm.annotation.Stable;

import javax.crypto.SealedObject;
import javax.crypto.spec.SecretKeySpec;
import java.io.ObjectInputFilter;
Expand Down Expand Up @@ -56,44 +58,87 @@ interface and provides the ability to call package-private methods
for this purpose, namely the loss of compile-time checking. */

public class SharedSecrets {
@Stable
private static JavaAWTAccess javaAWTAccess;
@Stable
private static JavaAWTFontAccess javaAWTFontAccess;
@Stable
private static JavaBeansAccess javaBeansAccess;
@Stable
private static JavaLangAccess javaLangAccess;
@Stable
private static JavaLangInvokeAccess javaLangInvokeAccess;
@Stable
private static JavaLangModuleAccess javaLangModuleAccess;
@Stable
private static JavaLangRefAccess javaLangRefAccess;
@Stable
private static JavaLangReflectAccess javaLangReflectAccess;
@Stable
private static JavaIOAccess javaIOAccess;
@Stable
private static JavaIOPrintStreamAccess javaIOPrintStreamAccess;
@Stable
private static JavaIOPrintWriterAccess javaIOPrintWriterAccess;
@Stable
private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess;
@Stable
private static JavaIOFilePermissionAccess javaIOFilePermissionAccess;
@Stable
private static JavaIORandomAccessFileAccess javaIORandomAccessFileAccess;
@Stable
private static JavaObjectInputStreamReadString javaObjectInputStreamReadString;
@Stable
private static JavaObjectInputStreamAccess javaObjectInputStreamAccess;
@Stable
private static JavaObjectInputFilterAccess javaObjectInputFilterAccess;
@Stable
private static JavaNetInetAddressAccess javaNetInetAddressAccess;
@Stable
private static JavaNetHttpCookieAccess javaNetHttpCookieAccess;
@Stable
private static JavaNetUriAccess javaNetUriAccess;
@Stable
private static JavaNetURLAccess javaNetURLAccess;
@Stable
private static JavaNioAccess javaNioAccess;
@Stable
private static JavaUtilCollectionAccess javaUtilCollectionAccess;
@Stable
private static JavaUtilConcurrentTLRAccess javaUtilConcurrentTLRAccess;
@Stable
private static JavaUtilConcurrentFJPAccess javaUtilConcurrentFJPAccess;
@Stable
private static JavaUtilJarAccess javaUtilJarAccess;
@Stable
private static JavaUtilZipFileAccess javaUtilZipFileAccess;
@Stable
private static JavaUtilResourceBundleAccess javaUtilResourceBundleAccess;
@Stable
private static JavaSecurityAccess javaSecurityAccess;
@Stable
private static JavaSecurityPropertiesAccess javaSecurityPropertiesAccess;
@Stable
private static JavaSecuritySignatureAccess javaSecuritySignatureAccess;
@Stable
private static JavaSecuritySpecAccess javaSecuritySpecAccess;
@Stable
private static JavaxCryptoSealedObjectAccess javaxCryptoSealedObjectAccess;
@Stable
private static JavaxCryptoSpecAccess javaxCryptoSpecAccess;
@Stable
private static JavaxSecurityAccess javaxSecurityAccess;
@Stable
private static JavaTemplateAccess javaTemplateAccess;

private static void checkNotAssigned(Object currentValue) {
if (currentValue != null) {
throw new IllegalStateException("Already assigned");
}
}

public static void setJavaUtilCollectionAccess(JavaUtilCollectionAccess juca) {
checkNotAssigned(javaUtilCollectionAccess);
javaUtilCollectionAccess = juca;
}

Expand All @@ -109,6 +154,7 @@ public static JavaUtilCollectionAccess getJavaUtilCollectionAccess() {
}

public static void setJavaUtilConcurrentTLRAccess(JavaUtilConcurrentTLRAccess access) {
checkNotAssigned(javaUtilConcurrentTLRAccess);
javaUtilConcurrentTLRAccess = access;
}

Expand All @@ -124,6 +170,7 @@ public static JavaUtilConcurrentTLRAccess getJavaUtilConcurrentTLRAccess() {
}

public static void setJavaUtilConcurrentFJPAccess(JavaUtilConcurrentFJPAccess access) {
checkNotAssigned(javaUtilConcurrentFJPAccess);
javaUtilConcurrentFJPAccess = access;
}

Expand All @@ -148,10 +195,12 @@ public static JavaUtilJarAccess javaUtilJarAccess() {
}

public static void setJavaUtilJarAccess(JavaUtilJarAccess access) {
checkNotAssigned(javaUtilJarAccess);
javaUtilJarAccess = access;
}

public static void setJavaLangAccess(JavaLangAccess jla) {
checkNotAssigned(javaLangAccess);
javaLangAccess = jla;
}

Expand All @@ -160,6 +209,7 @@ public static JavaLangAccess getJavaLangAccess() {
}

public static void setJavaLangInvokeAccess(JavaLangInvokeAccess jlia) {
checkNotAssigned(javaLangInvokeAccess);
javaLangInvokeAccess = jlia;
}

Expand All @@ -175,6 +225,7 @@ public static JavaLangInvokeAccess getJavaLangInvokeAccess() {
}

public static void setJavaLangModuleAccess(JavaLangModuleAccess jlrma) {
checkNotAssigned(javaLangModuleAccess);
javaLangModuleAccess = jlrma;
}

Expand All @@ -188,6 +239,7 @@ public static JavaLangModuleAccess getJavaLangModuleAccess() {
}

public static void setJavaLangRefAccess(JavaLangRefAccess jlra) {
checkNotAssigned(javaLangRefAccess);
javaLangRefAccess = jlra;
}

Expand All @@ -196,6 +248,7 @@ public static JavaLangRefAccess getJavaLangRefAccess() {
}

public static void setJavaLangReflectAccess(JavaLangReflectAccess jlra) {
checkNotAssigned(javaLangReflectAccess);
javaLangReflectAccess = jlra;
}

Expand All @@ -204,6 +257,7 @@ public static JavaLangReflectAccess getJavaLangReflectAccess() {
}

public static void setJavaNetUriAccess(JavaNetUriAccess jnua) {
checkNotAssigned(javaNetUriAccess);
javaNetUriAccess = jnua;
}

Expand All @@ -217,6 +271,7 @@ public static JavaNetUriAccess getJavaNetUriAccess() {
}

public static void setJavaNetURLAccess(JavaNetURLAccess jnua) {
checkNotAssigned(javaNetURLAccess);
javaNetURLAccess = jnua;
}

Expand All @@ -230,6 +285,7 @@ public static JavaNetURLAccess getJavaNetURLAccess() {
}

public static void setJavaNetInetAddressAccess(JavaNetInetAddressAccess jna) {
checkNotAssigned(javaNetInetAddressAccess);
javaNetInetAddressAccess = jna;
}

Expand All @@ -243,6 +299,7 @@ public static JavaNetInetAddressAccess getJavaNetInetAddressAccess() {
}

public static void setJavaNetHttpCookieAccess(JavaNetHttpCookieAccess a) {
checkNotAssigned(javaNetHttpCookieAccess);
javaNetHttpCookieAccess = a;
}

Expand All @@ -256,6 +313,7 @@ public static JavaNetHttpCookieAccess getJavaNetHttpCookieAccess() {
}

public static void setJavaNioAccess(JavaNioAccess jna) {
checkNotAssigned(javaNioAccess);
javaNioAccess = jna;
}

Expand All @@ -271,6 +329,7 @@ public static JavaNioAccess getJavaNioAccess() {
}

public static void setJavaIOAccess(JavaIOAccess jia) {
checkNotAssigned(javaIOAccess);
javaIOAccess = jia;
}

Expand All @@ -284,6 +343,7 @@ public static JavaIOAccess getJavaIOAccess() {
}

public static void setJavaIOCPrintWriterAccess(JavaIOPrintWriterAccess a) {
checkNotAssigned(javaIOPrintWriterAccess);
javaIOPrintWriterAccess = a;
}

Expand All @@ -297,6 +357,7 @@ public static JavaIOPrintWriterAccess getJavaIOPrintWriterAccess() {
}

public static void setJavaIOCPrintStreamAccess(JavaIOPrintStreamAccess a) {
checkNotAssigned(javaIOPrintStreamAccess);
javaIOPrintStreamAccess = a;
}

Expand All @@ -310,6 +371,7 @@ public static JavaIOPrintStreamAccess getJavaIOPrintStreamAccess() {
}

public static void setJavaIOFileDescriptorAccess(JavaIOFileDescriptorAccess jiofda) {
checkNotAssigned(javaIOFileDescriptorAccess);
javaIOFileDescriptorAccess = jiofda;
}

Expand All @@ -323,6 +385,7 @@ public static JavaIOFilePermissionAccess getJavaIOFilePermissionAccess() {
}

public static void setJavaIOFilePermissionAccess(JavaIOFilePermissionAccess jiofpa) {
checkNotAssigned(javaIOFilePermissionAccess);
javaIOFilePermissionAccess = jiofpa;
}

Expand All @@ -336,6 +399,7 @@ public static JavaIOFileDescriptorAccess getJavaIOFileDescriptorAccess() {
}

public static void setJavaSecurityAccess(JavaSecurityAccess jsa) {
checkNotAssigned(javaSecurityAccess);
javaSecurityAccess = jsa;
}

Expand All @@ -349,6 +413,7 @@ public static JavaSecurityAccess getJavaSecurityAccess() {
}

public static void setJavaSecurityPropertiesAccess(JavaSecurityPropertiesAccess jspa) {
checkNotAssigned(javaSecurityPropertiesAccess);
javaSecurityPropertiesAccess = jspa;
}

Expand All @@ -371,10 +436,12 @@ public static JavaUtilZipFileAccess getJavaUtilZipFileAccess() {
}

public static void setJavaUtilZipFileAccess(JavaUtilZipFileAccess access) {
checkNotAssigned(javaUtilZipFileAccess);
javaUtilZipFileAccess = access;
}

public static void setJavaAWTAccess(JavaAWTAccess jaa) {
checkNotAssigned(javaAWTAccess);
javaAWTAccess = jaa;
}

Expand All @@ -385,6 +452,7 @@ public static JavaAWTAccess getJavaAWTAccess() {
}

public static void setJavaAWTFontAccess(JavaAWTFontAccess jafa) {
checkNotAssigned(javaAWTFontAccess);
javaAWTFontAccess = jafa;
}

Expand All @@ -399,6 +467,7 @@ public static JavaBeansAccess getJavaBeansAccess() {
}

public static void setJavaBeansAccess(JavaBeansAccess access) {
checkNotAssigned(javaBeansAccess);
javaBeansAccess = access;
}

Expand All @@ -412,6 +481,7 @@ public static JavaUtilResourceBundleAccess getJavaUtilResourceBundleAccess() {
}

public static void setJavaUtilResourceBundleAccess(JavaUtilResourceBundleAccess access) {
checkNotAssigned(javaUtilResourceBundleAccess);
javaUtilResourceBundleAccess = access;
}

Expand All @@ -425,6 +495,7 @@ public static JavaObjectInputStreamReadString getJavaObjectInputStreamReadString
}

public static void setJavaObjectInputStreamReadString(JavaObjectInputStreamReadString access) {
checkNotAssigned(javaObjectInputStreamReadString);
javaObjectInputStreamReadString = access;
}

Expand All @@ -438,6 +509,7 @@ public static JavaObjectInputStreamAccess getJavaObjectInputStreamAccess() {
}

public static void setJavaObjectInputStreamAccess(JavaObjectInputStreamAccess access) {
checkNotAssigned(javaObjectInputStreamAccess);
javaObjectInputStreamAccess = access;
}

Expand All @@ -451,10 +523,12 @@ public static JavaObjectInputFilterAccess getJavaObjectInputFilterAccess() {
}

public static void setJavaObjectInputFilterAccess(JavaObjectInputFilterAccess access) {
checkNotAssigned(javaObjectInputFilterAccess);
javaObjectInputFilterAccess = access;
}

public static void setJavaIORandomAccessFileAccess(JavaIORandomAccessFileAccess jirafa) {
checkNotAssigned(javaIORandomAccessFileAccess);
javaIORandomAccessFileAccess = jirafa;
}

Expand All @@ -468,6 +542,7 @@ public static JavaIORandomAccessFileAccess getJavaIORandomAccessFileAccess() {
}

public static void setJavaSecuritySignatureAccess(JavaSecuritySignatureAccess jssa) {
checkNotAssigned(javaSecuritySignatureAccess);
javaSecuritySignatureAccess = jssa;
}

Expand All @@ -481,6 +556,7 @@ public static JavaSecuritySignatureAccess getJavaSecuritySignatureAccess() {
}

public static void setJavaSecuritySpecAccess(JavaSecuritySpecAccess jssa) {
checkNotAssigned(javaSecuritySpecAccess);
javaSecuritySpecAccess = jssa;
}

Expand All @@ -494,6 +570,7 @@ public static JavaSecuritySpecAccess getJavaSecuritySpecAccess() {
}

public static void setJavaxCryptoSpecAccess(JavaxCryptoSpecAccess jcsa) {
checkNotAssigned(javaxCryptoSpecAccess);
javaxCryptoSpecAccess = jcsa;
}

Expand All @@ -507,6 +584,7 @@ public static JavaxCryptoSpecAccess getJavaxCryptoSpecAccess() {
}

public static void setJavaxCryptoSealedObjectAccess(JavaxCryptoSealedObjectAccess jcsoa) {
checkNotAssigned(javaxCryptoSealedObjectAccess);
javaxCryptoSealedObjectAccess = jcsoa;
}

Expand All @@ -520,6 +598,7 @@ public static JavaxCryptoSealedObjectAccess getJavaxCryptoSealedObjectAccess() {
}

public static void setJavaxSecurityAccess(JavaxSecurityAccess jsa) {
checkNotAssigned(javaxSecurityAccess);
javaxSecurityAccess = jsa;
}

Expand All @@ -533,6 +612,7 @@ public static JavaxSecurityAccess getJavaxSecurityAccess() {
}

public static void setJavaTemplateAccess(JavaTemplateAccess jta) {
checkNotAssigned(javaTemplateAccess);
javaTemplateAccess = jta;
}

Expand Down

0 comments on commit fc8dc71

Please sign in to comment.