Skip to content

Commit 7085060

Browse files
committed
Reformatted code, rename method
fixed projectlombok#472: updated changelog fixed projectlombok#531: updated changelog
1 parent 0438da4 commit 7085060

File tree

5 files changed

+22
-36
lines changed

5 files changed

+22
-36
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cache:
1313

1414
env:
1515
- IDEA_VERSION=LATEST-EAP-SNAPSHOT
16-
- IDEA_VERSION=IC-2018.2.4
16+
- IDEA_VERSION=IC-2018.2.5
1717
- IDEA_VERSION=IC-2018.2
1818
- IDEA_VERSION=IC-2018.1.6
1919
- IDEA_VERSION=IC-2018.1

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#ideaVersion=2017.3
88
#ideaVersion=2017.3.5
99
#ideaVersion=2018.1
10-
ideaVersion=2018.1.6
10+
#ideaVersion=2018.1.6
1111
#ideaVersion=2018.2
12-
#ideaVersion=2018.2.4
12+
ideaVersion=2018.2.5
1313
#ideaVersion=183.2153.8
1414
#ideaVersion=183.2940.10
1515
#ideaVersion=LATEST-EAP-SNAPSHOT

parts/pluginChanges.html

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<li>Performance improvements #516: Editor UI freezes when editing a particular class</li>
55
<li>Fixed #504: Added Support for Delombok of @EqualsAndHashcode and @ToString Exclude/Include annotations</li>
66
<li>Fixed #507: @Value and @FieldDefaults should skip static fields</li>
7+
<li>Fixed #472: Lombok should not interfer with java 10 'var'</li>
8+
<li>Fixed #531: Inspection for Lombok annotations incorrectly highlights 'var'</li>
79
</ol>
810
</li>
911
<li>0.21

src/main/java/de/plushnikov/intellij/plugin/processor/ValProcessor.java

+15-33
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,7 @@
77
import com.intellij.openapi.project.Project;
88
import com.intellij.openapi.util.Computable;
99
import com.intellij.openapi.util.RecursionManager;
10-
import com.intellij.psi.PsiAnnotation;
11-
import com.intellij.psi.PsiArrayInitializerExpression;
12-
import com.intellij.psi.PsiClass;
13-
import com.intellij.psi.PsiConditionalExpression;
14-
import com.intellij.psi.PsiDeclarationStatement;
15-
import com.intellij.psi.PsiDiamondType;
16-
import com.intellij.psi.PsiElement;
17-
import com.intellij.psi.PsiExpression;
18-
import com.intellij.psi.PsiForStatement;
19-
import com.intellij.psi.PsiForeachStatement;
20-
import com.intellij.psi.PsiJavaCodeReferenceElement;
21-
import com.intellij.psi.PsiLambdaExpression;
22-
import com.intellij.psi.PsiLocalVariable;
23-
import com.intellij.psi.PsiNewExpression;
24-
import com.intellij.psi.PsiParameter;
25-
import com.intellij.psi.PsiReferenceParameterList;
26-
import com.intellij.psi.PsiType;
27-
import com.intellij.psi.PsiTypeElement;
10+
import com.intellij.psi.*;
2811
import com.intellij.psi.search.GlobalSearchScope;
2912
import com.intellij.psi.util.TypeConversionUtil;
3013
import de.plushnikov.intellij.plugin.problem.LombokProblem;
@@ -47,36 +30,34 @@ public ValProcessor() {
4730
}
4831

4932
public static boolean isVal(@NotNull PsiLocalVariable psiLocalVariable) {
50-
return psiLocalVariable.getInitializer() != null && isSameName(resolveQualifiedName(psiLocalVariable.getTypeElement()));
33+
return psiLocalVariable.getInitializer() != null && isVal(resolveQualifiedName(psiLocalVariable.getTypeElement()));
5134
}
5235

5336
public static boolean isValOrVar(@NotNull PsiLocalVariable psiLocalVariable) {
5437
return psiLocalVariable.getInitializer() != null && isValOrVar(psiLocalVariable.getTypeElement());
5538
}
5639

