matthiasblaesing opened a new pull request, #8141:
URL: https://github.com/apache/netbeans/pull/8141
There is a mismatch in the CSL API/SPI: The API declared by the `Language`
class requires the methods:
- `getOccurrencesFinder`
- `getSemanticAnalyzer`
- `getIndexSearcher`
- `getOverridingMethods`
to return non-null values (marked `@NonNull`). This is a problem as the
implementation relies on the corresponding methods in `DefaultLanguageConfig`
to provide the implementations. These methods are declared to be allowed to
return null (marked `@CheckForNull`).
This mismatch has to be fixed in Language, there the "null" situation is
detected and a no-op implementation is returned.
One example that provides a language module without a semantic analyser is
the antlr integration. Opening an antlr grammar (for example the one in the
css.lib module), raises an exception:
```
[exec] WARNING
[org.netbeans.modules.csl.editor.semantic.SemanticHighlighter]:
SemanticAnalyzer = null; Language =
org.netbeans.modules.csl.core.Language@7a997b47[text/x-antlr3 (mimetype =
text/x-antlr3; ParserResult =
org.netbeans.modules.languages.antlr.v3.Antlr3ParserResult@594fb7d7(mimepath =
MimePath[text/x-antlr3])
[exec] java.lang.NullPointerException: Cannot invoke
"org.netbeans.modules.csl.api.SemanticAnalyzer.run(org.netbeans.modules.parsing.spi.Parser$Result,
org.netbeans.modules.parsing.spi.SchedulerEvent)" because "task" is null
[exec] [catch] at
org.netbeans.modules.csl.editor.semantic.SemanticHighlighter.process(SemanticHighlighter.java:148)
[exec] at
org.netbeans.modules.csl.editor.semantic.SemanticHighlighter.processColorings(SemanticHighlighter.java:125)
[exec] at
org.netbeans.modules.csl.editor.semantic.SemanticHighlighter.lambda$run$0(SemanticHighlighter.java:95)
[exec] at
org.netbeans.modules.parsing.api.ParserManager$1.run(ParserManager.java:118)
[exec] at
org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586)
[exec] at
org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:197)
[exec] at
org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:180)
[exec] at
org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181)
[exec] at
org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178)
[exec] at
org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
[exec] at
org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
[exec] at
org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
[exec] at
org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
[exec] at
org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178)
[exec] at
org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:83)
[exec] at
org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:121)
[exec] at
org.netbeans.modules.csl.editor.semantic.SemanticHighlighter.run(SemanticHighlighter.java:95)
[exec] at
org.netbeans.modules.csl.editor.semantic.SemanticHighlighter.run(SemanticHighlighter.java:57)
[exec] at
org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:561)
[exec] at
org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:786)
[exec] at
org.openide.util.lookup.Lookups.executeWith(Lookups.java:288)
[exec] at
org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
[exec] at
org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
[exec] at
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
[exec] at
java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[exec] at
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1403)
[exec] at
org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
[exec] at
org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
[exec] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2018)
```
This becomes visible now because the changes from #8028
(0ba2e7a43595d2a267c1fda58b469e6e947f8830) rely on the correctness of the
`@NonNull` annotation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists