IP Library Granted Patent US 7,171,657
Granted Patent B2
US 7,171,657 · App. 10/237,885 · Granted Jan 30, 2007

Method and apparatus for importing static members of a class

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 7,171,657
App. No.
10/237,885
Granted
Jan 30, 2007
Kind
B2
Abstract

One embodiment of the present invention provides a system that facilitates importing static members of a class. During operation, the system examines code associated with a compilation unit to locate a static import declaration that identifies one or more static members of the class to import. Upon finding such a static import declaration, the system records the static import declaration in a symbol table used to compile the compilation unit. This allows the names for the one or more static members of the class to appear within the compilation unit without being prefixed with a name for the class.

Claims (36)

1. A method that facilitates importing static members of a class, comprising:

receiving a compilation unit containing code to be compiled;

examining code associated with the compilation unit to locate a static import declaration that identifies one or more static members of the class to import, wherein the one or more static members are defined in a package other than the one to which the compilation unit containing the static import statement belongs; and

upon finding such a static import declaration, recording the static import declaration in a symbol table used to compile the compilation unit;

wherein the names for the one or more static members of the class can appear within the compilation unit without being prefixed with a package name for the class.

2. The method of claim 1 , wherein a given static member of a class can include:

a static method;

a static field associated with a constant;

a static field associated with a variable; and

a member class.

3. The method of claim 1 , wherein the static import declaration can include:

a single-static-import declaration that imports a single static member of the class; and

a static-import-on-demand declaration that imports static members of the class as needed.

4. The method of claim 1 , wherein the class is defined within an object-oriented programming system.

5. The method of claim 1 , further comprising importing one or more classes for the compilation unit, whereby a name for a given imported class can be used within the compilation unit without being prefixed with a name for a package containing the given imported class.

6. The method of claim 1 , further comprising using a set of name resolution rules to resolve name ambiguities that arise as a consequence of static import declarations.

7. The method of claim 6 , wherein a given name resolution rule gives priority to a single-member-import declaration, which imports a single static member of a class, over a member-import-on-demand declaration, which imports static members of a class as needed.

8. The method of claim 1 , wherein the static import declaration includes the keyword “static”.

9. A computer-readable storage medium storing instructions that when executed by a computer cause the computer to perform a method that facilitates importing static members of a class, the method comprising:

receiving a compilation unit containing code to be compiled;

examining code associated with the compilation unit to locate a static import declaration that identifies one or more static members of the class to import, wherein the one or more static members are defined in a package other than the one to which the compilation unit containing the static import statement belongs; and

upon finding such a static import declaration, recording the static import declaration in a symbol table used to compile the compilation unit;

wherein the names for the one or more static members of the class can appear within the compilation unit without being prefixed with a package name for the class.

10. The computer-readable storage medium of claim 9 , wherein a given static member of a class can include:

a static method;

a static field associated with a constant;

a static field associated with a variable; and

a member class.

11. The computer-readable storage medium of claim 9 , wherein the static import declaration can include:

a single-static-import declaration that imports a single static member of the class; and

a static-import-on-demand declaration that imports static members of the class as needed.

12. The computer-readable storage medium of claim 9 , wherein the class is defined within an object-oriented programming system.

13. The computer-readable storage medium of claim 9 , wherein the method further comprises importing one or more classes for the compilation unit, whereby a name for a given imported class can be used within the compilation unit without being prefixed with a name for a package containing the given imported class.

14. The computer-readable storage medium of claim 9 , wherein the method further comprises using a set of name resolution rules to resolve name ambiguities that arise as a consequence of static import declarations.

15. The computer-readable storage medium of claim 14 , wherein a given name resolution rule gives priority to a single-member-import declaration, which imports a single static member of a class, over a member-import-on-demand declaration, which imports static members of a class as needed.

16. The computer-readable storage medium of claim 9 , wherein the static import declaration includes the keyword “static”.

Assignments (2)
MERGER AND CHANGE OF NAME Recorded Dec 16, 2015
From: ORACLE USA, INC.; SUN MICROSYSTEMS, INC.; ORACLE AMERICA, INC.
To: ORACLE AMERICA, INC.
Reel/Frame 037302/0719 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 9, 2002
From: BLOCH, JOSHUA J.; STEELE, GUY L.
To: SUN MICROSYSTEMS, INC.
Reel/Frame 013283/0426 →