<Swing Dev> Review request #3: 6852592 (revalidate() must be smarter)

Anthony Petrov Anthony.Petrov at Sun.COM
Tue Jul 28 09:54:39 UTC 2009


Hello Alex,

On 07/27/2009 10:54 PM, Anthony Petrov wrote:
>> 1) Bring isValidateRoot() up to the Component class
>> 2) Make it return false
>> 3) Leave all other stuff intact
> 
> The current fix does almost that with a few exceptions. Could you please 
> describe at what exact cases promoting the isValidateRoot() to the 
> Component instead of the Container might help? Any concrete existing 
> methods/examples? Unfortunately I hardly see any, but maybe it's just me...

On the second thought, as far as I can grep, I see that currently only 
RepaintManager.addInvalidComponent(JComponent) uses the isValidateRoot() 
method. So I assume you mean exactly this piece of code, please correct 
me if I'm wrong.

Let me please suggest a couple of possible solutions:

1. What about making the 'c' variable a Container instead of the 
Component at the first loop of the addInvalidComponent() method? Would 
it require promoting isValidateRoot() up to the Component afterwards? 
Obviously, no additional type casting or instanceof-checking is required 
after that change.

2. What about introducing a Component.getValidateRoot() method instead?

I would also like to mention that since you claim that 6862117 is not a 
bug, then there's actually no any known issue that would require any 
changes to the addInvalidComponent() right now - generally we don't have 
any "problem" at all.

Given that:

a) there's already at least three possible solutions to this issue,
b) the issue is not directly relevant to the aims of the RFE 6852592,
c) actually the issue is currently quite ephemeral,
d) the method isValidateRoot() does not seem belonging to the Component 
class logically for some developers,
e) the current solution is fully open to any further enhancements and 
does not bring any restrictions,

perhaps the discussion regarding further promoting of the method might 
be postponed till a later date.

Would you agree?

--
best regards,
Anthony



More information about the swing-dev mailing list