hg: lambda/lambda/langtools: Conformance fix: adjust parsing of '_' as an identifier

bitter_fox bitterfoxc at gmail.com
Tue Jan 8 08:46:18 PST 2013


Hi, Maurizio.

Maybe you forgot to add code for javac to retain `_' packages.
Your commit makes a compiler error for a legal package declaration:

package _;

I think there is the same problem for `assert' packages.

--- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java    Tue
Jan 08 15:24:05 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java    Wed
Jan 09 01:33:39 2013 +0900
@@ -2701,7 +2701,7 @@
             mods = modifiersOpt(true);

         if (token.kind == PACKAGE) {
-            if (peekToken(IDENTIFIER)) {
+            if (peekToken(IDENTIFIER) | peekToken(UNDERSCORE)) {
                 seenPackage = true;
                 if (mods != null) {
                     checkNoMods(mods.flags);

Regards,
bitter_fox

2013/1/8 <maurizio.cimadamore at oracle.com>

> Changeset: 2e8ccb7ba243
> Author:    mcimadamore
> Date:      2013-01-08 13:31 +0100
> URL:
> http://hg.openjdk.java.net/lambda/lambda/langtools/rev/2e8ccb7ba243
>
> Conformance fix: adjust parsing of '_' as an identifier
> *) '_' cannot be used as a lambda parameter name
> *) use of '_' as an identifier will cause compile-time warnings
>
> ! src/share/classes/com/sun/tools/javac/parser/JavacParser.java
> ! src/share/classes/com/sun/tools/javac/parser/Tokens.java
> ! src/share/classes/com/sun/tools/javac/resources/compiler.properties
> ! test/tools/javac/diags/examples.not-yet.txt
> ! test/tools/javac/lambda/LambdaParserTest.java
> + test/tools/javac/lambda/WarnUnderscoreAsIdent.java
> + test/tools/javac/lambda/WarnUnderscoreAsIdent.out
>
>
>


More information about the lambda-dev mailing list