8034143: javac, subclasses of Infer.IncorporationStep should implement the accepts() method
authorvromero
Sat, 22 Feb 2014 17:42:10 +0000
changeset 23124 63050cb08583
parent 23123 fd8ad69ac7fe
child 23125 6fec42407d2b
child 23126 1994a0d3b8de
8034143: javac, subclasses of Infer.IncorporationStep should implement the accepts() method Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Feb 21 15:14:09 2014 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Sat Feb 22 17:42:10 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -583,11 +583,17 @@
                     }
                 }
             }
+
+            @Override
+            boolean accepts(UndetVar uv, InferenceContext inferenceContext) {
+                return !uv.isCaptured() && uv.getBounds(InferenceBound.EQ).nonEmpty();
+            }
         },
         /**
          * Check consistency of equality constraints.
          */
         EQ_CHECK() {
+            @Override
             public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
                 Infer infer = inferenceContext.infer();
                 for (Type e : uv.getBounds(InferenceBound.EQ)) {
@@ -604,6 +610,11 @@
                     }
                 }
             }
+
+            @Override
+            boolean accepts(UndetVar uv, InferenceContext inferenceContext) {
+                return !uv.isCaptured() && uv.getBounds(InferenceBound.EQ).nonEmpty();
+            }
         },
         /**
          * Given a bound set containing {@code alpha <: T} and {@code alpha :> S}
@@ -618,6 +629,13 @@
                     }
                 }
             }
+
+            @Override
+            boolean accepts(UndetVar uv, InferenceContext inferenceContext) {
+                return !uv.isCaptured() &&
+                        uv.getBounds(InferenceBound.UPPER).nonEmpty() &&
+                        uv.getBounds(InferenceBound.LOWER).nonEmpty();
+            }
         },
         /**
          * Given a bound set containing {@code alpha <: T} and {@code alpha == S}
@@ -632,6 +650,13 @@
                     }
                 }
             }
+
+            @Override
+            boolean accepts(UndetVar uv, InferenceContext inferenceContext) {
+                return !uv.isCaptured() &&
+                        uv.getBounds(InferenceBound.EQ).nonEmpty() &&
+                        uv.getBounds(InferenceBound.UPPER).nonEmpty();
+            }
         },
         /**
          * Given a bound set containing {@code alpha :> S} and {@code alpha == T}
@@ -646,6 +671,13 @@
                     }
                 }
             }
+
+            @Override
+            boolean accepts(UndetVar uv, InferenceContext inferenceContext) {
+                return !uv.isCaptured() &&
+                        uv.getBounds(InferenceBound.EQ).nonEmpty() &&
+                        uv.getBounds(InferenceBound.LOWER).nonEmpty();
+            }
         },
         /**
          * Given a bound set containing {@code alpha == S} and {@code alpha == T}
@@ -662,6 +694,12 @@
                     }
                 }
             }
+
+            @Override
+            boolean accepts(UndetVar uv, InferenceContext inferenceContext) {
+                return !uv.isCaptured() &&
+                        uv.getBounds(InferenceBound.EQ).nonEmpty();
+            }
         },
         /**
          * Given a bound set containing {@code alpha <: beta} propagate lower bounds
@@ -688,6 +726,12 @@
                     }
                 }
             }
+
+            @Override
+            boolean accepts(UndetVar uv, InferenceContext inferenceContext) {
+                return !uv.isCaptured() &&
+                        uv.getBounds(InferenceBound.UPPER).nonEmpty();
+            }
         },
         /**
          * Given a bound set containing {@code alpha :> beta} propagate lower bounds
@@ -714,6 +758,12 @@
                     }
                 }
             }
+
+            @Override
+            boolean accepts(UndetVar uv, InferenceContext inferenceContext) {
+                return !uv.isCaptured() &&
+                        uv.getBounds(InferenceBound.LOWER).nonEmpty();
+            }
         },
         /**
          * Given a bound set containing {@code alpha == beta} propagate lower/upper
@@ -748,6 +798,12 @@
                     }
                 }
             }
+
+            @Override
+            boolean accepts(UndetVar uv, InferenceContext inferenceContext) {
+                return !uv.isCaptured() &&
+                        uv.getBounds(InferenceBound.EQ).nonEmpty();
+            }
         };
 
         abstract void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn);