[gui][PATCH] Add missing Font fields

Bryce McKinlay mckinlay@redhat.com
Wed Nov 3 15:04:00 GMT 2004


Thomas Fitzsimmons wrote:

>On Tue, 2004-11-02 at 17:22, Tom Tromey wrote:
>  
>
>>Tom> 2004-11-02  Thomas Fitzsimmons  <fitzsim@redhat.com>
>>Tom> 	* java/awt/Font.java (name): New field.
>>Tom> 	(size): Likewise.
>>Tom> 	(style): Likewise.
>>
>>This seems a little weird to me, since the new fields aren't actually
>>used anywhere.  Are they supposed to mean something to subclasses?  I
>>understand wanting to have them to claim API compatibility
>>    
>>
>
>Yeah, this is the reason I added them.
>  
>

To me it looks like a bug in the spec - a historical accident. The 
fields should never really have been visible to subclasses. 
Nevertheless, in order to claim compatibility we might as well make sure 
we have them.

>> -- but in
>>this form aren't they sort of like writing stubbed methods?
>>
>>    
>>
>
>Yes, I guess I was being lazy -- I'll commit a patch that sets these
>values in the Font constructors.  I'm not sure how programs use the
>fields though.
>  
>

Presumably, the fields are immutable once set. Since we need the fields 
anyway, I guess getName(), getSize(), etc can now be changed the values 
in the fields. That would be a minor optimization since we avoid a trip 
into the peers, with possible string conversions, etc, each time they're 
called.

Regards

Bryce



More information about the Java-patches mailing list