langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
changeset 5320 e2aaa958b02d
parent 5013 e942b2e52479
child 5321 c8efe769cb3b
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Apr 09 15:39:39 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Apr 14 12:23:29 2010 +0100
@@ -131,7 +131,6 @@
         this.allowForeach = source.allowForeach();
         this.allowStaticImport = source.allowStaticImport();
         this.allowAnnotations = source.allowAnnotations();
-        this.allowDiamond = source.allowDiamond();
         this.allowTypeAnnotations = source.allowTypeAnnotations();
         this.keepDocComments = keepDocComments;
         if (keepDocComments)
@@ -149,10 +148,6 @@
      */
     boolean allowGenerics;
 
-    /** Switch: Should diamond operator be recognized?
-     */
-    boolean allowDiamond;
-
     /** Switch: Should varargs be recognized?
      */
     boolean allowVarargs;
@@ -199,7 +194,6 @@
     static final int TYPE = 2;
     static final int NOPARAMS = 4;
     static final int TYPEARG = 8;
-    static final int DIAMOND = 16;
 
     /** The current mode.
      */
@@ -1349,11 +1343,6 @@
         ListBuffer<JCExpression> args = lb();
         if (S.token() == LT) {
             S.nextToken();
-            if (S.token() == GT && (mode & DIAMOND) != 0) {
-                checkDiamond();
-                S.nextToken();
-                return List.nil();
-            }
             args.append(((mode & EXPR) == 0) ? typeArgument() : parseType());
             while (S.token() == COMMA) {
                 S.nextToken();
@@ -1527,7 +1516,7 @@
             t = F.AnnotatedType(newAnnotations, t);
 
         int oldmode = mode;
-        mode = TYPE | DIAMOND;
+        mode = TYPE;
         if (S.token() == LT) {
             checkGenerics();
             t = typeArguments(t);
@@ -1580,11 +1569,8 @@
     JCExpression innerCreator(int newpos, List<JCExpression> typeArgs, JCExpression encl) {
         JCExpression t = toP(F.at(S.pos()).Ident(ident()));
         if (S.token() == LT) {
-            int oldmode = mode;
-            mode |= DIAMOND;
             checkGenerics();
             t = typeArguments(t);
-            mode = oldmode;
         }
         return classCreatorRest(newpos, encl, typeArgs, t);
     }
@@ -3151,12 +3137,6 @@
         }
     }
 
-    void checkDiamond() {
-        if (!allowDiamond) {
-            log.error(S.pos(), "diamond.not.supported.in.source", source.name);
-            allowDiamond = true;
-        }
-    }
     void checkGenerics() {
         if (!allowGenerics) {
             log.error(S.pos(), "generics.not.supported.in.source", source.name);