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 2021/03/11 13:33:18 UTC
[GitHub] [netbeans] singh-akhilesh opened a new pull request #2804: [NETBEANS-5008] : Support for finalization of pattern-matching-instance-of feature
singh-akhilesh opened a new pull request #2804:
URL: https://github.com/apache/netbeans/pull/2804
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
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
[GitHub] [netbeans] singh-akhilesh commented on a change in pull request #2804: [NETBEANS-5008] : Support for finalization of pattern-matching-instance-of feature
Posted by GitBox <gi...@apache.org>.
singh-akhilesh commented on a change in pull request #2804:
URL: https://github.com/apache/netbeans/pull/2804#discussion_r599482787
##########
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:
Addressed code review comments.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
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
[GitHub] [netbeans] singh-akhilesh merged pull request #2804: [NETBEANS-5008] : Support for finalization of pattern-matching-instance-of feature
Posted by GitBox <gi...@apache.org>.
singh-akhilesh merged pull request #2804:
URL: https://github.com/apache/netbeans/pull/2804
--
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:
users@infra.apache.org
---------------------------------------------------------------------
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
[GitHub] [netbeans] singh-akhilesh commented on a change in pull request #2804: [NETBEANS-5008] : Support for finalization of pattern-matching-instance-of feature
Posted by GitBox <gi...@apache.org>.
singh-akhilesh commented on a change in pull request #2804:
URL: https://github.com/apache/netbeans/pull/2804#discussion_r599480355
##########
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:
Thanks for providing the comment. This method name cannot be changed because we are following the same naming convention present in the JDK 16 TreeMaker. https://github.com/openjdk/jdk/blob/master/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeMaker.java.
public JCBindingPattern BindingPattern(JCVariableDecl var) {
JCBindingPattern tree = new JCBindingPattern(var);
tree.pos = pos;
return tree;
}
--
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:
users@infra.apache.org
---------------------------------------------------------------------
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
[GitHub] [netbeans] lahodaj commented on a change in pull request #2804: [NETBEANS-5008] : Support for finalization of pattern-matching-instance-of feature
Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org
---------------------------------------------------------------------
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
[GitHub] [netbeans] singh-akhilesh commented on a change in pull request #2804: [NETBEANS-5008] : Support for finalization of pattern-matching-instance-of feature
Posted by GitBox <gi...@apache.org>.
singh-akhilesh commented on a change in pull request #2804:
URL: https://github.com/apache/netbeans/pull/2804#discussion_r599484111
##########
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:
I believe its better to keep this at least for this release. As many people using below JDK-16 version. Thanks.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
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
[GitHub] [netbeans] lyndseyBeil commented on a change in pull request #2804: [NETBEANS-5008] : Support for finalization of pattern-matching-instance-of feature
Posted by GitBox <gi...@apache.org>.
lyndseyBeil commented on a change in pull request #2804:
URL: https://github.com/apache/netbeans/pull/2804#discussion_r599641701
##########
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:
Notced.
Thanks.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
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
[GitHub] [netbeans] lyndseyBeil commented on a change in pull request #2804: [NETBEANS-5008] : Support for finalization of pattern-matching-instance-of feature
Posted by GitBox <gi...@apache.org>.
lyndseyBeil commented on a change in pull request #2804:
URL: https://github.com/apache/netbeans/pull/2804#discussion_r598319264
##########
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:
I detect that this code is problematic. According to the [Bad practice (BAD_PRACTICE)](https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html#bad-practice-bad-practice), [Nm: Method names should start with a lower case letter (NM_METHOD_NAMING_CONVENTION)](https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html#nm-method-names-should-start-with-a-lower-case-letter-nm-method-naming-convention).
Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
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