Community
Participate
Working Groups
I200411170800, GTK+ 2.4.9, IBM VM 1.4.2 I'm not sure, but I believe I was replacing a file with code from head. I then got this exception in the log. !ENTRY org.eclipse.core.runtime 4 2 2004-11-22 11:41:18.31 !MESSAGE An internal error occurred during: "Override indicator installation job ". !STACK 0 java.lang.IllegalArgumentException at org.eclipse.jdt.core.dom.CompilationUnitResolver.parse(CompilationUni tResolver.java:323) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:7 37) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:574) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvi der.java:565) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider .java:494) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$8.run(JavaEditor.ja va:4023) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
This is what happened if the source unit is null. Move to JDT/UI for investigation. Need to find out how the unit can be null.
It's not the source which is null but the element that no longer exists. If there's no source an IllegalStateException is correctly thrown. Reading the API for createAST(...) I expect the same to happened when the element no longer exists: * @exception IllegalStateException if the settings provided * are insufficient, contradictory, or otherwise unsupported Another solution would be to spec to throw a JavaModelException.isDoesNotExist() but throwing an IllegalArgumentException seems not appropriate.
Found a path that led to a sourceUnit equals to null. I added a check that throws a IllegalStateException if the sourceUnit is null (the element doesn't exist anymore or if a JavaModelException has be thrown trying to get the source). Could not build a reproducable test case. Fixed and released in HEAD.
Sometimes we compute the AST in a background job. A possible test could be to suspend such a job (e.g. by putting a breakpoint into ASTProvider.createsAST) then delete the CU and resume the job which creates the AST.
The case where the source unit could be null is attempting to create an AST on an IClassFile that doesn't exist. Verified (in I20041214-2000) that ASTParser#internalCreateAST(IProgressMonitor) correctly throws an IllegalStateException if the IClassFile doesn't exist.