langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
22 * or visit www.oracle.com if you need additional information or have any |
22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 package com.sun.tools.javac.util; |
25 package com.sun.tools.javac.util; |
26 |
26 |
|
27 import java.nio.file.Path; |
27 import java.util.Arrays; |
28 import java.util.Arrays; |
28 import java.util.Collection; |
29 import java.util.Collection; |
29 import java.util.EnumSet; |
30 import java.util.EnumSet; |
30 import java.util.HashMap; |
31 import java.util.HashMap; |
31 import java.util.Locale; |
32 import java.util.Locale; |
46 import com.sun.tools.javac.code.Type.CapturedType; |
47 import com.sun.tools.javac.code.Type.CapturedType; |
47 import com.sun.tools.javac.file.BaseFileObject; |
48 import com.sun.tools.javac.file.BaseFileObject; |
48 import com.sun.tools.javac.jvm.Profile; |
49 import com.sun.tools.javac.jvm.Profile; |
49 import com.sun.tools.javac.tree.JCTree.*; |
50 import com.sun.tools.javac.tree.JCTree.*; |
50 import com.sun.tools.javac.tree.Pretty; |
51 import com.sun.tools.javac.tree.Pretty; |
|
52 |
51 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*; |
53 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*; |
52 |
54 |
53 /** |
55 /** |
54 * This abstract class provides a basic implementation of the functionalities that should be provided |
56 * This abstract class provides a basic implementation of the functionalities that should be provided |
55 * by any formatter used by javac. Among the main features provided by AbstractDiagnosticFormatter are: |
57 * by any formatter used by javac. Among the main features provided by AbstractDiagnosticFormatter are: |
184 return s; |
186 return s; |
185 } |
187 } |
186 else if (arg instanceof JCExpression) { |
188 else if (arg instanceof JCExpression) { |
187 return expr2String((JCExpression)arg); |
189 return expr2String((JCExpression)arg); |
188 } |
190 } |
189 else if (arg instanceof Iterable<?>) { |
191 else if (arg instanceof Iterable<?> && !(arg instanceof Path)) { |
190 return formatIterable(d, (Iterable<?>)arg, l); |
192 return formatIterable(d, (Iterable<?>)arg, l); |
191 } |
193 } |
192 else if (arg instanceof Type) { |
194 else if (arg instanceof Type) { |
193 return printer.visit((Type)arg, l); |
195 return printer.visit((Type)arg, l); |
194 } |
196 } |