Package sun.corba
Class Bridge
java.lang.Object
sun.corba.Bridge
This class provides the methods for fundamental JVM operations
needed in the ORB that are not part of the public Java API. This includes:
- throwException, which can throw undeclared checked exceptions. This is needed to handle throwing arbitrary exceptions across a standardized OMG interface that (incorrectly) does not specify appropriate exceptions.
- putXXX/getXXX methods that allow unchecked access to fields of objects. This is used for setting uninitialzed non-static final fields (which is impossible with reflection) and for speed.
- objectFieldOffset to obtain the field offsets for use in the putXXX/getXXX methods
- newConstructorForSerialization to get the special constructor required for a Serializable class
- latestUserDefinedLoader to get the latest user defined class loader from the call stack as required by the RMI-IIOP specification (really from the JDK 1.1 days)
- BridgePermission "getBridge"
- ReflectPermission "suppressAccessChecks"
- RuntimePermission "getStackWalkerWithClassReference"
- RuntimePermission "reflectionFactoryAccess"
All of these permissions are required to obtain and correctly initialize the instance of Bridge. No security checks are performed on calls made to Bridge instance methods, so access to the Bridge instance must be protected.
This class is a singleton (per ClassLoader of course). Access to the instance is obtained through the Bridge.get() method.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThis constant differs from all results that will ever be returned fromobjectFieldOffset(java.lang.reflect.Field). -
Method Summary
Modifier and TypeMethodDescriptionfinal voidensureClassInitialized(Class<?> cl) Ensure that the class has been initalized.static final Bridgeget()Fetch the Bridge singleton.final booleangetBoolean(Object o, long offset) final bytefinal charfinal doublefinal floatfinal intFetches a field element within the given objectoat the given offset.final ClassLoaderObtain the latest user defined ClassLoader from the call stack.final longfinal Objectfinal shortfinal booleanReturns true if the given class defines a static initializer method, false otherwise.final Constructor<?>final Constructor<?>Obtain a constructor for Class cl.final OptionalDataExceptionnewOptionalDataExceptionForSerialization(boolean bool) Return a new OptionalDataException instance.final longReturns the offset of a non-static field.final voidputBoolean(Object o, long offset, boolean x) final voidfinal voidfinal voidfinal voidfinal voidStores a value into a given Java field.final voidfinal voidfinal voidfinal MethodHandlereadObjectForSerialization(Class<?> cl) final MethodHandlefinal MethodHandlereadResolveForSerialization(Class<?> cl) final Object+ * Returns the location of a given static fieldfinal longReturns the offset of a static field.final voidThrow the exception.final MethodHandlewriteObjectForSerialization(Class<?> cl) final MethodHandle
-
Field Details
-
INVALID_FIELD_OFFSET
public static final long INVALID_FIELD_OFFSETThis constant differs from all results that will ever be returned fromobjectFieldOffset(java.lang.reflect.Field).- See Also:
-
-
Method Details
-
get
Fetch the Bridge singleton. This requires the following permissions:- BridgePermission "getBridge"
- ReflectPermission "suppressAccessChecks"
- RuntimePermission "getStackWalkerWithClassReference"
- RuntimePermission "reflectionFactoryAccess"
- Returns:
- The singleton instance of the Bridge class
- Throws:
SecurityException- if the caller does not have the required permissions and the caller has a non-null security manager.
-
getLatestUserDefinedLoader
Obtain the latest user defined ClassLoader from the call stack. This is required by the RMI-IIOP specification. -
getInt
Fetches a field element within the given objectoat the given offset. The result is undefined unless the offset was obtained fromobjectFieldOffset(java.lang.reflect.Field)on theFieldof some Java field and the object referred to byois of a class compatible with that field's class.- Parameters:
o- Java heap object in which the field from which the offset was obtained residesoffset- indication of where the field resides in a Java heap object- Returns:
- the value fetched from the indicated Java field
- Throws:
RuntimeException- No defined exceptions are thrown, not evenNullPointerException
-
putInt
Stores a value into a given Java field.The first two parameters are interpreted exactly as with
getInt(Object, long)to refer to a specific Java field. The given value is stored into that field.The field must be of the same type as the method parameter
x.- Parameters:
o- Java heap object in which the field resides, if any, else nulloffset- indication of where the field resides in a Java heap object.x- the value to store into the indicated Java field- Throws:
RuntimeException- No defined exceptions are thrown, not evenNullPointerException
-
getObject
- See Also:
-
putObject
- See Also:
-
getBoolean
- See Also:
-
putBoolean
- See Also:
-
getByte
- See Also:
-
putByte
- See Also:
-
getShort
- See Also:
-
putShort
- See Also:
-
getChar
- See Also:
-
putChar
- See Also:
-
getLong
- See Also:
-
putLong
- See Also:
-
getFloat
- See Also:
-
putFloat
- See Also:
-
getDouble
- See Also:
-
putDouble
- See Also:
-
objectFieldOffset
Returns the offset of a non-static field. -
staticFieldOffset
Returns the offset of a static field. -
staticFieldBase
+ * Returns the location of a given static field. + -
ensureClassInitialized
Ensure that the class has been initalized.- Parameters:
cl- the class to ensure is initialized
-
throwException
Throw the exception. The exception may be an undeclared checked exception. -
newConstructorForSerialization
Obtain a constructor for Class cl. This is used to create a constructor for Serializable classes that construct an instance of the Serializable class using the no args constructor of the first non-Serializable superclass of the Serializable class. -
newConstructorForExternalization
-
hasStaticInitializerForSerialization
Returns true if the given class defines a static initializer method, false otherwise. -
writeObjectForSerialization
-
readObjectForSerialization
-
readObjectNoDataForSerialization
-
readResolveForSerialization
-
writeReplaceForSerialization
-
newOptionalDataExceptionForSerialization
Return a new OptionalDataException instance.- Returns:
- a new OptionalDataException instance
-