2459 public Type visitForAll(ForAll t, List<Type> newThrown) { |
2459 public Type visitForAll(ForAll t, List<Type> newThrown) { |
2460 return new ForAll(t.tvars, t.qtype.accept(this, newThrown)); |
2460 return new ForAll(t.tvars, t.qtype.accept(this, newThrown)); |
2461 } |
2461 } |
2462 }; |
2462 }; |
2463 |
2463 |
|
2464 public Type createMethodTypeWithReturn(Type original, Type newReturn) { |
|
2465 return original.accept(methodWithReturn, newReturn); |
|
2466 } |
|
2467 // where |
|
2468 private final MapVisitor<Type> methodWithReturn = new MapVisitor<Type>() { |
|
2469 public Type visitType(Type t, Type newReturn) { |
|
2470 throw new IllegalArgumentException("Not a method type: " + t); |
|
2471 } |
|
2472 public Type visitMethodType(MethodType t, Type newReturn) { |
|
2473 return new MethodType(t.argtypes, newReturn, t.thrown, t.tsym); |
|
2474 } |
|
2475 public Type visitForAll(ForAll t, Type newReturn) { |
|
2476 return new ForAll(t.tvars, t.qtype.accept(this, newReturn)); |
|
2477 } |
|
2478 }; |
|
2479 |
2464 // <editor-fold defaultstate="collapsed" desc="createErrorType"> |
2480 // <editor-fold defaultstate="collapsed" desc="createErrorType"> |
2465 public Type createErrorType(Type originalType) { |
2481 public Type createErrorType(Type originalType) { |
2466 return new ErrorType(originalType, syms.errSymbol); |
2482 return new ErrorType(originalType, syms.errSymbol); |
2467 } |
2483 } |
2468 |
2484 |