Eclipse java.lang.NoSuchMethodError: 'boolean com.ibm.icu.text.UTF16.isSurrogate(char)'
2024-02-21 22:02:44

Log

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
!ENTRY org.eclipse.core.jobs 4 2 2023-01-10 14:29:04.005
!MESSAGE An internal error occurred during: "Requesting Java AST from selection".
!STACK 0
java.lang.NoSuchMethodError: 'boolean com.ibm.icu.text.UTF16.isSurrogate(char)'
at org.eclipse.jdt.internal.ui.text.JavaWordFinder.findWord(JavaWordFinder.java:61)
at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.updateOccurrenceAnnotations(JavaEditor.java:3300)
at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.lambda$4(JavaEditor.java:3363)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:175)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup$1.run(SelectionListenerWithASTManager.java:151)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.core.jobs 4 2 2023-01-10 14:29:04.266
!MESSAGE An internal error occurred during: "Requesting Java AST from selection".
!STACK 0
java.lang.NoSuchMethodError: 'boolean com.ibm.icu.text.UTF16.isSurrogate(char)'
at org.eclipse.jdt.internal.ui.text.JavaWordFinder.findWord(JavaWordFinder.java:61)
at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.updateOccurrenceAnnotations(JavaEditor.java:3300)
at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.lambda$4(JavaEditor.java:3363)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:175)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup$1.run(SelectionListenerWithASTManager.java:151)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

...

版本

Eclipse IDE for Java Developers (includes Incubating components)
Version: 2022-06 (4.24.0)
Build id: 20220609-1112
openjdk 15

原因

测试了几遍, 发现是装了 Eclipse Web Developer Tools 导致的
Eclipse Web Developer Tools 3.26.0.v202204091445 org.eclipse.wst.web_ui.feature.feature.group

Solution

安装 Eclipse 2022-12 然后安装 2022-12 版本的 Eclipse Web Developer Tools