Skip to content

Commit

Permalink
Do not annotate uninitialized static final fields if parent type is e…
Browse files Browse the repository at this point in the history
…xtern.
  • Loading branch information
m0rkeulv committed Feb 4, 2024
1 parent 5f3004b commit 4a31501
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,30 @@ public static void check(final HaxeFieldDeclaration var, final AnnotationHolder
else {
if (FINAL_FIELD_IS_INITIALIZED.isEnabled(var)) {
if (field.isFinal()) {
if (!field.hasInitializer()) {
if (!isParentInterface(var) && !isParentAnonymousStructure(var)) {
if (field.isStatic()) {
holder.newAnnotation(HighlightSeverity.ERROR, HaxeBundle.message("haxe.semantic.final.static.var.init", field.getName()))
.range(var)
.create();
if (field.getDeclaringClass() == null || !field.getDeclaringClass().isExtern()) {
if (!field.hasInitializer()) {
if (!isParentInterface(var) && !isParentAnonymousStructure(var)) {
if (field.isStatic()) {
holder.newAnnotation(HighlightSeverity.ERROR, HaxeBundle.message("haxe.semantic.final.static.var.init", field.getName()))
.range(var)
.create();
}
else if (!isFieldInitializedInTheConstructor(field)) {
holder.newAnnotation(HighlightSeverity.ERROR, HaxeBundle.message("haxe.semantic.final.var.init", field.getName()))
.range(var)
.create();
}
}
else if (!isFieldInitializedInTheConstructor(field)) {
holder.newAnnotation(HighlightSeverity.ERROR, HaxeBundle.message("haxe.semantic.final.var.init", field.getName()))
}
else {
if (isParentInterface(var)) {
holder.newAnnotation(HighlightSeverity.ERROR,
HaxeBundle.message("haxe.semantic.final.static.var.init.interface", field.getName()))
.range(var)
.create();
}
}
}
else {
if (isParentInterface(var)) {
holder.newAnnotation(HighlightSeverity.ERROR,
HaxeBundle.message("haxe.semantic.final.static.var.init.interface", field.getName()))
.range(var)
.create();
}
}
}
}
}
Expand Down

0 comments on commit 4a31501

Please sign in to comment.