langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2016, 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 |
26 package com.sun.tools.javac.api; |
26 package com.sun.tools.javac.api; |
27 |
27 |
28 import java.util.Collection; |
28 import java.util.Collection; |
29 import java.util.LinkedHashSet; |
29 import java.util.LinkedHashSet; |
30 import java.util.Locale; |
30 import java.util.Locale; |
|
31 import java.util.Objects; |
31 import java.util.ServiceLoader; |
32 import java.util.ServiceLoader; |
32 import java.util.Set; |
33 import java.util.Set; |
33 import java.util.stream.Collectors; |
34 import java.util.stream.Collectors; |
34 |
35 |
35 import javax.annotation.processing.Processor; |
36 import javax.annotation.processing.Processor; |
128 |
129 |
129 @Override @DefinedBy(Api.COMPILER_TREE) |
130 @Override @DefinedBy(Api.COMPILER_TREE) |
130 public TypeMirror getTypeMirror(Iterable<? extends Tree> path) { |
131 public TypeMirror getTypeMirror(Iterable<? extends Tree> path) { |
131 // TODO: Should complete attribution if necessary |
132 // TODO: Should complete attribution if necessary |
132 Tree last = null; |
133 Tree last = null; |
133 for (Tree node : path) |
134 for (Tree node : path) { |
134 last = node; |
135 last = Objects.requireNonNull(node); |
135 return ((JCTree)last).type; |
136 } |
|
137 if (last == null) { |
|
138 throw new IllegalArgumentException("empty path"); |
|
139 } |
|
140 return ((JCTree) last).type; |
136 } |
141 } |
137 |
142 |
138 @Override @DefinedBy(Api.COMPILER_TREE) |
143 @Override @DefinedBy(Api.COMPILER_TREE) |
139 public Elements getElements() { |
144 public Elements getElements() { |
140 if (context == null) |
145 if (context == null) |