57-
private static boolean isSameName(@Nullable String className) {
58-
return LOMBOK_VAL_FQN.equals(className);
40+
private static boolean isVal(@Nullable String fullQualifiedName) {
41+
return LOMBOK_VAL_FQN.equals(fullQualifiedName);
5942
}
6043

61-
private static boolean isVar(@Nullable String className) {
62-
return LOMBOK_VAR_FQN.equals(className) || LOMBOK_VAR_EXPERIMENTAL_FQN.equals(className);
44+
private static boolean isVar(@Nullable String fullQualifiedName) {
45+
return LOMBOK_VAR_FQN.equals(fullQualifiedName) || LOMBOK_VAR_EXPERIMENTAL_FQN.equals(fullQualifiedName);
6346
}
6447

6548
private static boolean isValOrVar(@Nullable PsiTypeElement typeElement) {
6649
String className = resolveQualifiedName(typeElement);
67-
return isSameName(className) || isVar(className);
50+
return isVal(className) || isVar(className);
6851
}
6952

7053
@Nullable
71-
private static String resolveQualifiedName(@Nullable PsiTypeElement typeElement)
72-
{
54+
private static String resolveQualifiedName(@Nullable PsiTypeElement typeElement) {
7355
if (typeElement == null) {
7456
return null;
7557
}
7658

7759
PsiJavaCodeReferenceElement reference = typeElement.getInnermostComponentReferenceElement();
78-
if (reference == null)
79-
{
60+
if (reference == null) {
8061
return null;
8162
}
8263

@@ -105,8 +86,9 @@ public Collection<LombokProblem> verifyAnnotation(@NotNull PsiAnnotation psiAnno
10586
}
10687

10788
public void verifyVariable(@NotNull final PsiLocalVariable psiLocalVariable, @NotNull final ProblemsHolder holder) {
108-
boolean isVal = isSameName(resolveQualifiedName(psiLocalVariable.getTypeElement()));
109-
boolean isVar = isVar(resolveQualifiedName(psiLocalVariable.getTypeElement()));
89+
final String qualifiedName = resolveQualifiedName(psiLocalVariable.getTypeElement());
90+
boolean isVal = isVal(qualifiedName);
91+
boolean isVar = isVar(qualifiedName);
11092
final String ann = isVal ? "val" : "var";
11193
if (isVal || isVar) {
11294
final PsiExpression initializer = psiLocalVariable.getInitializer();
@@ -126,9 +108,9 @@ public void verifyVariable(@NotNull final PsiLocalVariable psiLocalVariable, @No
126108
}
127109

128110
public void verifyParameter(@NotNull final PsiParameter psiParameter, @NotNull final ProblemsHolder holder) {
129-
final PsiTypeElement typeElement = psiParameter.getTypeElement();
130-
boolean isVal = null != typeElement && isSameName(resolveQualifiedName(typeElement));
131-
boolean isVar = null != typeElement && isVar(resolveQualifiedName(typeElement));
111+
final String qualifiedName = resolveQualifiedName(psiParameter.getTypeElement());
112+
boolean isVal = isVal(qualifiedName);
113+
boolean isVar = isVar(qualifiedName);
132114
if (isVar || isVal) {
133115
PsiElement scope = psiParameter.getDeclarationScope();
134116
boolean isForeachStatement = scope instanceof PsiForeachStatement;

src/main/resources/messages/lombokBundle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Fixes:<br/>\
2525
- Performance improvements (<a href="https://github.com/mplushnikov/lombok-intellij-plugin/issues/516">#516</a>): Editor UI freezes when editing a particular class<br>\
2626
- Fixed (<a href="https://github.com/mplushnikov/lombok-intellij-plugin/issues/504">#504</a>): Added Support for Delombok of @EqualsAndHashcode. and @ToString.Exclude/Include annotations<br>\
2727
- Fixed (<a href="https://github.com/mplushnikov/lombok-intellij-plugin/issues/507">#507</a>): @Value and @FieldDefaults should skip static fields<br>\
28+
- Fixed (<a href="https://github.com/mplushnikov/lombok-intellij-plugin/issues/472">#472</a>): Lombok should not interfer with java 10 'var'<br>\
29+
- Fixed (<a href="https://github.com/mplushnikov/lombok-intellij-plugin/issues/531">#531</a>): Inspection for Lombok annotations incorrectly highlights 'var'<br>\
2830
<br>\
2931
If you find my plugin helpful, donate me using <br><b>\
3032
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\\&hosted_button_id=3F9HXD7A2SMCN">PayPal</a>\

0 commit comments

Comments
 (0)