Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348830 - Broken getSimpleName in PackageDeclarationImplNoBinding
Summary: Broken getSimpleName in PackageDeclarationImplNoBinding
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: APT (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Walter Harley CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-09 02:36 EDT by Daniel Z. CLA
Modified: 2020-01-31 12:12 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Z. CLA 2011-06-09 02:36:02 EDT
Build Identifier: 20100218-1602

The implementation of getSimpleName in org.eclipse.jdt.apt.core.internal.declaration.PackageDeclarationImplNoBinding is obviously broken. For a package "org.eclipse.jdt.apt.test" it returns "eclipse.jdt.apt.test" instead of the expected "test".

Line 81 of should be
	int dotIndex = components.lastIndexOf("."); //$NON-NLS-1$
instead of
	int dotIndex = components.indexOf("."); //$NON-NLS-1$

Reproducible: Always

Steps to Reproduce:
1. Have an annotation processor be executed on a project containing a package "org.eclipse.jdt.apt.test" with no types in "org.eclipse.jdt.apt"
2. In the annotation processor use AnnotationProceesorEnvironment.getPackage("org.eclipse.jdt.apt") to get a PackageDeclaration
3. Call PackageDeclaration.getSimpleName() to get "eclipse.jdt.apt" while expect "apt"
Comment 1 Eclipse Genie CLA 2020-01-31 12:12:49 EST
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.