Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/processor/TruffleProcessorTest.java @ 21480:c2b006c5e15f
Testing the annotation processor using the @ExpectedError annotation as suggested by Christian Humer
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Mon, 25 May 2015 10:36:30 +0200 |
parents | 24d12404e70a |
children | f5b49d881909 b1530a6cce8c |
comparison
equal
deleted
inserted
replaced
21479:2405d3b983cc | 21480:c2b006c5e15f |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.oracle.truffle.api.dsl.test.processor; | 23 package com.oracle.truffle.api.dsl.test.processor; |
24 | 24 |
25 import com.oracle.truffle.api.dsl.ExpectError; | |
26 import com.oracle.truffle.api.nodes.Node; | |
25 import com.oracle.truffle.dsl.processor.verify.VerifyTruffleProcessor; | 27 import com.oracle.truffle.dsl.processor.verify.VerifyTruffleProcessor; |
26 import java.util.Locale; | 28 import java.util.Locale; |
27 import java.util.ServiceLoader; | 29 import java.util.ServiceLoader; |
28 import javax.annotation.processing.Processor; | 30 import javax.annotation.processing.Processor; |
29 import javax.tools.Diagnostic; | 31 import javax.tools.Diagnostic; |
33 | 35 |
34 /** | 36 /** |
35 * Verify errors emitted by the processor. | 37 * Verify errors emitted by the processor. |
36 */ | 38 */ |
37 public class TruffleProcessorTest { | 39 public class TruffleProcessorTest { |
40 // | |
41 // AnnotationProcessor test using the NetBeans style | |
42 // | |
43 | |
38 @Test | 44 @Test |
39 public void childCannotBeFinal() throws Exception { | 45 public void childCannotBeFinal() throws Exception { |
40 // @formatter:off | 46 // @formatter:off |
41 String code = "package x.y.z;\n" + | 47 String code = "package x.y.z;\n" + |
42 "import com.oracle.truffle.api.nodes.Node;\n" + | 48 "import com.oracle.truffle.api.nodes.Node;\n" + |
76 return; | 82 return; |
77 } | 83 } |
78 } | 84 } |
79 fail(sb.toString()); | 85 fail(sb.toString()); |
80 } | 86 } |
87 | |
88 // | |
89 // and now the Truffle traditional way | |
90 // | |
91 | |
92 abstract class MyNode extends Node { | |
93 @ExpectError("@Child field cannot be final") @Child final MyNode first; | |
94 | |
95 MyNode(MyNode n) { | |
96 this.first = n; | |
97 } | |
98 } | |
81 } | 99 } |