1 /* |
1 /* |
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2013, 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. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
124 // finished non-repeating annotations and placeholders for |
124 // finished non-repeating annotations and placeholders for |
125 // repeating annotations. |
125 // repeating annotations. |
126 // |
126 // |
127 // We need to do this in two passes because when creating |
127 // We need to do this in two passes because when creating |
128 // a container for a repeating annotation we must |
128 // a container for a repeating annotation we must |
129 // guarantee that the @ContainedBy on the |
129 // guarantee that the @Repeatable on the |
130 // contained annotation is fully annotated |
130 // contained annotation is fully annotated |
131 // |
131 // |
132 // The way we force this order is to do all repeating |
132 // The way we force this order is to do all repeating |
133 // annotations in a pass after all non-repeating are |
133 // annotations in a pass after all non-repeating are |
134 // finished. This will work because @ContainedBy |
134 // finished. This will work because @Repeatable |
135 // is non-repeating and therefore will be annotated in the |
135 // is non-repeating and therefore will be annotated in the |
136 // fist pass. |
136 // fist pass. |
137 |
137 |
138 // Queue a pass that will replace Attribute.Placeholders |
138 // Queue a pass that will replace Attribute.Placeholders |
139 // with Attribute.Compound (made from synthesized containers). |
139 // with Attribute.Compound (made from synthesized containers). |
259 // Check that the container isn't manually |
259 // Check that the container isn't manually |
260 // present along with repeated instances of |
260 // present along with repeated instances of |
261 // its contained annotation. |
261 // its contained annotation. |
262 ListBuffer<Attribute.Compound> manualContainer = ctx.annotated.get(validRepeated.type.tsym); |
262 ListBuffer<Attribute.Compound> manualContainer = ctx.annotated.get(validRepeated.type.tsym); |
263 if (manualContainer != null) { |
263 if (manualContainer != null) { |
264 log.error(ctx.pos.get(manualContainer.first()), "invalid.containedby.annotation.repeated.and.container.present", |
264 log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present", |
265 manualContainer.first().type.tsym); |
265 manualContainer.first().type.tsym); |
266 } |
266 } |
267 } |
267 } |
268 |
268 |
269 // A null return will delete the Placeholder |
269 // A null return will delete the Placeholder |