-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix Jandex Type parsing for array of primitive
- Loading branch information
Showing
2 changed files
with
55 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
core/deployment/src/test/java/io/quarkus/deployment/util/AsmUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.quarkus.deployment.util; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertArrayEquals; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Stream; | ||
|
||
import org.jboss.jandex.Type; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
class AsmUtilTest { | ||
|
||
@ParameterizedTest | ||
@MethodSource | ||
void testGetParameterTypes(String methodDescriptor, String... expected) { | ||
assertArrayEquals(expected, | ||
Stream.of(AsmUtil.getParameterTypes(methodDescriptor)).map(Type::toString).toArray(String[]::new)); | ||
} | ||
|
||
private static final Stream<Arguments> testGetParameterTypes() { | ||
List<Arguments> arguments = new ArrayList<>(); | ||
final var array1 = new StringBuilder(); | ||
final var array2 = new StringBuilder(); | ||
for (int i = 0; i < 5; i++) { | ||
for (Character c : AsmUtil.PRIMITIVE_DESCRIPTOR_TO_PRIMITIVE_CLASS_LITERAL.keySet()) { | ||
arguments.add(Arguments.of("(" + array2 + c + ")V", | ||
toArray(AsmUtil.PRIMITIVE_DESCRIPTOR_TO_PRIMITIVE_CLASS_LITERAL.get(c) + array1))); | ||
} | ||
array1.append("[]"); | ||
array2.append('['); | ||
} | ||
return arguments.stream(); | ||
} | ||
|
||
private static String[] toArray(String... values) { | ||
return values; | ||
} | ||
} |