Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 348830

Summary: Broken getSimpleName in PackageDeclarationImplNoBinding
Product: [Eclipse Project] JDT Reporter: Daniel Z. <daniel.ziegler>
Component: APTAssignee: Walter Harley <eclipse>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

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.