Skip to content

MarkOccurencesHighlighter broken for CSL languages after "Breakage after code cleanup for csl.editor.semantic package" #8123

@matthiasblaesing

Description

@matthiasblaesing

Apache NetBeans version

Apache NetBeans latest daily build

What happened

While testing master (6c17cc6) I noticed this exception:

     [exec] java.lang.ClassCastException: class org.netbeans.modules.csl.editor.semantic.SequenceElement cannot be cast to class java.lang.Comparable (org.netbeans.modules.csl.editor.semantic.SequenceElement is in unnamed module of loader org.netbeans.StandardModule$OneModuleClassLoader @bad9ea; java.lang.Comparable is in module java.base of loader 'bootstrap')
     [exec]     at java.base/java.util.TreeMap.compare(TreeMap.java:1604)
     [exec]     at java.base/java.util.TreeMap.addEntryToEmptyMap(TreeMap.java:811)
     [exec]     at java.base/java.util.TreeMap.put(TreeMap.java:820)
     [exec]     at java.base/java.util.TreeMap.put(TreeMap.java:569)
     [exec]     at java.base/java.util.TreeSet.add(TreeSet.java:259)
     [exec]     at org.netbeans.modules.csl.editor.semantic.MarkOccurrencesHighlighter.run(MarkOccurrencesHighlighter.java:123)
     [exec]     at org.netbeans.modules.csl.editor.semantic.MarkOccurrencesHighlighter.run(MarkOccurrencesHighlighter.java:58)
     [exec]     at org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:561)
     [exec] [catch] 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 points directly to: PR #8028, which made SequenceElement non comparable, yet stuffs these type into a TreeSet.

Language / Project Type / NetBeans Component

CSL API

How to reproduce

  • Start a recent master build
  • Create a JS file with this content:
    var a = 1;
    var b = a;
    
  • Place cursor on variable a

You should see a highlight of both occurrences of the variable, but you get an exception.

Did this work correctly in an earlier version?

Apache NetBeans 24

Operating System

Ubuntu 24.10

JDK

Ubuntu JDK 21

Apache NetBeans packaging

Other

Anything else

No response

Are you willing to submit a pull request?

No

Metadata

Metadata

Assignees

Labels

CSL[ci] enable web jobRegressionThis used to work!kind:bugBug report or fix

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions