Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csl.api: Fix wrong @NonNull annotation in methods of Language #8146

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ide/csl.api/src/org/netbeans/modules/csl/core/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ public boolean hasHints() {
/**
* Return the occurrences finder for this language
*/
@NonNull
@CheckForNull
public OccurrencesFinder getOccurrencesFinder() {
if (occurrences == null) {
if (occurrencesFile != null) {
Expand Down Expand Up @@ -653,7 +653,7 @@ public boolean hasOccurrencesFinder() {
/**
* Return the semantic analyzer for this language
*/
@NonNull
@CheckForNull
public SemanticAnalyzer getSemanticAnalyzer() {
if (semantic == null) {
if (semanticFile != null) {
Expand All @@ -679,7 +679,7 @@ void setSemanticAnalyzer(FileObject semanticFile) {
/**
* Return the semantic analyzer for this language
*/
@NonNull
@CheckForNull
public IndexSearcher getIndexSearcher() {
if (indexSearcher == null) {
if (indexSearcherFile != null) {
Expand Down Expand Up @@ -735,7 +735,7 @@ public Set<String> getBinaryLibraryPathIds() {
/**
* Return the overriding methods computer for this language
*/
@NonNull
@CheckForNull
public OverridingMethods getOverridingMethods() {
if (overridingMethods == null) {
if (overridingMethodsFile != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ public void run(ParserResult info, SchedulerEvent event) {
@NonNull
List<OffsetRange> processImpl(ParserResult info, Document doc, int caretPosition) {
OccurrencesFinder finder = language.getOccurrencesFinder();
assert finder != null;

if(finder == null) {
return List.of();
}

finder.setCaretPosition(caretPosition);
try {
finder.run(info, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ private void process(Language language, ParserResult result, Set<SequenceElement

ColoringManager manager = language.getColoringManager();
SemanticAnalyzer task = language.getSemanticAnalyzer();


if (task == null) {
return;
}

// Allow language plugins to do their own analysis too
try {
task.run(result, null);
Expand Down
Loading