Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/Utils.java @ 12564:935dcd8ad8eb
Truffle-DSL: fixed wrong type simple name references with ECJ in generated code.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 21 Oct 2013 11:07:32 +0200 |
parents | 8970574702a4 |
children | bd28da642eea |
comparison
equal
deleted
inserted
replaced
12454:ce4836e0212d | 12564:935dcd8ad8eb |
---|---|
304 case INT: | 304 case INT: |
305 return "Int"; | 305 return "Int"; |
306 case LONG: | 306 case LONG: |
307 return "Long"; | 307 return "Long"; |
308 case DECLARED: | 308 case DECLARED: |
309 return ((DeclaredType) mirror).asElement().getSimpleName().toString(); | 309 return fixECJBinaryNameIssue(((DeclaredType) mirror).asElement().getSimpleName().toString()); |
310 case ARRAY: | 310 case ARRAY: |
311 return getTypeId(((ArrayType) mirror).getComponentType()) + "Array"; | 311 return getTypeId(((ArrayType) mirror).getComponentType()) + "Array"; |
312 case VOID: | 312 case VOID: |
313 return "Void"; | 313 return "Void"; |
314 case WILDCARD: | 314 case WILDCARD: |
377 } | 377 } |
378 return b.toString(); | 378 return b.toString(); |
379 } | 379 } |
380 | 380 |
381 private static String getDeclaredName(DeclaredType element) { | 381 private static String getDeclaredName(DeclaredType element) { |
382 String simpleName = element.asElement().getSimpleName().toString(); | 382 String simpleName = fixECJBinaryNameIssue(element.asElement().getSimpleName().toString()); |
383 | 383 |
384 if (element.getTypeArguments().size() == 0) { | 384 if (element.getTypeArguments().size() == 0) { |
385 return simpleName; | 385 return simpleName; |
386 } | 386 } |
387 | 387 |
395 } | 395 } |
396 } | 396 } |
397 } | 397 } |
398 b.append(">"); | 398 b.append(">"); |
399 return b.toString(); | 399 return b.toString(); |
400 } | |
401 | |
402 public static String fixECJBinaryNameIssue(String name) { | |
403 if (name.contains("$")) { | |
404 int lastIndex = name.lastIndexOf('$'); | |
405 return name.substring(lastIndex + 1, name.length()); | |
406 } | |
407 return name; | |
400 } | 408 } |
401 | 409 |
402 public static String getQualifiedName(TypeElement element) { | 410 public static String getQualifiedName(TypeElement element) { |
403 String qualifiedName = element.getQualifiedName().toString(); | 411 String qualifiedName = element.getQualifiedName().toString(); |
404 if (qualifiedName.contains("$")) { | 412 if (qualifiedName.contains("$")) { |