tmysik commented on code in PR #5900:
URL: https://github.com/apache/netbeans/pull/5900#discussion_r1184696397
##########
php/php.editor/src/org/netbeans/modules/php/editor/actions/FixUsesPerformer.java:
##########
@@ -631,13 +757,221 @@ private int getOffsetWithoutLeadingWhitespaces(final int
startOffset) {
return result;
}
+ private int getOffsetWithoutFollowingWhitespaces(final int endOffset) {
+ int result = endOffset;
+ baseDocument.readLock();
+ try {
+ TokenSequence<PHPTokenId> ts =
LexUtilities.getPHPTokenSequence(baseDocument, endOffset);
+ if (ts != null) {
+ ts.move(endOffset);
+ while (ts.moveNext() &&
ts.token().id().equals(PHPTokenId.WHITESPACE)) {
+ result = ts.offset() + ts.token().length();
+ }
+ }
+ } finally {
+ baseDocument.readUnlock();
+ }
+ return result;
+ }
+
+ private class UsesInsertStringHelper {
+ private final Map<Integer, OffsetRange> usedRanges;
+ private final boolean appendUses;
+ private final boolean hasMultipleUses;
+ private StringBuilder resultString = new StringBuilder();
+ private Set<Integer> followingWhitespaceReplaceOffset = new
HashSet<>();
+ private Set<Integer> savedHeadingWhitespaceOffset = new HashSet<>();
Review Comment:
Yes, please, make all the fields `final`, if possible (and call `.clear()`
and similarly, if needed).
--
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: [email protected]
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