Skip to content

Commit 181ff7a

Browse files
authored
Road grading. Makes annotations mutable on purpose. (#35)
Signed-off-by: Laird Nelson <ljnelson@gmail.com>
1 parent b54eeab commit 181ff7a

File tree

11 files changed

+756
-153
lines changed

11 files changed

+756
-153
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependency:
3636
Always check https://search.maven.org/artifact/org.microbean/microbean-construct
3737
for up-to-date available versions.
3838
-->
39-
<version>0.0.19</version>
39+
<version>0.0.20</version>
4040
</dependency>
4141
```
4242

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
<plugin>
272272
<groupId>org.sonatype.central</groupId>
273273
<artifactId>central-publishing-maven-plugin</artifactId>
274-
<version>0.9.0</version>
274+
<version>0.10.0</version>
275275
<extensions>true</extensions>
276276
<configuration>
277277
<publishingServerId>central.sonatype.com</publishingServerId>

src/main/java/org/microbean/construct/Domain.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,10 +1511,10 @@ public default TypeVariable typeVariable(Parameterizable p, final CharSequence n
15111511
}
15121512

15131513
/**
1514-
* A convenience method that returns the first {@link VariableElement} with a {@linkplain ElementKind#isVariable()
1515-
* variable <code>ElementKind</code>} and {@linkplain Element#getSimpleName() bearing} the supplied {@code simpleName}
1516-
* that the supplied {@code enclosingElement} {@linkplain Element#getEnclosedElements() encloses}, <strong>or {@code
1517-
* null} if there is no such {@link VariableElement}</strong>.
1514+
* A convenience method that returns the first {@link VariableElement} {@linkplain Element#getSimpleName() bearing}
1515+
* the supplied {@code simpleName} that the supplied {@code enclosingElement} {@linkplain
1516+
* Element#getEnclosedElements() encloses}, <strong>or {@code null} if there is no such {@link
1517+
* VariableElement}</strong>.
15181518
*
15191519
* @param enclosingElement an {@link Element}; must not be {@code null}
15201520
*
@@ -1526,8 +1526,6 @@ public default TypeVariable typeVariable(Parameterizable p, final CharSequence n
15261526
*
15271527
* @see Element#getEnclosedElements()
15281528
*
1529-
* @see ElementKind#isVariable()
1530-
*
15311529
* @see Element#getSimpleName()
15321530
*
15331531
* @see VariableElement
@@ -1539,7 +1537,7 @@ public default VariableElement variableElement(final Element enclosingElement, f
15391537
case null -> throw new NullPointerException("enclosingElement");
15401538
case UniversalElement ue -> {
15411539
for (final UniversalElement ee : ue.getEnclosedElements()) {
1542-
if (ee.getKind().isVariable() && ee.getSimpleName().contentEquals(simpleName)) {
1540+
if (ee.getSimpleName().contentEquals(simpleName)) {
15431541
yield ee;
15441542
}
15451543
}
@@ -1548,7 +1546,7 @@ public default VariableElement variableElement(final Element enclosingElement, f
15481546
default -> {
15491547
try (var lock = lock()) {
15501548
for (final Element ee : enclosingElement.getEnclosedElements()) {
1551-
if (ee.getKind().isVariable() && ee.getSimpleName().contentEquals(simpleName)) {
1549+
if (ee.getSimpleName().contentEquals(simpleName)) {
15521550
yield (VariableElement)ee;
15531551
}
15541552
}

src/main/java/org/microbean/construct/UniversalConstruct.java

Lines changed: 148 additions & 95 deletions
Large diffs are not rendered by default.

src/main/java/org/microbean/construct/constant/Constables.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,23 @@ yield describe(t.getExtendsBound(), d)
753753
};
754754
}
755755

756+
/**
757+
* Returns a nominal descriptor for the supplied {@link List}, or an {@linkplain Optional#empty() empty} {@link
758+
* Optional} if the supplied {@link List} cannot be described.
759+
*
760+
* @param <E> the supplied {@code list}'s element type
761+
*
762+
* @param list a {@link List} to be described; may be {@code null}; if non-{@code null} <strong>must be immutable and
763+
* must not contain {@code null} elements</strong> or undefined behavior will result
764+
*
765+
* @return a non-{@code null} {@link Optional}
766+
*
767+
* @see #describe(List, Function)
768+
*/
769+
public static final <E> Optional<? extends ConstantDesc> describe(final List<? extends E> list) {
770+
return describe(list, e -> e instanceof Constable c ? c.describeConstable() : Optional.empty());
771+
}
772+
756773
/**
757774
* Returns a nominal descriptor for the supplied {@link List}, or an {@linkplain Optional#empty() empty} {@link
758775
* Optional} if the supplied {@link List} cannot be described.

0 commit comments

Comments
 (0)