Community
Participate
Working Groups
I20031029 Happened while editing JavaEditor.java java.lang.IllegalArgumentException at org.eclipse.jdt.core.dom.StringLiteral.setEscapedValue(StringLiteral.java:119) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1410) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:847) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:909) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:793) at org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationFragment(ASTConverter.java:2697) at org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationStatement(ASTConverter.java:2737) at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleLocalDeclaration(ASTConverter.java:288) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:721) at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:244) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:183) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:81) at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:353) at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:247) at org.eclipse.jdt.internal.ui.search.FindOccurrencesEngine$FindOccurencesCUEngine.createAST(FindOccurrencesEngine.java:104) at org.eclipse.jdt.internal.ui.search.FindOccurrencesEngine.findOccurrences(FindOccurrencesEngine.java:156) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$OccurrencesFinder.run(JavaEditor.java:2713) at java.lang.Thread.run(Thread.java:534)
Could you please provide the source code?
Could it be possible that you have an invalid string literal in your compilation unit? I need the test case for further investigation.
I will add more tracing to find out what is the error case.
Change milestone till we get a reproducable test case.
Do you remember in what context you used "Occurrences in file" action?
I thought I answered but obviously not. >Source code of what? I was editing JavaEditor (I think) >Could it be possible that you have an invalid string literal in your compilation >unit? Yes this is possible since I was adding new code
We got a second report about a similar problem. The problem always occures in during the search for occurrences in files. I'd like to know when this is activated. In the second case, the user doesn't remember that he ran this operation. So something might be done in the background. If only I could reproduce it, I am sure it would be easy to fix.
Java > Work in Progress > Mark Occurrences. This triggers which runs in background after post selection in the editor. As a starting point for the code see JavaEditor.OccurrencesFinder
The problem seems to be related to invalid positions in the string literal. I am investigating.
Happened to me as well (i200311192030). The only feedback I had in the UI was in the progress view/icon ("An internal error occurred during: "Java AST creation"."), and it seems code assist temporarily stopped working. Sorry, but I don't know what may have triggered it. Will pay more attention next time it happens. !ENTRY org.eclipse.core.runtime 4 2 Nov 20, 2003 12:02:35.875 !MESSAGE An internal error occurred during: "Java AST creation". !STACK 0 java.lang.IllegalArgumentException: Invalid string literal : >rg.eclipse.b3", < at org.eclipse.jdt.core.dom.StringLiteral.setEscapedValue(StringLiteral.java:119) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1410) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:847) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1665) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:871) at org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationFragment(ASTConverter.java:2697) at org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationStatement(ASTConverter.java:2737) at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleLocalDeclaration(ASTConverter.java:292) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1846) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2055) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1787) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:723) at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:244) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:183) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:81) at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:354) at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:247) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.computeAST(SelectionListenerWithASTManager.java:106) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:116) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$1.run(SelectionListenerWithASTManager.java:92) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:62)
The problem is that I cannot reproduce this positions problems. I don't know from where this offset is coming from. It looks like the positions are computed with a different source. As long as I cannot reproduce it, it is really difficult to see what is happening. It seems related with the "Occurences in file" feature.
I think I know what is going on. It is a concurrency problem. I get twice the source of the compilation unit in order to create the AST. The problem is that the source might have been modified meanwhile. The only way to fix this is to reuse the same source to compute the compiler ast and inside the converter. Won't be fixed for M5.
*** Bug 46988 has been marked as a duplicate of this bug. ***
Created attachment 6888 [details] Patch file to fix this issue Too late for M5.
I guess this is the same, but just for completeness the NumberLiteral version of it: when editing JavaIndenter.java: java.lang.IllegalArgumentException at org.eclipse.jdt.core.dom.NumberLiteral.setToken(NumberLiteral.java:124) at org.eclipse.jdt.core.dom.AST.newNumberLiteral(AST.java:1799) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1350) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:835) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1551) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:859) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1665) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:871) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1812) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1848) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1745) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1993) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1769) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2029) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1778) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:723) at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:244) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:183) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:81) at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:354) at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:247) at org.eclipse.jdt.internal.ui.search.FindOccurrencesEngine$FindOccurencesCUEngine.createAST(FindOccurrencesEngine.java:105) at org.eclipse.jdt.internal.ui.search.FindOccurrencesEngine.resolveTarget(FindOccurrencesEngine.java:160) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$OccurrencesFinder.run(JavaEditor.java:2731) at java.lang.Thread.run(Thread.java:534)
Same thing. This is due to the concurrent change of the buffer.
Considering for M5
Released for M5. Files changed: AST CompilationUnitResolver buildnotes_jdt-core.html
Verified that this is included in 200311201600.