comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JDTCompiler.java @ 7530:5e3d1a68664e

applied mx eclipseformat to all Java files
author Doug Simon <doug.simon@oracle.com>
date Wed, 23 Jan 2013 16:34:57 +0100
parents 6343a09b2ec1
children
comparison
equal deleted inserted replaced
7529:4a11124a3563 7530:5e3d1a68664e
29 29
30 public class JDTCompiler extends AbstractCompiler { 30 public class JDTCompiler extends AbstractCompiler {
31 31
32 public static boolean isValidElement(Element currentElement) { 32 public static boolean isValidElement(Element currentElement) {
33 try { 33 try {
34 Class< ? > elementClass = Class.forName("org.eclipse.jdt.internal.compiler.apt.model.ElementImpl"); 34 Class<?> elementClass = Class.forName("org.eclipse.jdt.internal.compiler.apt.model.ElementImpl");
35 return elementClass.isAssignableFrom(currentElement.getClass()); 35 return elementClass.isAssignableFrom(currentElement.getClass());
36 } catch (ClassNotFoundException e) { 36 } catch (ClassNotFoundException e) {
37 return false; 37 return false;
38 } 38 }
39 } 39 }
46 if (source == null) { 46 if (source == null) {
47 return null; 47 return null;
48 } 48 }
49 49
50 /* 50 /*
51 * AbstractMethodDeclaration decl = ((MethodBinding)(((ElementImpl)method)._binding)).sourceMethod(); int 51 * AbstractMethodDeclaration decl =
52 * bodyStart = decl.bodyStart; int bodyEnd = decl.bodyEnd; 52 * ((MethodBinding)(((ElementImpl)method)._binding)).sourceMethod(); int bodyStart =
53 * decl.bodyStart; int bodyEnd = decl.bodyEnd;
53 */ 54 */
54 Object decl = method(field(method, "_binding"), "sourceMethod"); 55 Object decl = method(field(method, "_binding"), "sourceMethod");
55 int bodyStart = (int) field(decl, "bodyStart"); 56 int bodyStart = (int) field(decl, "bodyStart");
56 int bodyEnd = (int) field(decl, "bodyEnd"); 57 int bodyEnd = (int) field(decl, "bodyEnd");
57 58
65 } 66 }
66 } 67 }
67 68
68 private static char[] getSource(Element element) throws Exception { 69 private static char[] getSource(Element element) throws Exception {
69 /* 70 /*
70 * Binding binding = ((ElementImpl)element)._binding; char[] source = null; if (binding instanceof 71 * Binding binding = ((ElementImpl)element)._binding; char[] source = null; if (binding
71 * MethodBinding) { source = ((MethodBinding) 72 * instanceof MethodBinding) { source = ((MethodBinding)
72 * binding).sourceMethod().compilationResult.getCompilationUnit().getContents(); } else if (binding instanceof 73 * binding).sourceMethod().compilationResult.getCompilationUnit().getContents(); } else if
73 * SourceTypeBinding) { source = 74 * (binding instanceof SourceTypeBinding) { source =
74 * ((SourceTypeBinding)binding).scope.referenceContext.compilationResult.compilationUnit.getContents(); } return 75 * ((SourceTypeBinding)binding).scope.referenceContext
75 * source; 76 * .compilationResult.compilationUnit.getContents(); } return source;
76 */ 77 */
77 78
78 Object binding = field(element, "_binding"); 79 Object binding = field(element, "_binding");
79 Class< ? > methodBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.MethodBinding"); 80 Class<?> methodBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.MethodBinding");
80 Class< ? > referenceBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding"); 81 Class<?> referenceBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding");
81 82
82 char[] source = null; 83 char[] source = null;
83 if (methodBindingClass.isAssignableFrom(binding.getClass())) { 84 if (methodBindingClass.isAssignableFrom(binding.getClass())) {
84 Object sourceMethod = method(binding, "sourceMethod"); 85 Object sourceMethod = method(binding, "sourceMethod");
85 if (sourceMethod == null) { 86 if (sourceMethod == null) {