mbien commented on code in PR #8220: URL: https://github.com/apache/netbeans/pull/8220#discussion_r1938498170
########## java/java.hints/src/org/netbeans/modules/java/hints/OrganizeMembers.java: ########## @@ -123,48 +123,41 @@ private static void doOrganizeMembers(WorkingCopy copy, TreePath path) { clazz = gu.importComments(clazz, copy.getCompilationUnit()); TreeMaker maker = copy.getTreeMaker(); ClassTree nue = maker.Class(clazz.getModifiers(), clazz.getSimpleName(), clazz.getTypeParameters(), clazz.getExtendsClause(), clazz.getImplementsClause(), Collections.<Tree>emptyList()); - List<Tree> members = new ArrayList<>(clazz.getMembers().size()); - Map<Tree, Tree> memberMap = new HashMap<>(clazz.getMembers().size()); + List<Tree> members = new ArrayList<>(); + Map<Tree, Tree> memberMap = new HashMap<>(); - List<Tree> enumValues = new ArrayList<>(); + List<Tree> fixedMembers = new ArrayList<>(); for (Tree tree : clazz.getMembers()) { - if (copy.getTreeUtilities().isSynthetic(new TreePath(path, tree))) { + if (copy.getTreeUtilities().isSynthetic(new TreePath(path, tree)) + && !(tree.getKind() == Kind.VARIABLE && copy.getTreeUtilities().isRecordComponent((VariableTree)tree))) { Review Comment: please note that the `!isRecordComponent()` check is currently redundant since `isSynthetic()` does currently not return true for synthetic record members, representing the record components. inserting ```java if (path.getLeaf().getKind() == Kind.VARIABLE && path.getParentPath() != null && path.getParentPath().getLeaf().getKind() == Kind.RECORD) { Set<Modifier> mods = ((VariableTree) path.getLeaf()).getModifiers().getFlags(); if (!mods.contains(Modifier.STATIC)) { return true; // all non static record fields are synthetic } } ``` to https://github.com/apache/netbeans/blob/e38f61876b02c5f47b0a4b019426812e54c2689f/java/java.source.base/src/org/netbeans/api/java/source/TreeUtilities.java#L212 would update it but it could break other things -- 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. To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists