src/share/classes/com/sun/tools/javac/comp/Attr.java

changeset 1492
df694c775e8a
parent 1456
f20568328a57
child 1510
7873d37f5b37
equal deleted inserted replaced
1491:9f42a06a49c0 1492:df694c775e8a
1 /* 1 /*
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 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
3842 "cant.extend.intf.annotation"); 3842 "cant.extend.intf.annotation");
3843 if (tree.typarams.nonEmpty()) 3843 if (tree.typarams.nonEmpty())
3844 log.error(tree.typarams.head.pos(), 3844 log.error(tree.typarams.head.pos(),
3845 "intf.annotation.cant.have.type.params"); 3845 "intf.annotation.cant.have.type.params");
3846 3846
3847 // If this annotation has a @ContainedBy, validate 3847 // If this annotation has a @Repeatable, validate
3848 Attribute.Compound containedBy = c.attribute(syms.containedByType.tsym); 3848 Attribute.Compound repeatable = c.attribute(syms.repeatableType.tsym);
3849 if (containedBy != null) { 3849 if (repeatable != null) {
3850 // get diagnositc position for error reporting 3850 // get diagnostic position for error reporting
3851 DiagnosticPosition cbPos = getDiagnosticPosition(tree, containedBy.type); 3851 DiagnosticPosition cbPos = getDiagnosticPosition(tree, repeatable.type);
3852 Assert.checkNonNull(cbPos); 3852 Assert.checkNonNull(cbPos);
3853 3853
3854 chk.validateContainedBy(c, containedBy, cbPos); 3854 chk.validateRepeatable(c, repeatable, cbPos);
3855 }
3856
3857 // If this annotation has a @ContainerFor, validate
3858 Attribute.Compound containerFor = c.attribute(syms.containerForType.tsym);
3859 if (containerFor != null) {
3860 // get diagnositc position for error reporting
3861 DiagnosticPosition cfPos = getDiagnosticPosition(tree, containerFor.type);
3862 Assert.checkNonNull(cfPos);
3863
3864 chk.validateContainerFor(c, containerFor, cfPos);
3865 } 3855 }
3866 } else { 3856 } else {
3867 // Check that all extended classes and interfaces 3857 // Check that all extended classes and interfaces
3868 // are compatible (i.e. no two define methods with same arguments 3858 // are compatible (i.e. no two define methods with same arguments
3869 // yet different return types). (JLS 8.4.6.3) 3859 // yet different return types). (JLS 8.4.6.3)

mercurial