errael commented on a change in pull request #2126:
URL: https://github.com/apache/netbeans/pull/2126#discussion_r419178065
##########
File path:
java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -535,8 +535,18 @@ public int endPos(JCTree t) {
VariableTree vt = fgt.getVariables().get(fgt.getVariables().size()
- 1);
return TreeInfo.getEndPos((JCTree)vt, oldTopLevel.endPositions);
}
- return TreeInfo.getEndPos(t, oldTopLevel.endPositions);
+ int endPos = TreeInfo.getEndPos(t, oldTopLevel.endPositions);
+
+ // [NETBEANS-4299], catch a synthetic annotation attribute and try rhs
+ if (endPos == Position.NOPOS && t instanceof JCAssign) {
+ JCAssign assign = (JCAssign)t;
+ if (assign.lhs instanceof JCIdent
+ && ((JCIdent)assign.lhs).sym instanceof
Symbol.MethodSymbol) {
Review comment:
Simplified. Since first check is NOPOS, probably doesn't matter how much
stuff is done; but I like simple. My manual tests passed.
BTW, I'm assuming endPos of assignment, is endPos of assignment.rhs in
general.
Do you believe this is safe for 12.0? There's that milestone thingy...
And/or might add @ebarboni as reviewer.
----------------------------------------------------------------
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