Program: 34382
Project: 34382
Buggy source:
private void dropMethodsAndErrors(com.sun.tools.javac.util.Context ctx,CompilationUnitTree cut){
  Symtab syms=Symtab.instance(ctx);
  Names names=Names.instance(ctx);
  TreeMaker make=TreeMaker.instance(ctx);
  new TreePathScanner<Void,Void>(){
    @Override public Void visitVariable(    VariableTree node,    Void p){
      JCTree.JCVariableDecl decl=(JCTree.JCVariableDecl)node;
      if ((decl.mods.flags & Flags.ENUM) == 0) {
        decl.init=null;
      }
      decl.sym.type=decl.type=error2Object(decl.type);
      clearAnnotations(decl.sym.getMetadata());
      return super.visitVariable(node,p);
    }
    @Override public Void visitMethod(    MethodTree node,    Void p){
      JCTree.JCMethodDecl decl=(JCTree.JCMethodDecl)node;
      Symbol.MethodSymbol msym=decl.sym;
      if (Collections.disjoint(msym.getModifiers(),EnumSet.of(Modifier.NATIVE,Modifier.ABSTRACT))) {
        JCTree.JCNewClass nct=make.NewClass(null,com.sun.tools.javac.util.List.nil(),make.QualIdent(syms.runtimeExceptionType.tsym),com.sun.tools.javac.util.List.of(make.Literal("String_Node_Str")),null);
        nct.type=syms.runtimeExceptionType;
        nct.constructor=syms.runtimeExceptionType.tsym.members().getSymbols(s -> s.getKind() == ElementKind.CONSTRUCTOR && s.type.getParameterTypes().size() == 1 && s.type.getParameterTypes().head.tsym == syms.stringType.tsym).iterator().next();
        decl.body=make.Block(0,com.sun.tools.javac.util.List.of(make.Throw(nct)));
      }
      Type.MethodType mt;
      if (msym.type.hasTag(TypeTag.FORALL)) {
        ForAll fa=(ForAll)msym.type;
        fa.tvars=error2Object(fa.tvars);
        mt=fa.asMethodType();
      }
 else {
        mt=(Type.MethodType)msym.type;
      }
      mt.restype=error2Object(mt.restype);
      mt.argtypes=error2Object(mt.argtypes);
      mt.thrown=error2Object(mt.thrown);
      clearAnnotations(decl.sym.getMetadata());
      return super.visitMethod(node,p);
    }
    @Override public Void visitClass(    ClassTree node,    Void p){
      JCClassDecl clazz=(JCTree.JCClassDecl)node;
      Symbol.ClassSymbol csym=clazz.sym;
      Type.ClassType ct=(Type.ClassType)csym.type;
      ct.all_interfaces_field=error2Object(ct.all_interfaces_field);
      ct.allparams_field=error2Object(ct.allparams_field);
      ct.interfaces_field=error2Object(ct.interfaces_field);
      ct.typarams_field=error2Object(ct.typarams_field);
      ct.supertype_field=error2Object(ct.supertype_field);
      super.visitClass(node,p);
      for (      JCTree def : clazz.defs) {
        if (def.hasTag(JCTree.Tag.ERRONEOUS)) {
          clazz.defs=com.sun.tools.javac.util.List.filter(clazz.defs,def);
        }
      }
      return null;
    }
    private void clearAnnotations(    SymbolMetadata metadata){
      if (metadata == null)       return;
      com.sun.tools.javac.util.List<Attribute.Compound> annotations=metadata.getDeclarationAttributes();
      com.sun.tools.javac.util.List<Attribute.Compound> prev=null;
      while (annotations.nonEmpty()) {
        if (isErroneous(annotations.head.type)) {
          if (prev == null) {
            metadata.reset();
            metadata.setDeclarationAttributes(annotations.tail);
          }
 else {
            prev.tail=annotations.tail;
          }
        }
        prev=annotations;
        annotations=annotations.tail;
      }
    }
    private boolean isErroneous(    TypeMirror type){
      return type == null || type.getKind() == TypeKind.ERROR || type.getKind() == TypeKind.NONE || type.getKind() == TypeKind.OTHER;
    }
    private Set<Type> seen=Collections.newSetFromMap(new IdentityHashMap<>());
    private Type error2Object(    Type t){
      if (t == null)       return null;
      if (isErroneous(t)) {
        return syms.objectType;
      }
      if (!seen.add(t))       return t;
switch (t.getKind()) {
case DECLARED:
{
          resolveErrors((ClassType)t);
          break;
        }
case WILDCARD:
{
        Type.WildcardType wt=((Type.WildcardType)t);
        wt.type=error2Object(wt.type);
        TypeVar tv=wt.bound;
        tv.bound=error2Object(tv.bound);
        tv.lower=error2Object(tv.lower);
        break;
      }
  }
  return t;
}
private com.sun.tools.javac.util.List<Type> error2Object(com.sun.tools.javac.util.List<Type> types){
  if (types == null)   return null;
  ListBuffer<Type> lb=new ListBuffer<>();
  boolean changed=false;
  for (  Type t : types) {
    Type nue=error2Object(t);
    changed|=nue != t;
    lb.append(nue);
  }
  return changed ? lb.toList() : types;
}
private void resolveErrors(ClassType ct){
  if (ct.tsym == syms.objectType.tsym)   return;
  ct.all_interfaces_field=error2Object(ct.all_interfaces_field);
  ct.allparams_field=error2Object(ct.allparams_field);
  ct.interfaces_field=error2Object(ct.interfaces_field);
  ct.typarams_field=error2Object(ct.typarams_field);
  ct.supertype_field=error2Object(ct.supertype_field);
}
}
.scan(cut,null);
}

