equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 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. |
7 * published by the Free Software Foundation. |
49 import javax.lang.model.type.DeclaredType; |
49 import javax.lang.model.type.DeclaredType; |
50 import javax.lang.model.type.IntersectionType; |
50 import javax.lang.model.type.IntersectionType; |
51 import javax.lang.model.type.TypeMirror; |
51 import javax.lang.model.type.TypeMirror; |
52 import javax.lang.model.type.TypeVariable; |
52 import javax.lang.model.type.TypeVariable; |
53 import javax.lang.model.type.WildcardType; |
53 import javax.lang.model.type.WildcardType; |
54 import javax.lang.model.util.ElementScanner8; |
|
55 import javax.lang.model.util.SimpleAnnotationValueVisitor8; |
|
56 import javax.tools.Diagnostic.Kind; |
54 import javax.tools.Diagnostic.Kind; |
57 |
55 |
58 public class NoPrivateTypesExported extends JavacTestingAbstractProcessor { |
56 public class NoPrivateTypesExported extends JavacTestingAbstractProcessor { |
59 |
57 |
60 private static final String[] javaxLangModelPackages = new String[] { |
58 private static final String[] javaxLangModelPackages = new String[] { |
129 } |
127 } |
130 } |
128 } |
131 |
129 |
132 private void verifyReferredTypesAcceptable(Element rootElement, |
130 private void verifyReferredTypesAcceptable(Element rootElement, |
133 final Set<String> acceptable) { |
131 final Set<String> acceptable) { |
134 new ElementScanner8<Void, Void>() { |
132 new ElementScanner<Void, Void>() { |
135 @Override public Void visitType(TypeElement e, Void p) { |
133 @Override public Void visitType(TypeElement e, Void p) { |
136 verifyTypeAcceptable(e.getSuperclass(), acceptable); |
134 verifyTypeAcceptable(e.getSuperclass(), acceptable); |
137 verifyTypesAcceptable(e.getInterfaces(), acceptable); |
135 verifyTypesAcceptable(e.getInterfaces(), acceptable); |
138 scan(e.getTypeParameters(), p); |
136 scan(e.getTypeParameters(), p); |
139 scan(e.getEnclosedElements(), p); |
137 scan(e.getEnclosedElements(), p); |
187 } |
185 } |
188 } |
186 } |
189 |
187 |
190 private void verifyAnnotationValue(AnnotationValue value, |
188 private void verifyAnnotationValue(AnnotationValue value, |
191 final Set<String> acceptable) { |
189 final Set<String> acceptable) { |
192 value.accept(new SimpleAnnotationValueVisitor8<Void, Void>() { |
190 value.accept(new SimpleAnnotationValueVisitor<Void, Void>() { |
193 @Override public Void visitType(TypeMirror t, Void p) { |
191 @Override public Void visitType(TypeMirror t, Void p) { |
194 verifyTypeAcceptable(t, acceptable); |
192 verifyTypeAcceptable(t, acceptable); |
195 return null; |
193 return null; |
196 } |
194 } |
197 @Override |
195 @Override |