diff --git a/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JVar.java b/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JVar.java index 359e66700..5a5482ab6 100644 --- a/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JVar.java +++ b/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JVar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -149,6 +149,13 @@ public JAnnotationUse annotate(JClass clazz){ return a; } + public void annotate(JAnnotationUse annotation) { + if (annotations == null) + annotations = new ArrayList<>(); + + annotations.add(annotation); + } + /** * Adds an annotation to this variable. * @@ -178,7 +185,7 @@ public Collection annotations() { } protected boolean isAnnotated() { - return annotations!=null; + return annotations != null && !annotations.isEmpty(); } public void bind(JFormatter f) { diff --git a/jaxb-ri/docs/release-documentation/src/docbook/jaxb-changelog.xml b/jaxb-ri/docs/release-documentation/src/docbook/jaxb-changelog.xml index f5355f5e6..af16b02de 100644 --- a/jaxb-ri/docs/release-documentation/src/docbook/jaxb-changelog.xml +++ b/jaxb-ri/docs/release-documentation/src/docbook/jaxb-changelog.xml @@ -36,6 +36,9 @@ #1676: Impossible to build with non-english system + + #1677: Add/implement JVar.annotate(JAnnotationUse annotation) + #1680: Avoid eager initialization of Scope objects.