You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/05/31 10:20:21 UTC

[GitHub] rtaneja1 commented on a change in pull request #563: [NETBEANS-774] Disable var hint for anonymous type

rtaneja1 commented on a change in pull request #563: [NETBEANS-774] Disable var hint for anonymous type
URL: https://github.com/apache/incubator-netbeans/pull/563#discussion_r192053319
 
 

 ##########
 File path: java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertVarToExplicitType.java
 ##########
 @@ -152,16 +155,25 @@ private static boolean hasDiagnosticErrors(CompilationInfo info, Tree tree) {
     private static boolean isValidType(HintContext ctx) {
         TreePath treePath = ctx.getPath();
         TreePath initTreePath = ctx.getVariables().get("$init");  //NOI18N
+        TypeMirror variableTypeMirror = ctx.getInfo().getTrees().getElement(treePath).asType();
 
         if (initTreePath.getLeaf().getKind() == Tree.Kind.NEW_CLASS) {
             NewClassTree nct = ((NewClassTree) initTreePath.getLeaf());
             if (nct.getClassBody() != null) {
                 return false;
             }
+        } else if (initTreePath.getLeaf().getKind() == Tree.Kind.METHOD_INVOCATION) {
 
 Review comment:
   Fixed these usecases. Need to handle usecase var v = {new Object()} in the new error hint for array initializer. I'm trying to push that change in same PR.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists