equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 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 |
267 public JCMethodDecl getTree(ExecutableElement method) { |
267 public JCMethodDecl getTree(ExecutableElement method) { |
268 return (JCMethodDecl) getTree((Element) method); |
268 return (JCMethodDecl) getTree((Element) method); |
269 } |
269 } |
270 |
270 |
271 public JCTree getTree(Element element) { |
271 public JCTree getTree(Element element) { |
272 Symbol symbol = (Symbol) element; |
272 return getTree(element, null); |
273 TypeSymbol enclosing = symbol.enclClass(); |
|
274 Env<AttrContext> env = enter.getEnv(enclosing); |
|
275 if (env == null) |
|
276 return null; |
|
277 JCClassDecl classNode = env.enclClass; |
|
278 if (classNode != null) { |
|
279 if (TreeInfo.symbolFor(classNode) == element) |
|
280 return classNode; |
|
281 for (JCTree node : classNode.getMembers()) |
|
282 if (TreeInfo.symbolFor(node) == element) |
|
283 return node; |
|
284 } |
|
285 return null; |
|
286 } |
273 } |
287 |
274 |
288 public JCTree getTree(Element e, AnnotationMirror a) { |
275 public JCTree getTree(Element e, AnnotationMirror a) { |
289 return getTree(e, a, null); |
276 return getTree(e, a, null); |
290 } |
277 } |