< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java

Print this page

        

@@ -68,11 +68,10 @@
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import com.sun.tools.javac.code.MissingInfoHandler;
 import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol;
-import static com.sun.tools.javac.code.Symbol.OperatorSymbol.AccessCode.FIRSTASGOP;
 import com.sun.tools.javac.code.Type;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.code.TypeTag.FORALL;
 import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
 import static com.sun.tools.javac.jvm.ByteCodes.iadd;

@@ -297,10 +296,18 @@
      */
     public Symbol clone(Symbol newOwner) {
         throw new AssertionError();
     }
 
+    public boolean isProjectedNullable() {
+        return false;
+    }
+
+    public ClassSymbol nullFreeTypeSymbol() {
+        return this.type.hasTag(CLASS) && ((this.flags() & VALUE) != 0) ? (ClassSymbol) this : null;
+    }
+
     public <R, P> R accept(Symbol.Visitor<R, P> v, P p) {
         return v.visitSymbol(this, p);
     }
 
     /** The Java source which this symbol represents.

@@ -404,10 +411,14 @@
 
     public boolean isPrivate() {
         return (flags_field & Flags.AccessFlags) == PRIVATE;
     }
 
+    public boolean isValue() {
+        return (flags() & VALUE) != 0;
+    }
+
     public boolean isEnum() {
         return (flags() & ENUM) != 0;
     }
 
     /** Is this symbol declared (directly or indirectly) local

@@ -429,11 +440,17 @@
     }
 
     /** Is this symbol a constructor?
      */
     public boolean isConstructor() {
-        return name == name.table.names.init;
+        return name == name.table.names.init && (flags() & STATIC) == 0;
+    }
+
+    /** Is this symbol a value factory?
+     */
+    public boolean isValueFactory() {
+        return ((name == name.table.names.init && this.type.getReturnType().tsym == this.owner));
     }
 
     public boolean isDynamic() {
         return false;
     }

@@ -1317,12 +1334,13 @@
 
         public String className() {
             if (name.isEmpty())
                 return
                     Log.getLocalizedString("anonymous.class", flatname);
-            else
-                return fullname.toString();
+
+                String s = fullname.toString();
+                return isProjectedNullable() ? s + '?' : s;
         }
 
         @DefinedBy(Api.LANGUAGE_MODEL)
         public Name getQualifiedName() {
             return fullname;

@@ -2247,11 +2265,11 @@
             }
             accessCode = AccessCode.from(tag, opcode);
             return accessCode;
         }
 
-        /** Access codes for dereferencing, assignment,
+        /** Access codes for dereferencing, assignment, withfield
          *  and pre/post increment/decrement.
 
          *  All access codes for accesses to the current class are even.
          *  If a member of the superclass should be accessed instead (because
          *  access was via a qualified super), add one to the corresponding code

@@ -2267,11 +2285,12 @@
             ASSIGN(2, Tag.ASSIGN),
             PREINC(4, Tag.PREINC),
             PREDEC(6, Tag.PREDEC),
             POSTINC(8, Tag.POSTINC),
             POSTDEC(10, Tag.POSTDEC),
-            FIRSTASGOP(12, Tag.NO_TAG);
+            WITHFIELD(12, Tag.WITHFIELD),
+            FIRSTASGOP(14, Tag.NO_TAG);
 
             public final int code;
             public final Tag tag;
             public static final int numberOfAccessCodes = (lushrl - ishll + lxor + 2 - iadd) * 2 + FIRSTASGOP.code + 2;
 

@@ -2300,10 +2319,12 @@
                         return AccessCode.PREDEC.code;
                     case POSTINC:
                         return AccessCode.POSTINC.code;
                     case POSTDEC:
                         return AccessCode.POSTDEC.code;
+                    case WITHFIELD:
+                        return AccessCode.WITHFIELD.code;
                 }
                 if (iadd <= opcode && opcode <= lxor) {
                     return (opcode - iadd) * 2 + FIRSTASGOP.code;
                 } else if (opcode == string_add) {
                     return (lxor + 1 - iadd) * 2 + FIRSTASGOP.code;
< prev index next >