< prev index next >

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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 28,38 **** import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; - import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.Type.ArrayType; --- 28,37 ----
*** 365,379 **** //compute new minimal inference context InferenceContext minContext = new InferenceContext(infer, minVars, minUndetVars.toList()); for (Type t : minContext.inferencevars) { //add listener that forwards notifications to original context minContext.addFreeTypeListener(List.of(t), (inferenceContext) -> { ! Type instType = inferenceContext.asInstType(t); ! for (Type eq : rv.minMap.get(t)) { ! ((UndetVar)asUndetVar(eq)).setInst(instType); ! } ! infer.doIncorporation(this, warn); notifyChange(); }); } if (shouldSolve) { //solve definitively unreachable variables --- 364,376 ---- //compute new minimal inference context InferenceContext minContext = new InferenceContext(infer, minVars, minUndetVars.toList()); for (Type t : minContext.inferencevars) { //add listener that forwards notifications to original context minContext.addFreeTypeListener(List.of(t), (inferenceContext) -> { ! ((UndetVar)asUndetVar(t)).setInst(inferenceContext.asInstType(t)); ! infer.doIncorporation(inferenceContext, warn); ! solve(List.from(rv.minMap.get(t)), warn); notifyChange(); }); } if (shouldSolve) { //solve definitively unreachable variables
*** 386,398 **** return minContext; } class ReachabilityVisitor extends Types.UnaryVisitor<Void> { ! Set<Type> equiv = new LinkedHashSet<>(); ! Set<Type> min = new LinkedHashSet<>(); ! Map<Type, Set<Type>> minMap = new LinkedHashMap<>(); void scan(List<Type> roots) { roots.stream().forEach(this::visit); } --- 383,395 ---- return minContext; } class ReachabilityVisitor extends Types.UnaryVisitor<Void> { ! Set<Type> equiv = new HashSet<>(); ! Set<Type> min = new HashSet<>(); ! Map<Type, Set<Type>> minMap = new HashMap<>(); void scan(List<Type> roots) { roots.stream().forEach(this::visit); }
*** 402,412 **** } @Override public Void visitUndetVar(UndetVar t, Void _unused) { if (min.add(t.qtype)) { ! Set<Type> deps = minMap.getOrDefault(t.qtype, new LinkedHashSet<>(Collections.singleton(t.qtype))); for (InferenceBound boundKind : InferenceBound.values()) { for (Type b : t.getBounds(boundKind)) { Type undet = asUndetVar(b); if (!undet.hasTag(TypeTag.UNDETVAR)) { visit(undet); --- 399,409 ---- } @Override public Void visitUndetVar(UndetVar t, Void _unused) { if (min.add(t.qtype)) { ! Set<Type> deps = minMap.getOrDefault(t.qtype, new HashSet<>(Collections.singleton(t.qtype))); for (InferenceBound boundKind : InferenceBound.values()) { for (Type b : t.getBounds(boundKind)) { Type undet = asUndetVar(b); if (!undet.hasTag(TypeTag.UNDETVAR)) { visit(undet);
< prev index next >