Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependency:
Always check https://search.maven.org/artifact/org.microbean/microbean-construct
for up-to-date available versions.
-->
<version>0.0.19</version>
<version>0.0.20</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.9.0</version>
<version>0.10.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central.sonatype.com</publishingServerId>
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/org/microbean/construct/Domain.java
Original file line number Diff line number Diff line change
Expand Up @@ -1511,10 +1511,10 @@ public default TypeVariable typeVariable(Parameterizable p, final CharSequence n
}

/**
* A convenience method that returns the first {@link VariableElement} with a {@linkplain ElementKind#isVariable()
* variable <code>ElementKind</code>} and {@linkplain Element#getSimpleName() bearing} the supplied {@code simpleName}
* that the supplied {@code enclosingElement} {@linkplain Element#getEnclosedElements() encloses}, <strong>or {@code
* null} if there is no such {@link VariableElement}</strong>.
* A convenience method that returns the first {@link VariableElement} {@linkplain Element#getSimpleName() bearing}
* the supplied {@code simpleName} that the supplied {@code enclosingElement} {@linkplain
* Element#getEnclosedElements() encloses}, <strong>or {@code null} if there is no such {@link
* VariableElement}</strong>.
*
* @param enclosingElement an {@link Element}; must not be {@code null}
*
Expand All @@ -1526,8 +1526,6 @@ public default TypeVariable typeVariable(Parameterizable p, final CharSequence n
*
* @see Element#getEnclosedElements()
*
* @see ElementKind#isVariable()
*
* @see Element#getSimpleName()
*
* @see VariableElement
Expand All @@ -1539,7 +1537,7 @@ public default VariableElement variableElement(final Element enclosingElement, f
case null -> throw new NullPointerException("enclosingElement");
case UniversalElement ue -> {
for (final UniversalElement ee : ue.getEnclosedElements()) {
if (ee.getKind().isVariable() && ee.getSimpleName().contentEquals(simpleName)) {
if (ee.getSimpleName().contentEquals(simpleName)) {
yield ee;
}
}
Expand All @@ -1548,7 +1546,7 @@ public default VariableElement variableElement(final Element enclosingElement, f
default -> {
try (var lock = lock()) {
for (final Element ee : enclosingElement.getEnclosedElements()) {
if (ee.getKind().isVariable() && ee.getSimpleName().contentEquals(simpleName)) {
if (ee.getSimpleName().contentEquals(simpleName)) {
yield (VariableElement)ee;
}
}
Expand Down
243 changes: 148 additions & 95 deletions src/main/java/org/microbean/construct/UniversalConstruct.java

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions src/main/java/org/microbean/construct/constant/Constables.java
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,23 @@ yield describe(t.getExtendsBound(), d)
};
}

/**
* Returns a nominal descriptor for the supplied {@link List}, or an {@linkplain Optional#empty() empty} {@link
* Optional} if the supplied {@link List} cannot be described.
*
* @param <E> the supplied {@code list}'s element type
*
* @param list a {@link List} to be described; may be {@code null}; if non-{@code null} <strong>must be immutable and
* must not contain {@code null} elements</strong> or undefined behavior will result
*
* @return a non-{@code null} {@link Optional}
*
* @see #describe(List, Function)
*/
public static final <E> Optional<? extends ConstantDesc> describe(final List<? extends E> list) {
return describe(list, e -> e instanceof Constable c ? c.describeConstable() : Optional.empty());
}

/**
* Returns a nominal descriptor for the supplied {@link List}, or an {@linkplain Optional#empty() empty} {@link
* Optional} if the supplied {@link List} cannot be described.
Expand Down
Loading