Community
Participate
Working Groups
Build id: I20090421-0930 1. Create a 'Main' class with the content below. 2. Bring up the context menu on the editor. 3. Run As > Java Application 4. A dialog appears with two choices. - Main Main - (default package) 5. Select the first one. 6. The application runs. 7. Run > Run Configurations... 8. See that the generated launch configuration has no name. 9. Try to do something with it, the dialog now tells you "A name is required for the configuration". It seems the launching code is buggy as it is generating bad launch configurations. I believe this bug to be the cause behind bug 273498. public class Main { public static void main(String[] args) { new Main() {}; System.out.println("Hello world!"); //$NON-NLS-1$ } }
Created attachment 134085 [details] fix The problem is that anonymous types do not have names, they are only referenced via a number - in this example 'Main$1'. Our code was setting the name of the new configuration to be IType.getElementName() which is nothing, since anonymous types don't have names. Changed the code to use IType.getTypeQualifiedName() which using the given example will name the config 'Main.1'
Created attachment 134087 [details] better fix this fix also updates the main type selection dialog to better show anonymous types. Using the example one of the choices would be ' - Main' and the other 'Main'. With the patch we get 'Main$1 - Main' and 'Main'.
applied patch to HEAD please verify Curtis
+1 Verified.