Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4025476

warning instead of error on illegal constructor identifier

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.0fcs
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Not verified

      Description



      Name: apC46001 Date: 01/13/97



      The test demonstrating this bug uses fully qualified name as constructor name.
      But '.' can not be used in identifier. JLS requires to issue a compiler-time error
      in this case. See the proper quotations below.

      The section "8.6 Constructor Declaration" of The Java Language
      Specification contains the following:

      "The SimpleTypeName in the ConstructorDeclarator must be the simple name of the class that contains the constructor declaration; otherwise a compile-time error
      occurs. "

      The section "3.8 Identifiers" of The Java Language
      Specification contains the following:

      " Identifier:

                     IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral

             IdentifierChars:

                     JavaLetter

                     IdentifierChars JavaLetterOrDigit

             JavaLetter:

                     any Unicode character that is a Java letter (see below)

             JavaLetterOrDigit:

                     any Unicode character that is a Java letter-or-digit (see below)

      Letters and digits may be drawn from the entire Unicode character set,
      which supports most writing scripts in use in the world today,
      including the large sets for Chinese, Japanese, and Korean. This allows
      Java programmers to use identifiers in their programs that are written
      in their native languages.

      A Java letter is a character for which the method
      Character.isJavaLetter (20.5.17) returns true. A Java letter-or-digit
      is a character for which the method Character.isJavaLetterOrDigit
      (20.5.18) returns true.

      The Java letters include uppercase and lowercase ASCII Latin letters
      A-Z (\u0041-\u005a), and a-z (\u0061-\u007a), and, for historical
      reasons, the ASCII underscore (_, or \u005f) and dollar sign ($, or
      \u0024). The $ character should be used only in mechanically generated
      Java code or, rarely, to access preexisting names on legacy systems."


      -------------------clss19501.java-------------------
      package javasoft.sqe.tests.lang.clss195.clss19501;


      import java.io.PrintStream;
       
      class clss19501_a {
      boolean isletter;
      javasoft.sqe.tests.lang.clss195.clss19501.clss19501_a() {
      isletter = Character.isLetter('.');
      }
      }

      public class clss19501 {
        public static void main(String argv[])
        {
           System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
        }
        public static int run(String argv[],PrintStream out) {
         clss19501_a x;
         x = new clss19501_a();
      out.println("isletter = "+x.isletter);
      return 2;
        }
      }

      --------------------------------------------
      javac clss19501.java -d .
      clss19501.java:16383: Invalid method declaration; return type required.

      ^
      1 warning

      java javasoft.sqe.tests.lang.clss195.clss19501.clss19501
      isletter = false

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            jrose John Rose
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: