mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
IJ-CR-134196 [java-highlighting] IDEA-352727 Incomplete model with lombok
- add a more accurate message for non-initialized fields GitOrigin-RevId: 1c5fc12a0f4dd70c8899a807dc03925680c68ab9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cc046c56a2
commit
153827e5e4
@@ -287,7 +287,7 @@ public final class HighlightControlFlowUtil {
|
||||
if (isFieldInitializedAfterObjectConstruction(field)) return null;
|
||||
if (PsiUtilCore.hasErrorElementChild(field)) return null;
|
||||
if (IncompleteModelUtil.isIncompleteModel(field) && IncompleteModelUtil.canBeAugmented(field.getContainingClass())) {
|
||||
return IncompleteModelUtil.getPendingReferenceHighlightInfo(field);
|
||||
return IncompleteModelUtil.getPendingInitizializingHighlightInfo(field);
|
||||
}
|
||||
String description = JavaErrorBundle.message("variable.not.initialized", field.getName());
|
||||
TextRange range = HighlightNamesUtil.getFieldDeclarationTextRange(field);
|
||||
|
||||
@@ -280,13 +280,22 @@ final class IncompleteModelUtil {
|
||||
.descriptionAndTooltip(JavaErrorBundle.message("incomplete.project.state.pending.reference"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param elementToHighlight element to attach the highlighting
|
||||
* @return HighlightInfo builder that adds a pending initizializing highlight
|
||||
*/
|
||||
static HighlightInfo.@NotNull Builder getPendingInitizializingHighlightInfo(@NotNull PsiElement elementToHighlight) {
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.PENDING_REFERENCE).range(elementToHighlight)
|
||||
.descriptionAndTooltip(JavaErrorBundle.message("incomplete.project.state.pending.initalizing"));
|
||||
}
|
||||
|
||||
static boolean canBeAugmented(@Nullable PsiClass targetClass) {
|
||||
if (targetClass == null) return false;
|
||||
return CachedValuesManager.getProjectPsiDependentCache(targetClass,
|
||||
psiClass -> PsiAugmentProvider.canBeAugmentedForIncompleteMode(psiClass));
|
||||
}
|
||||
|
||||
static boolean canBeUsedImportImplicitly(@Nullable PsiImportStatementBase importStatementBase) {
|
||||
private static boolean canBeUsedImportImplicitly(@Nullable PsiImportStatementBase importStatementBase) {
|
||||
if (importStatementBase == null) return false;
|
||||
return PsiAugmentProvider.canBeUsedImportForIncompleteMode(importStatementBase);
|
||||
}
|
||||
|
||||
@@ -597,4 +597,5 @@ error.implicit.class.has.invalid.file.name=Implicitly declared class's file name
|
||||
error.package.statement.not.allowed.for.implicit.class=Package statement is not allowed for implicitly declared class
|
||||
error.initializers.are.not.allowed.in.implicit.classes=Initializers are not allowed in implicitly declared classes
|
||||
remove.unused.imports.quickfix.text=Remove unused imports
|
||||
incomplete.project.state.pending.reference=Not resolved until the project is fully loaded
|
||||
incomplete.project.state.pending.reference=Not resolved until the project is fully loaded
|
||||
incomplete.project.state.pending.initalizing=Not initialized until the project is fully loaded
|
||||
@@ -14,15 +14,15 @@ public final class LombokBasics {
|
||||
@<info descr="Not resolved until the project is fully loaded">Getter</info>
|
||||
@<info descr="Not resolved until the project is fully loaded">SuperBuilder</info>
|
||||
class UserDao extends UserId {
|
||||
<info descr="Not resolved until the project is fully loaded">private final String name;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String surname;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String email;</info>
|
||||
<info descr="Not initialized until the project is fully loaded">private final String name;</info>
|
||||
<info descr="Not initialized until the project is fully loaded">private final String surname;</info>
|
||||
<info descr="Not initialized until the project is fully loaded">private final String email;</info>
|
||||
}
|
||||
|
||||
@<info descr="Not resolved until the project is fully loaded">SuperBuilder</info>
|
||||
abstract class UserId {
|
||||
<info descr="Not resolved until the project is fully loaded">private final long id;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String info;</info>
|
||||
<info descr="Not initialized until the project is fully loaded">private final long id;</info>
|
||||
<info descr="Not initialized until the project is fully loaded">private final String info;</info>
|
||||
}
|
||||
|
||||
class UserChain {
|
||||
|
||||
@@ -16,15 +16,15 @@ public final class LombokBasicsWithExplicitImport {
|
||||
@<info descr="Not resolved until the project is fully loaded">Getter</info>
|
||||
@<info descr="Not resolved until the project is fully loaded">SuperBuilder</info>
|
||||
class UserDao extends UserId {
|
||||
<info descr="Not resolved until the project is fully loaded">private final String name;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String surname;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String email;</info>
|
||||
<info descr="Not initialized until the project is fully loaded">private final String name;</info>
|
||||
<info descr="Not initialized until the project is fully loaded">private final String surname;</info>
|
||||
<info descr="Not initialized until the project is fully loaded">private final String email;</info>
|
||||
}
|
||||
|
||||
@<info descr="Not resolved until the project is fully loaded">SuperBuilder</info>
|
||||
abstract class UserId {
|
||||
<info descr="Not resolved until the project is fully loaded">private final long id;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String info;</info>
|
||||
<info descr="Not initialized until the project is fully loaded">private final long id;</info>
|
||||
<info descr="Not initialized until the project is fully loaded">private final String info;</info>
|
||||
}
|
||||
|
||||
class UserChain {
|
||||
|
||||
Reference in New Issue
Block a user