lahodaj commented on a change in pull request #2804:
URL: https://github.com/apache/netbeans/pull/2804#discussion_r595115500
##########
File path: java/java.source.base/src/org/netbeans/api/java/source/TreeMaker.java
##########
@@ -1224,6 +1224,10 @@ public Tree BindingPattern(CharSequence name,
Tree type) {
return delegate.BindingPattern(name, type);
}
+
+ public Tree BindingPattern(VariableTree vt) {
Review comment:
It would be good to have `@since` flag here, and the module's
specification version updated, + ideally apichanges.xml updated.
Also, possibly, deprecate the old API method above?
##########
File path:
java/java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertToPatternInstanceOf.java
##########
@@ -89,7 +90,9 @@ public Void visitTypeCast(TypeCastTree node, Void p) {
TypeMirror typeITM =
ctx.getInfo().getTrees().getTypeMirror(typeI);
List<String> varNameCandidates =
org.netbeans.modules.editor.java.Utilities.varNamesSuggestions(typeITM,
ElementKind.LOCAL_VARIABLE, EnumSet.noneOf(Modifier.class), null, null,
ctx.getInfo().getTypes(), ctx.getInfo().getElements(), Collections.emptyList(),
CodeStyle.getDefault(ctx.getInfo().getFileObject()));
String varName = Utilities.makeNameUnique(ctx.getInfo(),
ctx.getInfo().getTrees().getScope(ctx.getPath()), varNameCandidates.get(0));
- Fix fix = new FixImpl(ctx.getInfo(), ctx.getPath(), varName,
false, convertPath).toEditorFix();
+ IfTree it = (IfTree) ctx.getPath().getLeaf();
Review comment:
FWIW, I'd be fine if this hint only supported JDK 16+, and the final
version of pattern matching in instanceof - hopefully that would make things a
little easier. But not that strong opinion.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
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