35 import javax.lang.model.*; |
37 import javax.lang.model.*; |
36 import javax.lang.model.element.*; |
38 import javax.lang.model.element.*; |
37 import javax.tools.Diagnostic; |
39 import javax.tools.Diagnostic; |
38 import javax.tools.StandardLocation; |
40 import javax.tools.StandardLocation; |
39 |
41 |
40 |
42 public class TestInvalidRelativeNames extends JavacTestingAbstractProcessor { |
41 @SupportedAnnotationTypes("*") |
|
42 public class TestInvalidRelativeNames extends AbstractProcessor { |
|
43 enum Kind { CREATE_WRITER, GET_READER, CREATE_OUTPUT_STREAM, GET_INPUT_STREAM }; |
43 enum Kind { CREATE_WRITER, GET_READER, CREATE_OUTPUT_STREAM, GET_INPUT_STREAM }; |
44 |
44 |
45 static final String[] invalidRelativeNames = { |
45 static final String[] invalidRelativeNames = { |
46 "/boo", "goo/../hoo", "./ioo", "" |
46 "/boo", "goo/../hoo", "./ioo", "" |
47 }; |
47 }; |
48 |
|
49 @Override |
|
50 public SourceVersion getSupportedSourceVersion() { |
|
51 return SourceVersion.latest(); |
|
52 } |
|
53 |
|
54 Filer filer; |
|
55 Messager messager; |
|
56 |
|
57 @Override |
|
58 public void init(ProcessingEnvironment pEnv) { |
|
59 super.init(pEnv); |
|
60 filer = processingEnv.getFiler(); |
|
61 messager = processingEnv.getMessager(); |
|
62 } |
|
63 |
48 |
64 public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { |
49 public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { |
65 if (roundEnv.processingOver()) { |
50 if (roundEnv.processingOver()) { |
66 for (String relative: invalidRelativeNames) { |
51 for (String relative: invalidRelativeNames) { |
67 for (Kind kind: Kind.values()) { |
52 for (Kind kind: Kind.values()) { |