Method, apparatus, and program to determine the mutability of an object at loading time
First Claim
1. A method for loading a class, comprising:
- loading a class;
inserting an immutability flag into the class;
determining whether the class is immutable; and
setting the immutability flag if the class is immutable.
1 Assignment
0 Petitions
Accused Products
Abstract
A mutability mechanism is provided for parsing an object at loading time. The mutability mechanism inserts a property into the object that indicates whether or not the object is immutable. The mutability mechanism looks at the code for the object and determines whether any other objects can modify the object. If the object cannot be modified after it is created, then the new property is set to indicate that the object is immutable; otherwise, the property is set to indicate that the object is mutable. This property can be inspected at runtime when a call is made to a program object. If an object passed as an argument is marked mutable, a clone of this object must be passed to the callee. However, if an object passed as an argument is marked immutable, a simple reference to the object may be passed as an argument to the callee.
48 Citations
22 Claims
-
1. A method for loading a class, comprising:
-
loading a class;
inserting an immutability flag into the class;
determining whether the class is immutable; and
setting the immutability flag if the class is immutable. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
-
8. A method for invoking an object, comprising:
-
receiving a request to invoke an object;
examining an argument in the request;
if the argument is an object, determining whether the object is immutable; and
if the object is immutable, passing a reference to the object rather than a clone of the object. - View Dependent Claims (9, 10)
-
-
11. An apparatus for loading a class, comprising:
-
loading means for loading a class;
insertion means for inserting an immutability flag into the class;
first determination means for determining whether the class is immutable; and
setting means for setting the immutability flag if the class is immutable. - View Dependent Claims (12, 13, 14, 15, 16, 17)
-
-
18. An apparatus for invoking an object, comprising:
-
receipt means for receiving a request to invoke an object;
examination means for examining an argument in the request;
determination means for determining whether the object is immutable if the argument is an object; and
reference means for passing a reference to the object rather than a clone of the object if the object is immutable. - View Dependent Claims (19, 20)
-
-
21. A computer program product, in a computer readable medium, for loading a class, comprising:
-
instructions for loading a class;
instructions for inserting an immutability flag into the class;
instructions for determining whether the class is immutable; and
instructions for setting the immutability flag if the class is immutable.
-
-
22. A computer program product, in a computer readable medium, for invoking an object, comprising:
-
instructions for receiving a request to invoke an object;
instructions for examining an argument in the request;
instructions for determining whether the object is immutable if the argument is an object; and
instructions for passing a reference to the object rather than a clone of the object if the object is immutable.
-
Specification