Bug 68862 - [1.5] ClassCastException when moving a a java file
Summary: [1.5] ClassCastException when moving a a java file
Status: RESOLVED 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.1 M1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-29 10:00 EDT by David Audel CLA
Modified: 2005-01-11 11:02 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 David Audel CLA 2004-06-29 10:00:18 EDT
build 3.0 + JDT/JDK_1_5

1) create a Java project 'P'
2) create a class 'X.java'
public class X<T> {
	T t;
}
class T {
}
3) create a package 'p'
4) Inside package explorer try to move 'X.java' to 'p'

a ClassCastException occurs

java.lang.ClassCastException
	at 
org.eclipse.jdt.internal.core.search.matching.TypeReferenceLocator.reportDeclar
ation(TypeReferenceLocator.java:327)
	at 
org.eclipse.jdt.internal.core.search.matching.TypeReferenceLocator.reportDeclar
ation(TypeReferenceLocator.java:308)
	at 
org.eclipse.jdt.internal.core.search.matching.TypeReferenceLocator.matchReportR
eference(TypeReferenceLocator.java:166)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1500)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1590)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.reportMatching
(MatchLocator.java:1456)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process
(MatchLocator.java:1120)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:748)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:776)
	at 
org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches
(MatchLocator.java:879)
	at 
org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches
(JavaSearchParticipant.java:94)
	at org.eclipse.jdt.core.search.SearchEngine.searchDeclarations
(SearchEngine.java:1060)
	at 
org.eclipse.jdt.core.search.SearchEngine.searchDeclarationsOfReferencedTypes
(SearchEngine.java:1204)
	at 
org.eclipse.jdt.internal.corext.refactoring.structure.ReferenceFinderUtil.getTy
peReferencesIn(ReferenceFinderUtil.java:63)
	at 
org.eclipse.jdt.internal.corext.refactoring.structure.ReferenceFinderUtil.getTy
peReferencesIn(ReferenceFinderUtil.java:55)
	at 
org.eclipse.jdt.internal.corext.refactoring.structure.ReferenceFinderUtil.getTy
pesReferencedIn(ReferenceFinderUtil.java:46)
	at 
org.eclipse.jdt.internal.corext.refactoring.reorg.MoveCuUpdateCreator.addImport
ToSourcePackageTypes(MoveCuUpdateCreator.java:224)
	at 
org.eclipse.jdt.internal.corext.refactoring.reorg.MoveCuUpdateCreator.addUpdate
s(MoveCuUpdateCreator.java:141)
	at 
org.eclipse.jdt.internal.corext.refactoring.reorg.MoveCuUpdateCreator.addUpdate
s(MoveCuUpdateCreator.java:127)
	at 
org.eclipse.jdt.internal.corext.refactoring.reorg.MoveCuUpdateCreator.createCha
ngeManager(MoveCuUpdateCreator.java:91)
	at 
org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgPolicyFactory$MoveFilesF
oldersAndCusPolicy.createChangeManager(ReorgPolicyFactory.java:1760)
	at 
org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgPolicyFactory$MoveFilesF
oldersAndCusPolicy.checkFinalConditions(ReorgPolicyFactory.java:1859)
	at ...
Comment 1 Jerome Lanneluc CLA 2004-06-29 15:30:59 EDT
Works for me with latest. Can you still reproduce ?
Comment 2 David Audel CLA 2004-06-29 15:51:40 EDT
I can reproduce with latest.

I forgot to say that the compliance level must be 1.5. The problem does not 
occur with 1.4
Comment 3 Jerome Lanneluc CLA 2004-06-29 16:01:14 EDT
I have the compliance level set to 1.5 as well. I would need more details.
Comment 4 Jerome Lanneluc CLA 2004-06-30 05:51:14 EDT
My fault: missed the declaration of secondary type T.
Comment 5 Jerome Lanneluc CLA 2004-06-30 06:46:10 EDT
Changed TypeReferenceLocator.reportDeclartion(ASTNode, ...) to report the 
erasure of the type binding instead of the type variable binding.

Added regression test JavaSearchTests.testDeclarationOfReferencedTypes09()