[ 
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-09-a.diff

Attaching derby-6169-09-a.diff which touches some classes under 
impl.sql.execute that are used to pass information between impl.sql.compile and 
impl.sql.execute. They are created by impl.sql.compile code, so their 
constructors need to stay public, but their fields are typically only accessed 
by impl.sql.execute code, so they don't need to be public, like many of them 
currently are.

The patch reduces the visibility of the fields in these classes to private or 
package. (One field actually needed to be accessed outside of the package, and 
a public accessor was added and the field was made non-public.) Also, a couple 
of accessor methods were changed from public to package.

Additionally, the public constructors were changed to create defensive copies 
of mutable arrays so that they cannot be modified directly by code in other 
packages. The copying does impose a small overhead. However, since these 
constructors are only called during compilation of CREATE TABLE, ALTER TABLE, 
GRANT and REVOKE, that cost should be negligible and probably worth the 
improved protection of the internal state of these classes.

All tests ran cleanly 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, 
> derby-6169-08-a.diff, derby-6169-09-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