Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316904 - [assist] completion for ctor with declared lifting causes CCE
Summary: [assist] completion for ctor with declared lifting causes CCE
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTDT (show other bugs)
Version: 0.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 0.7   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-15 09:36 EDT by Stephan Herrmann CLA
Modified: 2010-07-02 13:02 EDT (History)
0 users

See Also:


Attachments
fix (2.48 KB, patch)
2010-06-15 09:50 EDT, Stephan Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2010-06-15 09:36:15 EDT
In the stopwatch example when typing
  new Wa
and hitting Ctrl-space, the following exception occurs:

java.lang.ClassCastException: org.eclipse.objectteams.otdt.internal.core.compiler.ast.LiftingTypeReference cannot be cast to org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference
at org.eclipse.jdt.internal.core.search.BasicSearchEngine$1AllConstructorDeclarationsVisitor.visit(BasicSearchEngine.java:787)
at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.traverse(ConstructorDeclaration.java:808)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:2061)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:808)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.searchAllConstructorDeclarations(BasicSearchEngine.java:838)
at org.eclipse.jdt.internal.core.SearchableEnvironment.findConstructorDeclarations(SearchableEnvironment.java:595)
at org.eclipse.jdt.internal.codeassist.CompletionEngine.findTypesAndPackages(CompletionEngine.java:10958)
at org.eclipse.jdt.internal.codeassist.CompletionEngine.completionOnSingleTypeReference(CompletionEngine.java:3320)
at org.eclipse.jdt.internal.codeassist.CompletionEngine._OT$complete$orig(CompletionEngine.java:1687)
at org.eclipse.jdt.internal.codeassist.CompletionEngine._OT$complete$chain(CompletionEngine.java)
at org.eclipse.jdt.internal.codeassist.CompletionEngine._OT$complete$chain(CompletionEngine.java)
at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java)
at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:1947)
Comment 1 Stephan Herrmann CLA 2010-06-15 09:50:20 EDT
Created attachment 171930 [details]
fix

The CCE is caused by incomplete conditional:
testing "instanceof SingleTypeReference" and if false assuming it's a
QualifiedTypeReference.

OT/J has two more kinds of TypeReference: LiftingTypeReference and 
TypeAnchorReference. A full search for "instanceof SingleTypeReference"
brings three suspecious occurrences:
+ BasicSearchEngine, nested class inside searchAllConstructorDeclarations(..)
  -> that's what caused the CCE, fixed by also checking for LiftingTypeReference
+ JavadocArgumentExpression.internalResolveType(..)
  -> another missing check for LTR, also fixed in the patch
- TypeParameterLocator#match(TypeReference,MatchingNodeSet)
  -> may need to check for TypeAnchorReference
     NOT INCLUDED IN THIS PATCH.
Comment 2 Stephan Herrmann CLA 2010-06-15 09:51:32 EDT
Patch released as r515.
Comment 3 Stephan Herrmann CLA 2010-07-02 13:02:59 EDT
Verified using build 201007011455.