< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java

Print this page

 903                         newPatterns.addAll(toAdd);
 904                         return newPatterns;
 905                     }
 906                 }
 907             }
 908             return patterns;
 909         }
 910 
 911         private Set<Symbol> allPermittedSubTypes(ClassSymbol root, Predicate<ClassSymbol> accept) {
 912             Set<Symbol> permitted = new HashSet<>();
 913             List<ClassSymbol> permittedSubtypesClosure = List.of(root);
 914 
 915             while (permittedSubtypesClosure.nonEmpty()) {
 916                 ClassSymbol current = permittedSubtypesClosure.head;
 917 
 918                 permittedSubtypesClosure = permittedSubtypesClosure.tail;
 919 
 920                 current.complete();
 921 
 922                 if (current.isSealed() && current.isAbstract()) {
 923                     for (Symbol sym : current.permitted) {
 924                         ClassSymbol csym = (ClassSymbol) sym;
 925 
 926                         if (accept.test(csym)) {
 927                             permittedSubtypesClosure = permittedSubtypesClosure.prepend(csym);
 928                             permitted.add(csym);
 929                         }
 930                     }
 931                 }
 932             }
 933 
 934             return permitted;
 935         }
 936 
 937         /* Among the set of patterns, find sub-set of patterns such:
 938          * $record($prefix$, $nested, $suffix$)
 939          * Where $record, $prefix$ and $suffix$ is the same for each pattern
 940          * in the set, and the patterns only differ in one "column" in
 941          * the $nested pattern.
 942          * Then, the set of $nested patterns is taken, and passed recursively
 943          * to reduceNestedPatterns and to reduceBindingPatterns, to
 944          * simplify the pattern. If that succeeds, the original found sub-set

 903                         newPatterns.addAll(toAdd);
 904                         return newPatterns;
 905                     }
 906                 }
 907             }
 908             return patterns;
 909         }
 910 
 911         private Set<Symbol> allPermittedSubTypes(ClassSymbol root, Predicate<ClassSymbol> accept) {
 912             Set<Symbol> permitted = new HashSet<>();
 913             List<ClassSymbol> permittedSubtypesClosure = List.of(root);
 914 
 915             while (permittedSubtypesClosure.nonEmpty()) {
 916                 ClassSymbol current = permittedSubtypesClosure.head;
 917 
 918                 permittedSubtypesClosure = permittedSubtypesClosure.tail;
 919 
 920                 current.complete();
 921 
 922                 if (current.isSealed() && current.isAbstract()) {
 923                     for (Type t : current.getPermittedSubclasses()) {
 924                         ClassSymbol csym = (ClassSymbol) t.tsym;
 925 
 926                         if (accept.test(csym)) {
 927                             permittedSubtypesClosure = permittedSubtypesClosure.prepend(csym);
 928                             permitted.add(csym);
 929                         }
 930                     }
 931                 }
 932             }
 933 
 934             return permitted;
 935         }
 936 
 937         /* Among the set of patterns, find sub-set of patterns such:
 938          * $record($prefix$, $nested, $suffix$)
 939          * Where $record, $prefix$ and $suffix$ is the same for each pattern
 940          * in the set, and the patterns only differ in one "column" in
 941          * the $nested pattern.
 942          * Then, the set of $nested patterns is taken, and passed recursively
 943          * to reduceNestedPatterns and to reduceBindingPatterns, to
 944          * simplify the pattern. If that succeeds, the original found sub-set
< prev index next >