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

Bug 275916

Summary: Class names with '$' in them break launch configuration participants
Product: [Eclipse Project] JDT Reporter: Michael Rennie <Michael_Rennie>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: darin.eclipse
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard: stalebug

Description Michael Rennie CLA 2009-05-12 13:21:42 EDT
I20090508-2000

consider the following example class:

public class C {
    public static void main(String[] args) {
		System.out.println("run");
	}
}

if you run the example class (so that a launch configuration is created)and then reactor (rename) the class to C$1 it wil fail with the following exception:

java.lang.IndexOutOfBoundsException: No group 1
at java.util.regex.Matcher.group(Matcher.java:463)
at java.util.regex.Matcher.appendReplacement(Matcher.java:730)
at java.util.regex.Matcher.replaceAll(Matcher.java:806)
at java.lang.String.replaceAll(String.java:2000)
at org.eclipse.jdt.internal.debug.core.refactoring.LaunchConfigurationProjectMainTypeChange.<init>(LaunchConfigurationProjectMainTypeChange.java:63)
at org.eclipse.jdt.internal.debug.core.refactoring.JDTDebugRefactoringUtil.createChangesForTypeChange(JDTDebugRefactoringUtil.java:195)
at org.eclipse.jdt.internal.debug.core.refactoring.JDTDebugRefactoringUtil.createChangesForTypeRename(JDTDebugRefactoringUtil.java:253)
at org.eclipse.jdt.internal.debug.core.refactoring.LaunchConfigurationITypeRenameParticipant.createChange(LaunchConfigurationITypeRenameParticipant.java:54)
at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.createChange(ProcessorBasedRefactoring.java:308)
at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:97)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4665)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

This is because we assume that the '$' character marks the boundary for enclosing type name and member type names. While it is not convention to use the '$' character in class names, it is allowed, so we should handle this case in our refactoring code.
Comment 1 Eclipse Genie CLA 2020-04-21 17:56:38 EDT
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.