Fixed version (ground truth):
private void dropMethodsAndErrors(com.sun.tools.javac.util.Context ctx,CompilationUnitTree cut){
  Symtab syms=Symtab.instance(ctx);
  Names names=Names.instance(ctx);
  TreeMaker make=TreeMaker.instance(ctx);
  new TreePathScanner<Void,Void>(){
    @Override public Void visitVariable(    VariableTree node,    Void p){
      JCTree.JCVariableDecl decl=(JCTree.JCVariableDecl)node;
      if ((decl.mods.flags & Flags.ENUM) == 0) {
        decl.init=null;
      }
      decl.sym.type=decl.type=error2Object(decl.type);
      clearAnnotations(decl.sym.getMetadata());
      return super.visitVariable(node,p);
    }
    @Override public Void visitMethod(    MethodTree node,    Void p){
      JCTree.JCMethodDecl decl=(JCTree.JCMethodDecl)node;
      Symbol.MethodSymbol msym=decl.sym;
      if (Collections.disjoint(msym.getModifiers(),EnumSet.of(Modifier.NATIVE,Modifier.ABSTRACT))) {
        JCTree.JCNewClass nct=make.NewClass(null,com.sun.tools.javac.util.List.nil(),make.QualIdent(syms.runtimeExceptionType.tsym),com.sun.tools.javac.util.List.of(make.Literal("String_Node_Str")),null);
        nct.type=syms.runtimeExceptionType;
        nct.constructor=syms.runtimeExceptionType.tsym.members().getSymbols(s -> s.getKind() == ElementKind.CONSTRUCTOR && s.type.getParameterTypes().size() == 1 && s.type.getParameterTypes().head.tsym == syms.stringType.tsym).iterator().next();
        decl.body=make.Block(0,com.sun.tools.javac.util.List.of(make.Throw(nct)));
      }
      Type.MethodType mt;
      if (msym.type.hasTag(TypeTag.FORALL)) {
        ForAll fa=(ForAll)msym.type;
        fa.tvars=error2Object(fa.tvars);
        mt=fa.asMethodType();
      }
 else {
        mt=(Type.MethodType)msym.type;
      }
      clearMethodType(mt);
      if (msym.erasure_field != null && msym.erasure_field.hasTag(TypeTag.METHOD))       clearMethodType((Type.MethodType)msym.erasure_field);
      clearAnnotations(decl.sym.getMetadata());
      return super.visitMethod(node,p);
    }
    private void clearMethodType(    Type.MethodType mt){
      mt.restype=error2Object(mt.restype);
      mt.argtypes=error2Object(mt.argtypes);
      mt.thrown=error2Object(mt.thrown);
    }
    @Override public Void visitClass(    ClassTree node,    Void p){
      JCClassDecl clazz=(JCTree.JCClassDecl)node;
      Symbol.ClassSymbol csym=clazz.sym;
      Type.ClassType ct=(Type.ClassType)csym.type;
      ct.all_interfaces_field=error2Object(ct.all_interfaces_field);
      ct.allparams_field=error2Object(ct.allparams_field);
      ct.interfaces_field=error2Object(ct.interfaces_field);
      ct.typarams_field=error2Object(ct.typarams_field);
      ct.supertype_field=error2Object(ct.supertype_field);
      clearAnnotations(clazz.sym.getMetadata());
      super.visitClass(node,p);
      for (      JCTree def : clazz.defs) {
        if (def.hasTag(JCTree.Tag.ERRONEOUS)) {
          clazz.defs=com.sun.tools.javac.util.List.filter(clazz.defs,def);
        }
      }
      return null;
    }
    private void clearAnnotations(    SymbolMetadata metadata){
      if (metadata == null)       return;
      com.sun.tools.javac.util.List<Attribute.Compound> annotations=metadata.getDeclarationAttributes();
      com.sun.tools.javac.util.List<Attribute.Compound> prev=null;
      while (annotations.nonEmpty()) {
        if (isErroneous(annotations.head.type)) {
          if (prev == null) {
            metadata.reset();
            metadata.setDeclarationAttributes(annotations.tail);
          }
 else {
            prev.tail=annotations.tail;
          }
        }
        prev=annotations;
        annotations=annotations.tail;
      }
    }
    private boolean isErroneous(    TypeMirror type){
      return type == null || type.getKind() == TypeKind.ERROR || type.getKind() == TypeKind.NONE || type.getKind() == TypeKind.OTHER;
    }
    private Set<Type> seen=Collections.newSetFromMap(new IdentityHashMap<>());
    private Type error2Object(    Type t){
      if (t == null)       return null;
      if (isErroneous(t)) {
        return syms.objectType;
      }
      if (!seen.add(t))       return t;
switch (t.getKind()) {
case DECLARED:
{
          resolveErrors((ClassType)t);
          break;
        }
case WILDCARD:
{
        Type.WildcardType wt=((Type.WildcardType)t);
        wt.type=error2Object(wt.type);
        TypeVar tv=wt.bound;
        tv.bound=error2Object(tv.bound);
        tv.lower=error2Object(tv.lower);
        break;
      }
  }
  return t;
}
private com.sun.tools.javac.util.List<Type> error2Object(com.sun.tools.javac.util.List<Type> types){
  if (types == null)   return null;
  ListBuffer<Type> lb=new ListBuffer<>();
  boolean changed=false;
  for (  Type t : types) {
    Type nue=error2Object(t);
    changed|=nue != t;
    lb.append(nue);
  }
  return changed ? lb.toList() : types;
}
private void resolveErrors(ClassType ct){
  if (ct.tsym == syms.objectType.tsym)   return;
  ct.all_interfaces_field=error2Object(ct.all_interfaces_field);
  ct.allparams_field=error2Object(ct.allparams_field);
  ct.interfaces_field=error2Object(ct.interfaces_field);
  ct.typarams_field=error2Object(ct.typarams_field);
  ct.supertype_field=error2Object(ct.supertype_field);
}
}
.scan(cut,null);
}