mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-22 14:31:25 +07:00
lambda: primitive array type constructors fixed (IDEA-102836)
This commit is contained in:
@@ -242,9 +242,17 @@ public class LambdaCanBeMethReferenceInspection extends BaseJavaLocalInspectionT
|
||||
}
|
||||
}
|
||||
}
|
||||
final PsiType newExprType = ((PsiNewExpression)element).getType();
|
||||
if (containingClass != null) {
|
||||
methodRefText = getClassReferenceName(containingClass);
|
||||
final PsiType newExprType = ((PsiNewExpression)element).getType();
|
||||
} else if (newExprType instanceof PsiArrayType){
|
||||
final PsiType deepComponentType = newExprType.getDeepComponentType();
|
||||
if (deepComponentType instanceof PsiPrimitiveType) {
|
||||
methodRefText = deepComponentType.getCanonicalText();
|
||||
}
|
||||
}
|
||||
|
||||
if (methodRefText != null) {
|
||||
if (newExprType != null) {
|
||||
int dim = newExprType.getArrayDimensions();
|
||||
while (dim-- > 0) {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
class Example {
|
||||
interface Jjj {
|
||||
int[] jjj(int p);
|
||||
}
|
||||
|
||||
{
|
||||
Jjj jjj = int[]::new;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
class Example {
|
||||
interface Jjj {
|
||||
int[] jjj(int p);
|
||||
}
|
||||
|
||||
{
|
||||
Jjj jjj = (p) -> new i<caret>nt[p];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user