1010import com .intellij .psi .ElementManipulator ;
1111import com .intellij .psi .ElementManipulators ;
1212import com .intellij .psi .PsiElement ;
13- import com .intellij .psi .PsiLiteral ;
1413import com .intellij .psi .PsiMethod ;
1514import com .intellij .psi .PsiReference ;
1615import com .intellij .psi .PsiType ;
@@ -37,7 +36,7 @@ abstract class MapstructBaseReference extends BaseReference {
3736 * @param previous the previous reference ({@code null} if there is no previous reference)
3837 * @param rangeInElement the range in the {@code element} for which this reference is valid
3938 */
40- MapstructBaseReference (@ NotNull PsiLiteral element ,
39+ MapstructBaseReference (@ NotNull PsiElement element ,
4140 @ Nullable MapstructBaseReference previous , TextRange rangeInElement ) {
4241 super ( element , rangeInElement );
4342 this .previous = previous ;
@@ -127,7 +126,7 @@ public final Object[] getVariants() {
127126 abstract PsiType resolvedType ();
128127
129128 @ Override
130- public PsiElement handleElementRename (String newElementName ) throws IncorrectOperationException {
129+ public PsiElement handleElementRename (@ NotNull String newElementName ) throws IncorrectOperationException {
131130 PsiElement reference = resolve ();
132131 if ( reference instanceof PsiMethod ) {
133132 return super .handleElementRename ( MapstructUtil .getPropertyName ( newElementName ) );
@@ -137,24 +136,24 @@ public PsiElement handleElementRename(String newElementName) throws IncorrectOpe
137136 }
138137 }
139138
140- private static ElementManipulator <PsiLiteral > getManipulator (PsiLiteral psiLiteral ) {
141- return ElementManipulators .getNotNullManipulator ( psiLiteral );
139+ private static ElementManipulator <PsiElement > getManipulator (PsiElement psiElement ) {
140+ return ElementManipulators .getNotNullManipulator ( psiElement );
142141 }
143142
144143 /**
145144 * Create all the references for the provided {@code psiLiteral}.
146145 *
147- * @param psiLiteral the literal that contain
146+ * @param psiElement the literal that contain
148147 * @param creator The creator that should be used to create new references
149148 * @param <T> the type of the reference that needs to be created
150149 *
151150 * @return the array of all the references
152151 */
153- static <T extends MapstructBaseReference > PsiReference [] create (PsiLiteral psiLiteral ,
152+ static <T extends MapstructBaseReference > PsiReference [] create (PsiElement psiElement ,
154153 ReferenceCreator <T > creator ) {
155- ElementManipulator <PsiLiteral > manipulator = getManipulator ( psiLiteral );
156- TextRange rangeInElement = manipulator .getRangeInElement ( psiLiteral );
157- String targetValue = rangeInElement .substring ( psiLiteral .getText () );
154+ ElementManipulator <PsiElement > manipulator = getManipulator ( psiElement );
155+ TextRange rangeInElement = manipulator .getRangeInElement ( psiElement );
156+ String targetValue = rangeInElement .substring ( psiElement .getText () );
158157 String [] parts = targetValue .split ( "\\ ." );
159158 if ( parts .length == 0 ) {
160159 return PsiReference .EMPTY_ARRAY ;
@@ -171,7 +170,7 @@ static <T extends MapstructBaseReference> PsiReference[] create(PsiLiteral psiLi
171170 nextStart ++;
172171 endOffset ++;
173172 }
174- lastReference = creator .create ( psiLiteral , lastReference , new TextRange ( nextStart , endOffset ) );
173+ lastReference = creator .create ( psiElement , lastReference , new TextRange ( nextStart , endOffset ) );
175174 nextStart = endOffset ;
176175 references [i ] = lastReference ;
177176 }
0 commit comments