Bug 127395 - AST: SimpleName must not be empty
Summary: AST: SimpleName must not be empty
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-12 12:07 EST by Martin Aeschlimann CLA
Modified: 2006-03-28 10:10 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 Martin Aeschlimann CLA 2006-02-12 12:07:27 EST
20060212

SimpleName.setIdentifier should test that the name is not empty as this isn't a valid identifier.
Comment 1 Philipe Mulet CLA 2006-02-13 04:29:50 EST
Empty names can be created when recovering. This isn't super happy, but would you prefer a random identifier in there ?
Note: why not...
Comment 2 Martin Aeschlimann CLA 2006-02-13 04:46:15 EST
Jim, was it an oversight that a SimpleName could be created with an empty name, or do you think it is ok to do so.

Our code doesn't expect this. 
Comment 3 Jim des Rivieres CLA 2006-02-13 10:50:47 EST
This is a bug in SimpleName.setIdentifier (and possibly elsewhere). The empty string should have been caught and disallowed. The various AST factory methods that create nodes with names include unspecified but legal identifiers; having some invented name is more useful to AST clients than an invisible name.

Comment 4 David Audel CLA 2006-02-22 11:30:23 EST
SimpleName.setIdentifier() already reject empty names.

ASTConverter don't use SimpleName.setIdentifier() but SimpleName.internalSetIdentifier(). That's why empty names aren't rejected when created by statements recovery.
I will change statements recovery to use an invented names instead of empty names.
Comment 5 David Audel CLA 2006-02-27 12:25:17 EST
Fixed and tests updated
  DietRecoveryTest#test75()
  DietRecoveryTest#test76()
  DietRecoveryTest#test77()
  DietRecoveryTest#test99()
  DietRecoveryTest#test114()
  StatementRecoveryTest#test0037()
  ASTConverterRecoveryTest#test0005()
  ASTConverterRecoveryTest#test0013()

Empty names are replaced by "$missing$".
As the node is flagged as Recovered and the invented name is "$missing$", the chance that this name enter in conflict with a real name is very limited.
Comment 6 Olivier Thomann CLA 2006-03-28 10:10:01 EST
Verified using I20060328-0010 for 3.2M6