Skip to content

Commit

Permalink
Added fix for projectlombok#156 "Exception in @Singular handling"
Browse files Browse the repository at this point in the history
Removed wrong type cast
  • Loading branch information
Michail Plushnikov committed Jan 13, 2016
1 parent 3245d57 commit 8e2b568
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void addBuilderField(@NotNull List<PsiField> fields, @NotNull PsiVariable

@NotNull
protected PsiType getBuilderFieldType(@NotNull PsiType psiType, @NotNull Project project) {
return PsiTypeUtil.getGenericCollectionClassType((PsiClassType) psiType, project, CommonClassNames.JAVA_UTIL_ARRAY_LIST);
return PsiTypeUtil.getGenericCollectionClassType(psiType, project, CommonClassNames.JAVA_UTIL_ARRAY_LIST);
}

protected void addOneMethodParameter(@NotNull String singularName, @NotNull PsiType[] psiParameterTypes, @NotNull LombokLightMethodBuilder methodBuilder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static PsiType[] extractTypeParameters(@NotNull PsiType psiType, @NotNull
}

@NotNull
public static PsiClassType getGenericCollectionClassType(@NotNull PsiClassType psiType, @NotNull Project project, @NotNull String qualifiedName) {
public static PsiClassType getGenericCollectionClassType(@NotNull PsiType psiType, @NotNull Project project, @NotNull String qualifiedName) {
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
final GlobalSearchScope globalsearchscope = GlobalSearchScope.allScope(project);
Expand Down
1 change: 1 addition & 0 deletions lombok-plugin/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
<ul>
<li>0.9.8
<ol>
<li>Fixed #156: Exception in @Singular handling</li>
<li>Fixed #165: Can't correctly resolve multiple @Builder methods in same class having partial implementations</li>
<li>Fixed #172: "Lombok needs a default constructor in the base class" error in enum</li>
</ol>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
daemon.donate.title=Lombok support plugin updated to v{0}
daemon.donate.content=\
- Fixed (<a href="https://github.com/mplushnikov/lombok-intellij-plugin/issues/156">#156</a>): Exception in @Singular handling<br/>\
- Fixed (<a href="https://github.com/mplushnikov/lombok-intellij-plugin/issues/165">#165</a>): Can't correctly resolve multiple @Builder methods in same class having partial implementations<br/>\
- Fixed (<a href="https://github.com/mplushnikov/lombok-intellij-plugin/issues/172">#172</a>): "Lombok needs a default constructor in the base class" error in enum<br/>\
<br/>\
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package de.plushnikov.builder.issue156;

import lombok.Builder;
import lombok.Singular;

import java.util.HashMap;
import java.util.Map;

public class StringMapBuilder<R> extends HashMap<String, R>{

@Builder
StringMapBuilder(@Singular Map<String, ? extends R> entries) {
super(entries);
}

public static void main(String[] args) {

}
}

0 comments on commit 8e2b568

Please sign in to comment.