RFR 8081638: JShell tool: Improve completion for static import

Jan Lahoda jan.lahoda at oracle.com
Wed Jun 3 08:51:06 UTC 2015


Hi Shinya,

Overall looks good, thanks! Two comments:
-it seems that it might make sense to create a single method that would 
for a TreePath look up the enclosing ImportTree, if any, and that would 
be used in the other methods. Something like:
     public ImportTree findImport(TreePath tp) {
         switch (tp.getParentPath().getLeaf().getKind()) {
         case MEMBER_SELECT:
             return findImport(tp.getParentPath());
         case IMPORT:
             return (ImporTree) tp.getLeaf();
         default:
             return null;
         }
     }

And this would then be used to detect if TreePath is inside the import 
(isImport) and to detect static imports. Note there is another usecase 
for such detection in computeSuggestions in the IDENTIFIER identifier 
section.

-membersOf has parameter isStaticContext, which in fact mean 
"shouldGenerateDotClassItem" - would it make sense to rename the parameter?

Thanks,
    Jan

On 2.6.2015 06:12, ShinyaYoshida wrote:
> Hi Jan,
> Please review this patch:
>
> webrev:
> http://cr.openjdk.java.net/~shinyafox/kulla/8081638/webrev.00/
>
> bugs:
> https://bugs.openjdk.java.net/browse/JDK-8081638
>
> Regards,
> shinyafox(Shinya Yoshida)
>


More information about the kulla-dev mailing list