[ 
https://issues.apache.org/jira/browse/DERBY-6169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-6169:
--------------------------------------

    Attachment: derby-6169-07-a.diff

derby-6169-07-a.diff improves the encapsulation of the array of ProviderInfo 
objects returned by CreateViewNode.getProviderInfo().

The getProviderInfo() method has to be public because it is used outside of the 
impl.sql.compile package in which CreateViewNode lives. Instead of reducing the 
visibility of the method, the patch makes getProviderInfo() return an immutable 
list view of the array, so that callers cannot accidentally change the internal 
array. Since this method is currently only called while invalidating a view, I 
don't think there are any performance concerns with adding a thin wrapper 
around the array.

The patch also reduces the visibility of all fields in CreateViewNode and 
BasicProviderInfo to private, and BasicProviderInfo's constructor to package 
private, in order to further protect the internal state of these classes.

All tests passed with the patch.
                
> Reduce visibility of classes and methods under impl/sql
> -------------------------------------------------------
>
>                 Key: DERBY-6169
>                 URL: https://issues.apache.org/jira/browse/DERBY-6169
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.11.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: derby-6169-01-a.diff, derby-6169-02-a.diff, 
> derby-6169-03-a.diff, derby-6169-04-a.diff, derby-6169-05-a.diff, 
> derby-6169-06-a.diff, derby-6169-06-b.diff, derby-6169-07-a.diff
>
>
> My IDE shows many warnings in the classes under impl/sql because they are 
> public and may make parts of the internal state more visible than necessary. 
> I'd like to reduce the visibility of classes and methods, if possible, to 
> make it clearer to IDEs and tools that perform static analysis that the code 
> is only accessed from the same package, and reduce some of the noise from the 
> tools.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to