JDK-5008404 : Need method to identify Java identifiers
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2004-03-05
  • Updated: 2017-05-19
  • Resolved: 2005-10-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6Resolved
Related Reports
Duplicate :  
Relates :  
Description
Name: nl37777			Date: 03/04/2004

JSR 204 added new methods in the Character class to 
support supplementary characters in Java identifiers, but these methods 
only check a single character at a time. It would be beneficial to have 
a method that takes a complete String or CharSequence and checks 
whether it's a valid Java identifiers. Such a method would greatly 
increase the chances that tools in general will correctly handle 
supplementary characters in identifiers.
======================================================================

Comments
EVALUATION The JSR 269 enum javax.lang.model.SourceVersion has methods to recognize Java simple identifiers and names.
21-10-2005

EVALUATION Name: nl37777 Date: 03/04/2004 During the initial conversion of the J2SDK tools to support supplementary characters in identifiers, 9 tools were simply using Strings, an additional 4 were using Strings, but were iterating over the characters for other reasons, and 1 was using char[]. This indicates that a simple method java.lang.String.isJavaIdentifier would probably satisfy most needs. ====================================================================== Name: nl37777 Date: 03/24/2004 Additional discussion showed that this method does not need to check for keywords and literals (all keywords and some literals match the pattern for identifiers). Its name is therefore going to be isJavaIdentifierOrKeyword. ======================================================================
18-06-2004