Bug 55102 - NPE when using ICU.reconcile(GET_AST_TRUE, ...)
Summary: NPE when using ICU.reconcile(GET_AST_TRUE, ...)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M8   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-17 10:14 EST by Dani Megert CLA
Modified: 2004-03-19 08:47 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2004-03-17 10:14:54 EST
I200403161300 + new code to use AST on reconcile (not yet in HEAD). Difference
is that we request the AST.

This time I have steps :-)
1. started fresh workspace
2. create Java project
3. create package org.eclipse.swt.custom
4. create empty file StyledText.java
5. paste StyledText.java into a fresh workspace
==>
java.lang.NullPointerException
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.NullPointerException.<init>(NullPointerException.java:60)
	at org.eclipse.jdt.core.dom.TypeBinding.getKey(TypeBinding.java)
	at org.eclipse.jdt.core.dom.MethodBinding.getKey(MethodBinding.java)
	at
org.eclipse.jdt.core.dom.DefaultBindingResolver.resolveMethod(DefaultBindingResolver.java:470)
	at
org.eclipse.jdt.core.dom.MethodDeclaration.resolveBinding(MethodDeclaration.java:869)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java)
	at
org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:1005)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1132)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java)
	at
org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationFragment(ASTConverter.java:2710)
	at
org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationStatement(ASTConverter.java:2737)
	at
org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleLocalDeclaration(ASTConverter.java:384)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1859)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1764)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2008)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1788)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java)
	at
org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:330)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:268)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:146)
	at org.eclipse.jdt.core.dom.AST.convertCompilationUnit(AST.java:233)
	at
org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:147)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:169)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:543)
	at
org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:931)
	at
org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:56)
	at
org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:700)
	at
org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:739)
	at
org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1043)
	at
org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:84)
	at
org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:109)
	at
org.eclipse.jface.text.reconciler.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:83)
	at
org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:97)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:76)
	at
org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:189)
Comment 1 Olivier Thomann CLA 2004-03-17 11:18:48 EST
I will investigate.
Comment 2 Olivier Thomann CLA 2004-03-17 12:05:03 EST
Do you have lots of compile error?
At step 5, do you mean I should paste the code from the swt plugin replacing the
empty file StyledText.java?
Comment 3 Dani Megert CLA 2004-03-17 12:20:05 EST
Yes to both questions.
Comment 4 Olivier Thomann CLA 2004-03-17 12:49:27 EST
The problem is that I tried to do exactly this and I could not reproduce.
I will continue to investigate.
Comment 5 Dani Megert CLA 2004-03-17 12:56:48 EST
As stated the code is not yet in HEAD. Did you modify the code to reproduce? It
works for us when we use reconcile(false /*getAST*/, ...) but not when we use
reconcile(true, /*getAST*/, ...)
Comment 6 Dani Megert CLA 2004-03-17 13:04:35 EST
of course it should read: ...when we use reconcile(true /*getAST*/, ...)
Comment 7 Olivier Thomann CLA 2004-03-17 13:51:44 EST
I tried to create an AST out of this compilation unit resolving the bindings for
it and it worked. So far, I was unable to reproduce it.
Comment 8 Dani Megert CLA 2004-03-18 02:32:14 EST
I will send you a plug-in export of JDT UI this morning where you can see this.
Comment 9 Olivier Thomann CLA 2004-03-18 13:42:24 EST
The bug is in the reconcile working copy operation.
ReconcileWorkingCopyOperation Line 71, the call to process will clean up the
compilation unit. This clean up resets the scopes to null. But afterwards, the
DOM/AST is created with binding resolution and this expects the scope to be
available.
So no scope are available when the getKey() is called on the bindings and this
leads to a NPE.
The scope must be cleaned after the DOM/AST creation, not before.
Comment 10 Jerome Lanneluc CLA 2004-03-19 07:41:40 EST
Changed ReconcileWorkingCopyOperation as well as CompilationUnit.buildStructure
() to cleanup the compilation unit declaration only after building the AST.

Added regression tests ASTConverterTest2.test0538f() and test0538g()
Comment 11 Dani Megert CLA 2004-03-19 08:47:12 EST
Thanks for the quick responcse. This now works and leads us to bug 55362 ;-)