| Summary: | computeUniqueKey method assumes that is separator of file name is always '/', BUT IT IS NOT TRUE | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Wojciech Andrijew <wojtek.and> |
| Component: | Core | Assignee: | ANIRBAN CHAKRABORTY <anchakrk> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | mczyzyk, srikanth_sankaran |
| Version: | 4.4 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows All | ||
| Whiteboard: | stalebug | ||
Anirban, please take a look This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Problem is that the file name in CompilationUnit is dependent on the system, but SourceTypeBinding.computeUniqueKey method assumes that is separator of file name is always '/'. In our code this causes problem when JDT computes unique key for MethodBinding. An example of an incorrect key: Lnightly/original/CODSTA/BP/E:\Parasoft\JTest\examples\demo\src\nightly\original\CODSTA\BP\NRVA_1~NRVA_1<TT;>; I think that this key should look something like this: Lnightly/original/CODSTA/BP/NRVA_1~NRVA_1<TT;>; I analyzed Eclipse JDT source and here is the key places: 1) Go to org.eclipse.jdt.internal.compiler.batch.CompilationUnit to CompilationUnit(char[] contents, String fileName, String encoding, String destinationPath, boolean ignoreOptionalProblems) constructor 47-57 line: switch(File.separatorChar) { case '/' : if (CharOperation.indexOf('\\', fileNameCharArray) != -1) { CharOperation.replace(fileNameCharArray, '\\', '/'); } break; case '\\' : if (CharOperation.indexOf('/', fileNameCharArray) != -1) { CharOperation.replace(fileNameCharArray, '/', '\\'); } } As you see, even we convert separators from '\' to '/' (in input arguments to ASTParser), you always change it to system dependent. 2) Go to org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding 655-660 line int end = CharOperation.lastIndexOf('.', this.fileName); if (end != -1) { int start = CharOperation.lastIndexOf('/', this.fileName) + 1; char[] mainTypeName = CharOperation.subarray(this.fileName, start, end); start = CharOperation.lastIndexOf('/', uniqueKey) + 1; if (start == 0) This is place where assumes that is separator of file name is always '/' --- Found on Windows, JDT Core 3.9.0