mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
[lombok] EA-787063 NPE: LombokUtils.buildName
GitOrigin-RevId: 6e85bae849bb3bc3727e3dcdd227c125295c278f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
074a38aae0
commit
1318bcad5e
@@ -5,7 +5,6 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiImplUtil;
|
||||
import com.intellij.psi.impl.source.PsiClassReferenceType;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
import de.plushnikov.intellij.plugin.LombokClassNames;
|
||||
import de.plushnikov.intellij.plugin.processor.field.AccessorsInfo;
|
||||
import de.plushnikov.intellij.plugin.processor.handler.singular.BuilderElementHandler;
|
||||
@@ -15,7 +14,6 @@ import de.plushnikov.intellij.plugin.thirdparty.LombokUtils;
|
||||
import de.plushnikov.intellij.plugin.util.PsiAnnotationSearchUtil;
|
||||
import de.plushnikov.intellij.plugin.util.PsiAnnotationUtil;
|
||||
import de.plushnikov.intellij.plugin.util.PsiClassUtil;
|
||||
import de.plushnikov.intellij.plugin.util.PsiTypeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -105,6 +103,7 @@ public class BuilderInfo {
|
||||
result.hasBuilderDefaultAnnotation = PsiAnnotationSearchUtil.isAnnotatedWith(psiRecordComponent, BUILDER_DEFAULT_ANNOTATION);
|
||||
|
||||
result.fieldInBuilderName = psiRecordComponent.getName();
|
||||
result.capitalizationStrategy = CapitalizationStrategy.defaultValue();
|
||||
|
||||
result.singularAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiRecordComponent, LombokClassNames.SINGULAR);
|
||||
result.builderElementHandler = SingularHandlerFactory.getHandlerFor(psiRecordComponent, null!=result.singularAnnotation);
|
||||
|
||||
@@ -24,8 +24,10 @@ public final class LombokUtils {
|
||||
"androidx.annotation.NonNull",
|
||||
"androidx.annotation.RecentlyNonNull",
|
||||
"com.android.annotations.NonNull",
|
||||
"com.google.firebase.database.annotations.NotNull", // Even though it's in a database package, it does mean semantically: "Check if never null at the language level", and not 'db column cannot be null'.
|
||||
"com.mongodb.lang.NonNull", // Even though mongo is a DB engine, this semantically refers to language, not DB table designs (mongo is a document DB engine, so this isn't surprising perhaps).
|
||||
"com.google.firebase.database.annotations.NotNull",
|
||||
// Even though it's in a database package, it does mean semantically: "Check if never null at the language level", and not 'db column cannot be null'.
|
||||
"com.mongodb.lang.NonNull",
|
||||
// Even though mongo is a DB engine, this semantically refers to language, not DB table designs (mongo is a document DB engine, so this isn't surprising perhaps).
|
||||
"com.sun.istack.NotNull",
|
||||
"com.unboundid.util.NotNull",
|
||||
"edu.umd.cs.findbugs.annotations.NonNull",
|
||||
@@ -509,8 +511,8 @@ public final class LombokUtils {
|
||||
* For example if {@code isBoolean} is true, then a field named {@code isRunning} would produce:<br />
|
||||
* {@code [isRunning, getRunning, isIsRunning, getIsRunning]}
|
||||
*
|
||||
* @param fieldName the name of the field.
|
||||
* @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}.
|
||||
* @param fieldName the name of the field.
|
||||
* @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}.
|
||||
*/
|
||||
public static Collection<String> toAllGetterNames(@NotNull AccessorsInfo accessorsInfo, String fieldName, boolean isBoolean) {
|
||||
return toAllAccessorNames(accessorsInfo, fieldName, isBoolean, "is", "get");
|
||||
@@ -522,8 +524,8 @@ public final class LombokUtils {
|
||||
* For example if {@code isBoolean} is true, then a field named {@code isRunning} would produce:<br />
|
||||
* {@code [setRunning, setIsRunning]}
|
||||
*
|
||||
* @param fieldName the name of the field.
|
||||
* @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}.
|
||||
* @param fieldName the name of the field.
|
||||
* @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}.
|
||||
*/
|
||||
public static Collection<String> toAllSetterNames(@NotNull AccessorsInfo accessorsInfo, String fieldName, boolean isBoolean) {
|
||||
return toAllAccessorNames(accessorsInfo, fieldName, isBoolean, "set", "set");
|
||||
@@ -535,8 +537,8 @@ public final class LombokUtils {
|
||||
* For example if {@code isBoolean} is true, then a field named {@code isRunning} would produce:<br />
|
||||
* {@code [withRunning, withIsRunning]}
|
||||
*
|
||||
* @param fieldName the name of the field.
|
||||
* @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}.
|
||||
* @param fieldName the name of the field.
|
||||
* @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}.
|
||||
*/
|
||||
public static Collection<String> toAllWitherNames(@NotNull AccessorsInfo accessorsInfo, String fieldName, boolean isBoolean) {
|
||||
if (accessorsInfo.isFluent()) {
|
||||
@@ -586,7 +588,8 @@ public final class LombokUtils {
|
||||
}
|
||||
|
||||
private static String buildName(String prefix, String suffix, CapitalizationStrategy capitalizationStrategy) {
|
||||
return prefix + capitalizationStrategy.capitalize(suffix);
|
||||
CapitalizationStrategy strategy = null == capitalizationStrategy ? CapitalizationStrategy.defaultValue() : capitalizationStrategy;
|
||||
return prefix + strategy.capitalize(suffix);
|
||||
}
|
||||
|
||||
public static String camelCaseToConstant(String fieldName) {
|
||||
|
||||
Reference in New Issue
Block a user