Package sun.corba

Class Bridge

java.lang.Object
sun.corba.Bridge

public final class Bridge extends Object
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)
The code that calls Bridge.get() must have the following Permissions:
  • 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 Details

  • Method Details

    • get

      public static final Bridge 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

      public final ClassLoader getLatestUserDefinedLoader()
      Obtain the latest user defined ClassLoader from the call stack. This is required by the RMI-IIOP specification.
    • getInt

      public final int getInt(Object o, long offset)
      Fetches a field element within the given object o at the given offset. The result is undefined unless the offset was obtained from objectFieldOffset(java.lang.reflect.Field) on the Field of some Java field and the object referred to by o is of a class compatible with that field's class.
      Parameters:
      o - Java heap object in which the field from which the offset was obtained resides
      offset - 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 even NullPointerException
    • putInt

      public final void putInt(Object o, long offset, int x)
      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 null
      offset - 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 even NullPointerException
    • getObject

      public final Object getObject(Object o, long offset)
      See Also:
    • putObject

      public final void putObject(Object o, long offset, Object x)
      See Also:
    • getBoolean

      public final boolean getBoolean(Object o, long offset)
      See Also:
    • putBoolean

      public final void putBoolean(Object o, long offset, boolean x)
      See Also:
    • getByte

      public final byte getByte(Object o, long offset)
      See Also:
    • putByte

      public final void putByte(Object o, long offset, byte x)
      See Also:
    • getShort

      public final short getShort(Object o, long offset)
      See Also:
    • putShort

      public final void putShort(Object o, long offset, short x)
      See Also:
    • getChar

      public final char getChar(Object o, long offset)
      See Also:
    • putChar

      public final void putChar(Object o, long offset, char x)
      See Also:
    • getLong

      public final long getLong(Object o, long offset)
      See Also:
    • putLong

      public final void putLong(Object o, long offset, long x)
      See Also:
    • getFloat

      public final float getFloat(Object o, long offset)
      See Also:
    • putFloat

      public final void putFloat(Object o, long offset, float x)
      See Also:
    • getDouble

      public final double getDouble(Object o, long offset)
      See Also:
    • putDouble

      public final void putDouble(Object o, long offset, double x)
      See Also:
    • objectFieldOffset

      public final long objectFieldOffset(Field f)
      Returns the offset of a non-static field.
    • staticFieldOffset

      public final long staticFieldOffset(Field f)
      Returns the offset of a static field.
    • staticFieldBase

      public final Object staticFieldBase(Field f)
      + * Returns the location of a given static field. +
    • ensureClassInitialized

      public final void ensureClassInitialized(Class<?> cl)
      Ensure that the class has been initalized.
      Parameters:
      cl - the class to ensure is initialized
    • throwException

      public final void throwException(Throwable ee)
      Throw the exception. The exception may be an undeclared checked exception.
    • newConstructorForSerialization

      public final Constructor<?> newConstructorForSerialization(Class<?> cl)
      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

      public final Constructor<?> newConstructorForExternalization(Class<?> cl)
    • hasStaticInitializerForSerialization

      public final boolean hasStaticInitializerForSerialization(Class<?> cl)
      Returns true if the given class defines a static initializer method, false otherwise.
    • writeObjectForSerialization

      public final MethodHandle writeObjectForSerialization(Class<?> cl)
    • readObjectForSerialization

      public final MethodHandle readObjectForSerialization(Class<?> cl)
    • readObjectNoDataForSerialization

      public final MethodHandle readObjectNoDataForSerialization(Class<?> cl)
    • readResolveForSerialization

      public final MethodHandle readResolveForSerialization(Class<?> cl)
    • writeReplaceForSerialization

      public final MethodHandle writeReplaceForSerialization(Class<?> cl)
    • newOptionalDataExceptionForSerialization

      public final OptionalDataException newOptionalDataExceptionForSerialization(boolean bool)
      Return a new OptionalDataException instance.
      Returns:
      a new OptionalDataException instance