Skip to content

Commit 919d3e9

Browse files
authored
Fixes Constables issues (#29)
Signed-off-by: Laird Nelson <[email protected]>
1 parent d004647 commit 919d3e9

File tree

3 files changed

+23
-31
lines changed

3 files changed

+23
-31
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ as a Maven dependency:
3131
Always check https://search.maven.org/artifact/org.microbean/microbean-construct
3232
for up-to-date available versions.
3333
-->
34-
<version>0.0.15</version>
34+
<version>0.0.16</version>
3535
</dependency>
3636
```
3737

pom.xml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@
5757
<name>microBean™ Construct Site</name>
5858
<url>https://microbean.github.io/microbean-construct/</url>
5959
</site>
60-
<!-- Ostensibly no longer needed with central-publishing-maven-plugin (see https://central.sonatype.org/publish/publish-portal-snapshots/#publishing-with-the-central-publishing-maven-plugin) -->
61-
<!--
62-
<snapshotRepository>
63-
<id>central.sonatype.com</id>
64-
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
65-
</snapshotRepository>
66-
-->
6760
</distributionManagement>
6861

6962
<properties>
@@ -86,7 +79,6 @@
8679
<releaseProfiles>deployment</releaseProfiles>
8780
<scmCommentPrefix>[maven-release-plugin] [skip ci]</scmCommentPrefix>
8881
<tagNameFormat>v@{project.version}</tagNameFormat>
89-
<useReleaseProfile>false</useReleaseProfile>
9082

9183
<!-- maven-scm-publish-plugin properties;
9284
see https://maven.apache.org/plugins/maven-scm-publish-plugin/publish-scm-mojo.html -->
@@ -192,11 +184,11 @@
192184
</plugin>
193185
<plugin>
194186
<artifactId>maven-enforcer-plugin</artifactId>
195-
<version>3.5.0</version>
187+
<version>3.6.1</version>
196188
</plugin>
197189
<plugin>
198190
<artifactId>maven-gpg-plugin</artifactId>
199-
<version>3.2.7</version>
191+
<version>3.2.8</version>
200192
</plugin>
201193
<plugin>
202194
<artifactId>maven-install-plugin</artifactId>
@@ -208,7 +200,7 @@
208200
</plugin>
209201
<plugin>
210202
<artifactId>maven-javadoc-plugin</artifactId>
211-
<version>3.11.2</version>
203+
<version>3.11.3</version>
212204
<configuration>
213205
<docfilessubdirs>true</docfilessubdirs>
214206
</configuration>
@@ -264,7 +256,7 @@
264256
<plugin>
265257
<groupId>com.github.spotbugs</groupId>
266258
<artifactId>spotbugs-maven-plugin</artifactId>
267-
<version>4.9.3.1</version>
259+
<version>4.9.4.0</version>
268260
</plugin>
269261
<plugin>
270262
<groupId>org.codehaus.mojo</groupId>
@@ -274,7 +266,7 @@
274266
<plugin>
275267
<groupId>io.smallrye</groupId>
276268
<artifactId>jandex-maven-plugin</artifactId>
277-
<version>3.3.1</version>
269+
<version>3.4.0</version>
278270
</plugin>
279271
<plugin>
280272
<groupId>org.sonatype.central</groupId>
@@ -411,5 +403,4 @@
411403
</profile>
412404
</profiles>
413405

414-
415406
</project>

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

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static final Optional<? extends ConstantDesc> describe(final Name n, fina
108108
default -> (d instanceof Constable c ? c.describeConstable() : Optional.<ConstantDesc>empty())
109109
.map(domainDesc -> DynamicConstantDesc.of(BSM_INVOKE,
110110
MethodHandleDesc.ofMethod(VIRTUAL,
111-
ClassDesc.of(d.getClass().getName()),
111+
ClassDesc.of(Domain.class.getName()),
112112
"name",
113113
MethodTypeDesc.of(CD_Name,
114114
CD_CharSequence)),
@@ -207,7 +207,7 @@ public static final Optional<? extends ConstantDesc> describe(final ExecutableEl
207207
final ConstantDesc[] args = new ConstantDesc[5 + parameterCount];
208208
args[0] =
209209
MethodHandleDesc.ofMethod(VIRTUAL,
210-
ClassDesc.of(d.getClass().getName()),
210+
ClassDesc.of(Domain.class.getName()),
211211
"executableElement",
212212
MethodTypeDesc.of(CD_ExecutableElement,
213213
CD_TypeElement,
@@ -260,7 +260,7 @@ public static final Optional<? extends ConstantDesc> describe(final ModuleElemen
260260
default -> describe(e.getQualifiedName(), d) // getQualifiedName() does not cause symbol completion
261261
.map(nameDesc -> DynamicConstantDesc.of(BSM_INVOKE,
262262
MethodHandleDesc.ofMethod(VIRTUAL,
263-
ClassDesc.of(d.getClass().getName()),
263+
ClassDesc.of(Domain.class.getName()),
264264
"moduleElement",
265265
MethodTypeDesc.of(CD_ModuleElement,
266266
CD_CharSequence)),
@@ -289,7 +289,7 @@ public static final Optional<? extends ConstantDesc> describe(final PackageEleme
289289
default -> describe(e.getQualifiedName(), d) // getQualifiedName() does not cause symbol completion
290290
.map(nameDesc -> DynamicConstantDesc.of(BSM_INVOKE,
291291
MethodHandleDesc.ofMethod(VIRTUAL,
292-
ClassDesc.of(d.getClass().getName()),
292+
ClassDesc.of(Domain.class.getName()),
293293
"packageElement",
294294
MethodTypeDesc.of(CD_PackageElement,
295295
CD_CharSequence)),
@@ -318,7 +318,7 @@ public static final Optional<? extends ConstantDesc> describe(final TypeElement
318318
default -> describe(e.getQualifiedName(), d) // getQualifiedName() does not cause symbol completion
319319
.map(nameDesc -> DynamicConstantDesc.of(BSM_INVOKE,
320320
MethodHandleDesc.ofMethod(VIRTUAL,
321-
ClassDesc.of(d.getClass().getName()),
321+
ClassDesc.of(Domain.class.getName()),
322322
"typeElement",
323323
MethodTypeDesc.of(CD_TypeElement,
324324
CD_CharSequence)),
@@ -350,7 +350,7 @@ yield describe(e.getEnclosingElement(), d)
350350
.flatMap(parameterizableDesc -> describe(e.getSimpleName(), d)
351351
.map(nameDesc -> DynamicConstantDesc.of(BSM_INVOKE,
352352
MethodHandleDesc.ofMethod(VIRTUAL,
353-
ClassDesc.of(d.getClass().getName()),
353+
ClassDesc.of(Domain.class.getName()),
354354
"typeParameterElement",
355355
MethodTypeDesc.of(CD_TypeParameterElement,
356356
CD_Parameterizable,
@@ -385,7 +385,7 @@ public static final Optional<? extends ConstantDesc> describe(final RecordCompon
385385
yield describe((TypeElement)e.getEnclosingElement(), d)
386386
.map(executableDesc -> DynamicConstantDesc.of(BSM_INVOKE,
387387
MethodHandleDesc.ofMethod(VIRTUAL,
388-
ClassDesc.of(d.getClass().getName()),
388+
ClassDesc.of(Domain.class.getName()),
389389
"recordComponentElement",
390390
MethodTypeDesc.of(CD_RecordComponentElement,
391391
CD_ExecutableElement)),
@@ -419,7 +419,7 @@ yield describe(e.getSimpleName(), d)
419419
.flatMap(nameDesc -> describe(e.getEnclosingElement(), d)
420420
.map(enclosingElementDesc -> DynamicConstantDesc.of(BSM_INVOKE,
421421
MethodHandleDesc.ofMethod(VIRTUAL,
422-
ClassDesc.of(d.getClass().getName()),
422+
ClassDesc.of(Domain.class.getName()),
423423
"variableElement",
424424
MethodTypeDesc.of(CD_Element,
425425
CD_CharSequence)),
@@ -487,7 +487,7 @@ public static final Optional<? extends ConstantDesc> describe(final ArrayType t,
487487
yield describe(t.getComponentType(), d)
488488
.map(componentTypeDesc -> DynamicConstantDesc.of(BSM_INVOKE,
489489
MethodHandleDesc.ofMethod(VIRTUAL,
490-
ClassDesc.of(d.getClass().getName()),
490+
ClassDesc.of(Domain.class.getName()),
491491
"arrayTypeOf",
492492
MethodTypeDesc.of(CD_ArrayType,
493493
CD_TypeMirror)),
@@ -525,10 +525,11 @@ yield switch (t.getKind()) {
525525
case DECLARED -> {
526526
final List<? extends TypeMirror> typeArguments = t.getTypeArguments();
527527
final int typeArgumentCount = typeArguments.size();
528-
final ConstantDesc[] args = new ConstantDesc[3 + typeArgumentCount];
528+
final ConstantDesc[] args = new ConstantDesc[4 + typeArgumentCount];
529529
final TypeMirror enclosingType = t.getEnclosingType();
530+
// Call
530531
args[0] = MethodHandleDesc.ofMethod(VIRTUAL,
531-
ClassDesc.of(d.getClass().getName()),
532+
ClassDesc.of(Domain.class.getName()),
532533
"declaredType",
533534
MethodTypeDesc.of(CD_DeclaredType,
534535
CD_DeclaredType,
@@ -585,7 +586,7 @@ public static final Optional<? extends ConstantDesc> describe(final NoType t, fi
585586
yield t.getKind().describeConstable()
586587
.map(typeKindDesc -> DynamicConstantDesc.of(BSM_INVOKE,
587588
MethodHandleDesc.ofMethod(VIRTUAL,
588-
ClassDesc.of(d.getClass().getName()),
589+
ClassDesc.of(Domain.class.getName()),
589590
"noType",
590591
MethodTypeDesc.of(CD_NoType,
591592
CD_TypeKind)),
@@ -616,7 +617,7 @@ public static final Optional<? extends ConstantDesc> describe(final NullType t,
616617
default -> (d instanceof Constable c ? c.describeConstable() : Optional.<ConstantDesc>empty())
617618
.map(domainDesc -> DynamicConstantDesc.of(BSM_INVOKE,
618619
MethodHandleDesc.ofMethod(VIRTUAL,
619-
ClassDesc.of(d.getClass().getName()),
620+
ClassDesc.of(Domain.class.getName()),
620621
"nullType",
621622
MethodTypeDesc.of(CD_NullType)),
622623
domainDesc));
@@ -649,7 +650,7 @@ public static final Optional<? extends ConstantDesc> describe(final PrimitiveTyp
649650
yield t.getKind().describeConstable()
650651
.map(typeKindDesc -> DynamicConstantDesc.of(BSM_INVOKE,
651652
MethodHandleDesc.ofMethod(VIRTUAL,
652-
ClassDesc.of(d.getClass().getName()),
653+
ClassDesc.of(Domain.class.getName()),
653654
"primitiveType",
654655
MethodTypeDesc.of(CD_PrimitiveType,
655656
CD_TypeKind)),
@@ -691,7 +692,7 @@ public static final Optional<? extends ConstantDesc> describe(final TypeVariable
691692
final String name = d.toString(e.getSimpleName());
692693
yield Optional.of(DynamicConstantDesc.of(BSM_INVOKE,
693694
MethodHandleDesc.ofMethod(VIRTUAL,
694-
ClassDesc.of(d.getClass().getName()),
695+
ClassDesc.of(Domain.class.getName()),
695696
"typeVariable",
696697
MethodTypeDesc.of(CD_TypeVariable,
697698
CD_Parameterizable,
@@ -728,7 +729,7 @@ yield describe(t.getExtendsBound(), d)
728729
.flatMap(extendsBoundDesc -> describe(t.getSuperBound(), d)
729730
.map(superBoundDesc -> DynamicConstantDesc.of(BSM_INVOKE,
730731
MethodHandleDesc.ofMethod(VIRTUAL,
731-
ClassDesc.of(d.getClass().getName()),
732+
ClassDesc.of(Domain.class.getName()),
732733
"wildcardType",
733734
MethodTypeDesc.of(CD_WildcardType,
734735
CD_TypeMirror,

0 commit comments

Comments
 (0)