mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-07-27 04:03:29 +07:00
Drop PsiElementArrayConstructor in a favor of ArrayFactory
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,9 +15,10 @@
|
||||
*/
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.util.ArrayFactory;
|
||||
|
||||
/**
|
||||
* Represents a PSI element which can be used as the value of an annotation
|
||||
* element.
|
||||
* Represents a PSI element which can be used as the value of an annotation element.
|
||||
*
|
||||
* @author ven
|
||||
*/
|
||||
@@ -26,4 +27,11 @@ public interface PsiAnnotationMemberValue extends PsiElement {
|
||||
* The empty array of PSI annotation member values which can be reused to avoid unnecessary allocations.
|
||||
*/
|
||||
PsiAnnotationMemberValue[] EMPTY_ARRAY = new PsiAnnotationMemberValue[0];
|
||||
|
||||
ArrayFactory<PsiAnnotationMemberValue> ARRAY_FACTORY = new ArrayFactory<PsiAnnotationMemberValue>() {
|
||||
@Override
|
||||
public PsiAnnotationMemberValue[] create(final int count) {
|
||||
return count == 0 ? PsiAnnotationMemberValue.EMPTY_ARRAY : new PsiAnnotationMemberValue[count];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.util.ArrayFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -31,6 +32,13 @@ public interface PsiCatchSection extends PsiElement {
|
||||
*/
|
||||
PsiCatchSection[] EMPTY_ARRAY = new PsiCatchSection[0];
|
||||
|
||||
ArrayFactory<PsiCatchSection> ARRAY_FACTORY = new ArrayFactory<PsiCatchSection>() {
|
||||
@Override
|
||||
public PsiCatchSection[] create(final int count) {
|
||||
return count == 0 ? PsiCatchSection.EMPTY_ARRAY : new PsiCatchSection[count];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the variable in which the caught exception is captured.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.util.ArrayFactory;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.NullableFunction;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -28,6 +29,13 @@ public interface PsiExpression extends PsiAnnotationMemberValue {
|
||||
*/
|
||||
PsiExpression[] EMPTY_ARRAY = new PsiExpression[0];
|
||||
|
||||
ArrayFactory<PsiExpression> ARRAY_FACTORY = new ArrayFactory<PsiExpression>() {
|
||||
@Override
|
||||
public PsiExpression[] create(final int count) {
|
||||
return count == 0 ? PsiExpression.EMPTY_ARRAY : new PsiExpression[count];
|
||||
}
|
||||
};
|
||||
|
||||
Function<PsiExpression, PsiType> EXPRESSION_TO_TYPE = new NullableFunction<PsiExpression, PsiType>() {
|
||||
@Override
|
||||
public PsiType fun(final PsiExpression expression) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.util.ArrayFactory;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -32,6 +33,13 @@ public interface PsiNameValuePair extends PsiElement {
|
||||
*/
|
||||
PsiNameValuePair[] EMPTY_ARRAY = new PsiNameValuePair[0];
|
||||
|
||||
ArrayFactory<PsiNameValuePair> ARRAY_FACTORY = new ArrayFactory<PsiNameValuePair>() {
|
||||
@Override
|
||||
public PsiNameValuePair[] create(final int count) {
|
||||
return count == 0 ? PsiNameValuePair.EMPTY_ARRAY : new PsiNameValuePair[count];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the identifier specifying the name of the element.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.util.ArrayFactory;
|
||||
|
||||
/**
|
||||
* Represents a Java statement.
|
||||
*/
|
||||
@@ -23,4 +25,11 @@ public interface PsiStatement extends PsiElement {
|
||||
* The empty array of PSI statements which can be reused to avoid unnecessary allocations.
|
||||
*/
|
||||
PsiStatement[] EMPTY_ARRAY = new PsiStatement[0];
|
||||
|
||||
ArrayFactory<PsiStatement> ARRAY_FACTORY = new ArrayFactory<PsiStatement>() {
|
||||
@Override
|
||||
public PsiStatement[] create(final int count) {
|
||||
return count == 0 ? PsiStatement.EMPTY_ARRAY : new PsiStatement[count];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.util.ArrayFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -28,6 +29,13 @@ public interface PsiTypeElement extends PsiElement,PsiAnnotationOwner {
|
||||
*/
|
||||
PsiTypeElement[] EMPTY_ARRAY = new PsiTypeElement[0];
|
||||
|
||||
ArrayFactory<PsiTypeElement> ARRAY_FACTORY = new ArrayFactory<PsiTypeElement>() {
|
||||
@Override
|
||||
public PsiTypeElement[] create(final int count) {
|
||||
return count == 0 ? EMPTY_ARRAY : new PsiTypeElement[count];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the type referenced by the type element.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user