rtaneja1 commented on a change in pull request #600: [NETBEANS-862] Added
auto-complete support for var keyword in JDK-11 Lambda Parameters
URL: https://github.com/apache/incubator-netbeans/pull/600#discussion_r199065471
##########
File path:
java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java
##########
@@ -5868,4 +5880,32 @@ private boolean withinBounds(Env env, TypeMirror type,
List<? extends TypeMirror
}
return true;
}
+
+ private void addVarTypeForLambdaParam(final Env env) throws IOException {
+ if (SOURCE_VERSION_RELEASE_11 == null ||
env.getController().getSourceVersion().compareTo(SOURCE_VERSION_RELEASE_11) <
0) {
+ return;
+ }
+
+ //Creating auto-complete 'var' item only for JDK-11 or above and if
element is a functional interface.
+ final CompilationController controller = env.getController();
+ final Types types = controller.getTypes();
+ final Elements elements = controller.getElements();
+ Set<? extends TypeMirror> smartTypes = getSmartTypes(env);
+ if (smartTypes != null) {
+ for (TypeMirror st : smartTypes) {
+ if (st.getKind().isPrimitive()) {
+ st = types.boxedClass((PrimitiveType) st).asType();
+ }
+ if (st.getKind() == TypeKind.DECLARED) {
Review comment:
else here?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists