Bug 104030 - [refactoring] extract interface:NPE in SuperTypeConstraintsModel
Summary: [refactoring] extract interface:NPE in SuperTypeConstraintsModel
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Tobias Widmer CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-15 11:46 EDT by Adam Kiezun CLA Friend
Modified: 2005-09-02 10:07 EDT (History)
2 users (show)

See Also:


Attachments
the benchmark (474.37 KB, application/octet-stream)
2005-07-15 11:47 EDT, Adam Kiezun CLA Friend
no flags Details
proposed fix (1.24 KB, patch)
2005-07-18 04:53 EDT, Tobias Widmer CLA Friend
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA Friend 2005-07-15 11:46:41 EDT
3.1
extract the attached source
open interace Node
'Extract Interface', select all methods

java.lang.NullPointerException
at
org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeConstraintsModel.createTypeVariable(SuperTypeConstraintsModel.java:478)
at
org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeConstraintsCreator.endVisit(SuperTypeConstraintsCreator.java:685)
at
org.eclipse.jdt.internal.corext.dom.HierarchicalASTVisitor.endVisit(HierarchicalASTVisitor.java:707)
at org.eclipse.jdt.core.dom.SimpleType.accept0(SimpleType.java:138)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2450)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2497)
at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:495)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2450)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2520)
at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:483)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2450)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2520)
at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:299)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2450)
at
org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeRefactoringProcessor.performFirstPass(SuperTypeRefactoringProcessor.java:306)
at
org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeRefactoringProcessor$3.acceptAST(SuperTypeRefactoringProcessor.java:656)
at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:691)
at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:455)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:664)
at
org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeRefactoringProcessor.solveSuperTypeConstraints(SuperTypeRefactoringProcessor.java:650)
at
org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceProcessor.access$2(ExtractInterfaceProcessor.java:1)
at
org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceProcessor$2.acceptAST(ExtractInterfaceProcessor.java:1106)
at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:691)
at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:455)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:664)
at
org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceProcessor.rewriteTypeOccurrences(ExtractInterfaceProcessor.java:1088)
at
org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceProcessor.createChangeManager(ExtractInterfaceProcessor.java:359)
at
org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceProcessor.checkFinalConditions(ExtractInterfaceProcessor.java:224)
at
org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:169)
at
org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:84)
at
org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:114)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1719)
at
org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:86)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Comment 1 Adam Kiezun CLA Friend 2005-07-15 11:47:33 EDT
Created attachment 24845 [details]
the benchmark
Comment 2 Dirk Baeumer CLA Friend 2005-07-15 16:08:54 EDT
Tobias, please also investigate how risky a fix would be for 3.1.1.
Comment 3 Tobias Widmer CLA Friend 2005-07-18 04:52:17 EDT
The scenario works for me using a fresh 5.0 project with imported source.

However, the resolved binding in SuperTypeConstraintsModel#createTypeVariable 
is accessed without null check.

Fix is trivial and absolutely safe

Attaching patch
Comment 4 Tobias Widmer CLA Friend 2005-07-18 04:53:04 EDT
Created attachment 24898 [details]
proposed fix
Comment 5 Dirk Baeumer CLA Friend 2005-07-26 05:51:38 EDT
Approved for 3.1.1
Comment 6 Tobias Widmer CLA Friend 2005-08-08 08:15:46 EDT
Martin, can you approve for 3.1.1?
Comment 7 Tobias Widmer CLA Friend 2005-08-08 08:36:31 EDT
Fixed in HEAD 20050808
Comment 8 Martin Aeschlimann CLA Friend 2005-08-09 05:00:14 EDT
patch looks good, ok for 3.1.1.
Comment 9 Tobias Widmer CLA Friend 2005-08-10 09:14:55 EDT
Fixed in 3.1.1 maintenance stream > 20050810
Comment 10 Dani Megert CLA Friend 2005-09-02 09:47:51 EDT
Start verification...
Comment 11 Dani Megert CLA Friend 2005-09-02 10:07:21 EDT
Could also not reproduce with attached example. Verified in source:
M20050831-1200\plugins\org.eclipse.jdt.source_3.1.1\src\org.eclipse.jdt.ui_3.1.1