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

missing code coverage for records

    XMLWordPrintable

Details

    • b25

    Description

      the following methods are not covered by any test:

      com.sun.tools.sjavac.comp.PubapiVisitor::visitRecordComponent
      com.sun.tools.javac.code.SymbolMetadata::removeFromCompoundList

      at Lower::visitRecordDef:

      private void visitRecordDef(JCClassDecl tree) {
              make_at(tree.pos());
              List<VarSymbol> vars = recordVars(tree.type);
              MethodHandleSymbol[] getterMethHandles = new MethodHandleSymbol[vars.size()];
              int index = 0;
              for (VarSymbol var : vars) {
                  if (var.owner != tree.sym) {
                      var = new VarSymbol(var.flags_field, var.name, var.type, tree.sym); <--------- this line seems to be dead code
                  }
                  getterMethHandles[index] = var.asMethodHandle(true);
                  index++;
              }

              tree.defs = tree.defs.appendList(generateMandatedAccessors(tree));
              tree.defs = tree.defs.appendList(List.of(
                      generateRecordMethod(tree, names.toString, vars, getterMethHandles),
                      generateRecordMethod(tree, names.hashCode, vars, getterMethHandles),
                      generateRecordMethod(tree, names.equals, vars, getterMethHandles)
              ));
          }

      javax/lang/model/util/ElementFilter::recordComponentsIn(Ljava/util/Set;)Ljava/util/Set;

      Attachments

        Activity

          People

            asotona Adam Sotona
            vromero Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: