< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java

Print this page
*** 38,10 ***
--- 38,11 ---
  import javax.tools.JavaFileObject;
  
  import com.sun.tools.javac.code.*;
  import com.sun.tools.javac.code.Attribute.RetentionPolicy;
  import com.sun.tools.javac.code.Directive.*;
+ import com.sun.tools.javac.code.Scope.WriteableScope;
  import com.sun.tools.javac.code.Source.Feature;
  import com.sun.tools.javac.code.Symbol.*;
  import com.sun.tools.javac.code.Type.*;
  import com.sun.tools.javac.code.Types.SignatureGenerator.InvalidSignatureException;
  import com.sun.tools.javac.comp.Check;

*** 140,10 ***
--- 141,12 ---
      private final Log log;
  
      /** The name table. */
      private final Names names;
  
+     private final Symtab syms;
+ 
      /** Access to files. */
      private final JavaFileManager fileManager;
  
      /** The tags and constants used in compressed stackmap. */
      static final int SAME_FRAME_SIZE = 64;

*** 173,10 ***
--- 176,11 ---
          source = Source.instance(context);
          types = Types.instance(context);
          check = Check.instance(context);
          fileManager = context.get(JavaFileManager.class);
          poolWriter = Gen.instance(context).poolWriter;
+         syms = Symtab.instance(context);
  
          verbose        = options.isSet(VERBOSE);
          genCrt         = options.isSet(XJCOV);
          debugstackmap = options.isSet("debug.stackmap");
  

*** 346,10 ***
--- 350,16 ---
          if ((flags & DEPRECATED) != 0) {
              int alenIdx = writeAttr(names.Deprecated);
              endAttr(alenIdx);
              acount++;
          }
+         if ((flags & REFERENCE_FAVORING) != 0) {
+             int alenIdx = writeAttr(names.JavaFlags);
+             databuf.appendChar(ACC_REF_DEFAULT);
+             endAttr(alenIdx);
+             acount++;
+         }
          return acount;
      }
  
      /** Write member (field or method) attributes;
       *  return number of attributes written.

*** 1003,11 ***
              int alenIdx = writeAttr(names.AnnotationDefault);
              m.defaultValue.accept(awriter);
              endAttr(alenIdx);
              acount++;
          }
!         if (target.hasMethodParameters() && (options.isSet(PARAMETERS) || m.isConstructor() && (m.flags_field & RECORD) != 0)) {
              if (!m.isLambdaMethod()) // Per JDK-8138729, do not emit parameters table for lambda bodies.
                  acount += writeMethodParametersAttr(m);
          }
          acount += writeMemberAttrs(m, false);
          if (!m.isLambdaMethod())
--- 1013,13 ---
              int alenIdx = writeAttr(names.AnnotationDefault);
              m.defaultValue.accept(awriter);
              endAttr(alenIdx);
              acount++;
          }
!         if (target.hasMethodParameters() && (
+                 options.isSet(PARAMETERS)
+                 || ((m.flags_field & RECORD) != 0 && (m.isConstructor() || m.isPrimitiveObjectFactory())))) {
              if (!m.isLambdaMethod()) // Per JDK-8138729, do not emit parameters table for lambda bodies.
                  acount += writeMethodParametersAttr(m);
          }
          acount += writeMemberAttrs(m, false);
          if (!m.isLambdaMethod())

*** 1223,10 ***
--- 1235,14 ---
                  if (debugstackmap) System.out.print("null");
                  databuf.appendByte(5);
                  break;
              case CLASS:
              case ARRAY:
+                 if (debugstackmap) System.out.print("object(" + types.erasure(t).tsym + ")");
+                 databuf.appendByte(7);
+                 databuf.appendChar(types.isPrimitiveClass(t) ? poolWriter.putClass(new ConstantPoolQType(types.erasure(t), types)) : poolWriter.putClass(types.erasure(t)));
+                 break;
              case TYPEVAR:
                  if (debugstackmap) System.out.print("object(" + types.erasure(t).tsym + ")");
                  databuf.appendByte(7);
                  databuf.appendChar(poolWriter.putClass(types.erasure(t)));
                  break;

*** 1536,11 ***
          if (c.owner.kind == MDL) {
              flags = ACC_MODULE;
          } else {
              flags = adjustFlags(c.flags() & ~DEFAULT);
              if ((flags & PROTECTED) != 0) flags |= PUBLIC;
!             flags = flags & ClassFlags & ~STRICTFP;
              if ((flags & INTERFACE) == 0) flags |= ACC_SUPER;
          }
  
          if (dumpClassModifiers) {
              PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);
--- 1552,11 ---
          if (c.owner.kind == MDL) {
              flags = ACC_MODULE;
          } else {
              flags = adjustFlags(c.flags() & ~DEFAULT);
              if ((flags & PROTECTED) != 0) flags |= PUBLIC;
!             flags = flags & (ClassFlags | ACC_PRIMITIVE) & ~STRICTFP;
              if ((flags & INTERFACE) == 0) flags |= ACC_SUPER;
          }
  
          if (dumpClassModifiers) {
              PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);

*** 1706,10 ***
--- 1722,12 ---
              result |= ACC_BRIDGE;
          if ((flags & VARARGS) != 0)
              result |= ACC_VARARGS;
          if ((flags & DEFAULT) != 0)
              result &= ~ABSTRACT;
+         if ((flags & PRIMITIVE_CLASS) != 0)
+             result |= ACC_PRIMITIVE;
          return result;
      }
  
      long getLastModified(FileObject filename) {
          long mod = 0;
< prev index next >