diff --git a/README.md b/README.md
index 3592677..4216b4a 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ as a Maven dependency:
Always check https://search.maven.org/artifact/org.microbean/microbean-construct
for up-to-date available versions.
-->
- 0.0.4
+ 0.0.5
```
diff --git a/src/main/java/org/microbean/construct/DefaultDomain.java b/src/main/java/org/microbean/construct/DefaultDomain.java
index 1a1b7b7..65cbd91 100644
--- a/src/main/java/org/microbean/construct/DefaultDomain.java
+++ b/src/main/java/org/microbean/construct/DefaultDomain.java
@@ -1,6 +1,6 @@
/* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*-
*
- * Copyright © 2024 microBean™.
+ * Copyright © 2024–2025 microBean™.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
@@ -320,7 +320,7 @@ public int hashCode() {
// (Convenience.)
@Override // Domain
- public final UniversalElement javaLangObject() {
+ public UniversalElement javaLangObject() {
return UniversalElement.of(Domain.super.javaLangObject(), this);
}
@@ -421,6 +421,11 @@ public UniversalType primitiveType(TypeMirror t) {
}
}
+ @Override // Domain
+ public UniversalType rawType(final TypeMirror t) {
+ return UniversalType.of(Domain.super.rawType(t), this);
+ }
+
// (Canonical.)
@Override // Domain
public RecordComponentElement recordComponentElement(ExecutableElement e) {
diff --git a/src/main/java/org/microbean/construct/Domain.java b/src/main/java/org/microbean/construct/Domain.java
index 6bf6053..a6c8b73 100644
--- a/src/main/java/org/microbean/construct/Domain.java
+++ b/src/main/java/org/microbean/construct/Domain.java
@@ -358,7 +358,9 @@ public DeclaredType declaredType(final DeclaredType enclosingType,
* 10.1
*/
public default TypeMirror elementType(final TypeMirror t) {
- return t.getKind() == TypeKind.ARRAY ? this.elementType(((ArrayType)t).getComponentType()) : t;
+ try (var lock = lock()) {
+ return t.getKind() == TypeKind.ARRAY ? this.elementType(((ArrayType)t).getComponentType()) : t;
+ }
}
/**
@@ -480,9 +482,11 @@ public default boolean generic(final Element e) {
* @exception NullPointerException if {@code e} is {@code null}
*/
public default boolean javaLangObject(final Element e) {
- return
- e.getKind() == ElementKind.CLASS &&
- ((QualifiedNameable)e).getQualifiedName().contentEquals("java.lang.Object");
+ try (var lock = this.lock()) {
+ return
+ e.getKind() == ElementKind.CLASS &&
+ ((QualifiedNameable)e).getQualifiedName().contentEquals("java.lang.Object");
+ }
}
/**
@@ -499,9 +503,11 @@ public default boolean javaLangObject(final Element e) {
* @see #javaLangObject(Element)
*/
public default boolean javaLangObject(final TypeMirror t) {
- return
- t.getKind() == TypeKind.DECLARED &&
- javaLangObject(((DeclaredType)t).asElement());
+ try (var lock = this.lock()) {
+ return
+ t.getKind() == TypeKind.DECLARED &&
+ javaLangObject(((DeclaredType)t).asElement());
+ }
}
/**
@@ -654,9 +660,11 @@ public default TypeElement javaLangObject() {
* @exception NullPointerException if {@code t} is {@code null}
*/
public default boolean parameterized(final TypeMirror t) {
- return
- t.getKind() == TypeKind.DECLARED &&
- !((DeclaredType)t).getTypeArguments().isEmpty();
+ try (var lock = this.lock()) {
+ return
+ t.getKind() == TypeKind.DECLARED &&
+ !((DeclaredType)t).getTypeArguments().isEmpty();
+ }
}
/**
@@ -771,6 +779,34 @@ public default PrimitiveType primitiveType(final TypeElement e) {
// (Unboxing.)
public PrimitiveType primitiveType(final TypeMirror t);
+ /**
+ * A convenience method that returns {@code true} if and only if the supplied {@link TypeMirror} is a raw
+ * type according to the rules
+ * of the Java Language Specification
+ *
+ * @param t a {@link TypeMirror}; must not be {@code null}
+ *
+ * @return {@code true} if and only if the supplied {@link TypeMirror} is a raw type according to the rules of the Java Language
+ * Specification
+ *
+ * @exception NullPointerException if {@code t} is {@code null}
+ *
+ * @spec https://docs.oracle.com/javase/specs/jls/se23/html/jls-4.html#jls-4.8 Java Language Specification, section 4.8
+ */
+ public default boolean raw(final TypeMirror t) {
+ try (var lock = this.lock()) {
+ return switch (t.getKind()) {
+ case ARRAY -> raw(elementType((ArrayType)t));
+ case DECLARED -> {
+ final DeclaredType dt = (DeclaredType)t;
+ yield generic(dt.asElement()) && dt.getTypeArguments().isEmpty();
+ }
+ default -> false;
+ };
+ }
+ }
+
/**
* A convenience method that returns the raw type corresponding to {@code t}, or {@code null} if
* {@code t} is incapable of yielding
@@ -789,10 +825,12 @@ public default PrimitiveType primitiveType(final TypeElement e) {
* @spec https://docs.oracle.com/javase/specs/jls/se23/html/jls-4.html#jls-4.8 Java Language Specification, section 4.8
*/
public default TypeMirror rawType(final TypeMirror t) {
- return switch (t.getKind()) {
- case ARRAY -> this.rawType(this.elementType(t)); // recursive
- default -> this.parameterized(t) ? this.erasure(t) : null;
- };
+ try (var lock = this.lock()) {
+ return switch (t.getKind()) {
+ case ARRAY -> this.rawType(this.elementType(t)); // recursive
+ default -> this.parameterized(t) ? this.erasure(t) : null;
+ };
+ }
}
/**