eclipse-jdt / eclipse-jdt/eclipse.jdt.core

ClassFileWorkingCopy.getFileName() does not follow spec of IDependent

Open
#3,215 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

ClassFileWorkingCopy extends CompilationUnit, which implements org.eclipse.jdt.internal.compiler.env.ICompilationUnit which implements IDependent.

IDependent has following method: `char[] getFileName();`

The javadoc on this method indicates getFileName() should return a string like `/lib/some.zip|/com/q/Y.class`

CompilationUnit (and it's subclass, ClassFileWorkingCopy) returns the following for this method call: getPath().toString().toCharArray();

`getPath()` is from IJavaElement, and says it must return basically the path to the archive itself, without the pipe character and package and class details within the archive.

With this in mind, if a ClassFileWorkingCopy is from inside an archive, it should not be using `getPath().toString().toCharArray()` as its `getFileName()` implementation, because this will only return the path to the archive, and leave out the remaining requirements from `IDependent.getFileName()`.

// BIG PROBLEM HERE!!!
// IJavaElement#getPath() has different specs than
// org.eclipse.jdt.internal.compiler.env.IDependent#getFileName()

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.