• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package annotator.find;
2 
3 /**
4  * This insertion adds two closing parentheses to close the unclosed parentheses
5  * left by a {@link CastInsertion}. This should be inserted after the expression
6  * that's being casted.
7  */
8 public class CloseParenthesisInsertion extends Insertion {
9 
CloseParenthesisInsertion(Criteria criteria, boolean separateLine)10     public CloseParenthesisInsertion(Criteria criteria,
11             boolean separateLine) {
12         super(criteria, separateLine);
13     }
14 
15     /** {@inheritDoc} */
16     @Override
getText(boolean comments, boolean abbreviate)17     protected String getText(boolean comments, boolean abbreviate) {
18         return "))";
19     }
20 
21     /** {@inheritDoc} */
22     @Override
addLeadingSpace(boolean gotSeparateLine, int pos, char precedingChar)23     protected boolean addLeadingSpace(boolean gotSeparateLine, int pos,
24             char precedingChar) {
25         // Never add a leading space when inserting closing parentheses.
26         return false;
27     }
28 
29     /** {@inheritDoc} */
30     @Override
addTrailingSpace(boolean gotSeparateLine)31     protected boolean addTrailingSpace(boolean gotSeparateLine) {
32         // Never add a trailing space when inserting closing parentheses.
33         return false;
34     }
35 
36     /** {@inheritDoc} */
getKind()37     public Kind getKind() {
38         return Kind.CLOSE_PARENTHESIS;
39     }
40 }
41