Skip to content

Commit

Permalink
Merge pull request #1456 from Ladicek/jandex-2.4.3-1.6.x
Browse files Browse the repository at this point in the history
Update to Jandex 2.4.3 and avoid deprecated methods
  • Loading branch information
phillip-kruger authored Jun 29, 2022
2 parents adff91b + b0ef5dd commit 94164da
Show file tree
Hide file tree
Showing 70 changed files with 24 additions and 4,703 deletions.
4 changes: 4 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ SmallRye GraphQL is an implementation of
mvn clean install
----

Note that some tests perform locale-sensitive assertions.
If you use non-English locale, you need to adjust the command above.
For example: `LANG=C mvn clean install`

=== Testing against the unreleased v 2.0-SNAPSHOT of MicroProfile GraphQL

(You need to build that version of MicroProfile GraphQL locally first to make the snapshot versions available in your repository)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ public static Annotations getAnnotationsForArray(org.jboss.jandex.Type typeInCol
* @return annotation for this argument
*/
public static Annotations getAnnotationsForArgument(MethodInfo methodInfo, short pos) {
if (pos >= methodInfo.parameters().size()) {
if (pos >= methodInfo.parametersCount()) {
throw new IndexOutOfBoundsException(
"Parameter at position " + pos + " not found on method " + methodInfo.name());
}

final org.jboss.jandex.Type parameterType = methodInfo.parameters().get(pos);
final org.jboss.jandex.Type parameterType = methodInfo.parameterType(pos);

Map<DotName, AnnotationInstance> annotationMap = getAnnotations(parameterType);

Expand Down Expand Up @@ -447,7 +447,7 @@ private static Annotations getAnnotationsForInputField(FieldInfo fieldInfo, Meth
annotationsForField.putAll(getTypeUseAnnotations(fieldInfo.type()));
}
if (methodInfo != null) {
List<org.jboss.jandex.Type> parameters = methodInfo.parameters();
List<org.jboss.jandex.Type> parameters = methodInfo.parameterTypes();
if (!parameters.isEmpty()) {
org.jboss.jandex.Type param = parameters.get(ZERO);
annotationsForField.putAll(getTypeUseAnnotations(param));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ public ArgumentCreator(ReferenceCreator referenceCreator) {
* @return an Argument
*/
public Optional<Argument> createArgument(Operation operation, MethodInfo methodInfo, short position) {
if (position >= methodInfo.parameters().size()) {
if (position >= methodInfo.parametersCount()) {
throw new SchemaBuilderException(
"Can not create argument for parameter [" + position + "] "
+ "on method [" + methodInfo.declaringClass().name() + "#" + methodInfo.name() + "]: "
+ "method has only " + methodInfo.parameters().size() + " parameters");
+ "method has only " + methodInfo.parametersCount() + " parameters");
}

Annotations annotationsForThisArgument = Annotations.getAnnotationsForArgument(methodInfo, position);
Expand All @@ -59,7 +59,7 @@ public Optional<Argument> createArgument(Operation operation, MethodInfo methodI
}

// Argument Type
Type argumentType = methodInfo.parameters().get(position);
Type argumentType = methodInfo.parameterType(position);

// Name
String defaultName = methodInfo.parameterName(position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ public Optional<Field> createFieldForParameter(MethodInfo method, short position
String name = getFieldName(Direction.IN, annotationsForPojo, method.parameterName(position));

// Field Type
Type fieldType = getFieldType(fieldInfo, method.parameters().get(position));
Type fieldType = getFieldType(fieldInfo, method.parameterType(position));

Reference reference = referenceCreator.createReferenceForPojoField(fieldType,
method.parameters().get(position), annotationsForPojo, Direction.IN, parentObjectReference);
method.parameterType(position), annotationsForPojo, Direction.IN, parentObjectReference);

String fieldName = fieldInfo != null ? fieldInfo.name() : null;
Field field = new Field(null, fieldName, name, reference);
addDirectivesForBeanValidationConstraints(annotationsForPojo, field, parentObjectReference);
populateField(Direction.IN, field, fieldType, method.parameters().get(position), annotationsForPojo);
populateField(Direction.IN, field, fieldType, method.parameterType(position), annotationsForPojo);

return Optional.of(field);

Expand Down Expand Up @@ -249,7 +249,7 @@ private static void validateFieldType(Direction direction, MethodInfo methodInfo

private static Type getMethodType(MethodInfo method, Direction direction) {
if (direction.equals(Direction.IN)) {
return method.parameters().get(0);
return method.parameterType(0);
}
return getReturnType(method);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Operation createOperation(MethodInfo methodInfo, OperationType operationT
}

// Arguments
List<Type> parameters = methodInfo.parameters();
List<Type> parameters = methodInfo.parameterTypes();
for (short i = 0; i < parameters.size(); i++) {
Optional<Argument> maybeArgument = argumentCreator.createArgument(operation, methodInfo, i);
maybeArgument.ifPresent(operation::addArgument);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public MethodInfo findCreator(ClassInfo classInfo) {
for (final MethodInfo constructor : classInfo.constructors()) {
if (!Modifier.isPublic(constructor.flags()))
continue;
if (constructor.parameters().isEmpty()) {
if (constructor.parameterTypes().isEmpty()) {
return constructor;
}
if (constructor.hasAnnotation(Annotations.JSONB_CREATOR)
Expand Down Expand Up @@ -143,7 +143,7 @@ private void addFields(InputType inputType, ClassInfo classInfo, Reference refer
}

//Parameters of JsonbCreator
for (short i = 0; i < creator.parameters().size(); i++) {
for (short i = 0; i < creator.parametersCount(); i++) {
String fieldName = creator.parameterName(i);
FieldInfo fieldInfo = allFields.remove(fieldName);
final Optional<Field> maybeField = fieldCreator.createFieldForParameter(creator, i, fieldInfo, reference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ private static Optional<String> getName(AnnotationInstance graphQLApiAnnotation)
*/
private static Optional<String> getDescription(AnnotationInstance graphQLApiAnnotation) {
ClassInfo apiClass = graphQLApiAnnotation.target().asClass();
if (apiClass.annotations().containsKey(Annotations.DESCRIPTION)) {
List<AnnotationInstance> descriptionAnnotations = apiClass.annotations().get(Annotations.DESCRIPTION);
if (apiClass.annotationsMap().containsKey(Annotations.DESCRIPTION)) {
List<AnnotationInstance> descriptionAnnotations = apiClass.annotationsMap().get(Annotations.DESCRIPTION);
if (descriptionAnnotations != null && !descriptionAnnotations.isEmpty()) {
AnnotationValue value = descriptionAnnotations.get(0).value();
if (value != null && value.asString() != null && !value.asString().isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static boolean isPropertyMethod(Direction direction, MethodInfo method) {
*/
private static boolean isSetter(MethodInfo method) {
return method.returnType().kind() == Type.Kind.VOID
&& method.parameters().size() == 1
&& method.parametersCount() == 1
&& isSetterName(method.name());
}

Expand All @@ -102,7 +102,7 @@ private static boolean isSetter(MethodInfo method) {
*/
private static boolean isPropertyAccessor(MethodInfo method) {
return method.returnType().kind() != Type.Kind.VOID
&& method.parameters().isEmpty()
&& method.parameterTypes().isEmpty()
&& (method.hasAnnotation(Annotations.QUERY)
|| isGetterName(method.name()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private Map<DotName, List<MethodParameterInfo>> scanAllSourceAnnotations(boolean
if (target.kind().equals(AnnotationTarget.Kind.METHOD_PARAMETER)) {
MethodParameterInfo methodParameter = target.asMethodParameter();
short position = methodParameter.position();
Type returnType = methodParameter.method().parameters().get(position);
Type returnType = methodParameter.method().parameterType(position);
if (forReturnType == null || Arrays.asList(forReturnType).contains(returnType.kind())) {
DotName name = getName(returnType);
sourceFields.computeIfAbsent(name, k -> new ArrayList<>()).add(methodParameter);
Expand Down
87 changes: 0 additions & 87 deletions docs/power-annotations.md

This file was deleted.

2 changes: 0 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ nav:
- Customizing JSON deserializers: 'custom-json-deserializers.md'
- Directives: 'directives.md'
- Custom error extensions: 'custom-error-extensions.md'
# - Power annotations: # Power annotations are unused right now
# - Power annotations: 'power-annotations.md'
- Typesafe client:
- Basic usage: 'typesafe-client-usage.md'
- Reactive: 'typesafe-client-reactive-types.md'
Expand Down
9 changes: 1 addition & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<!-- <version.eclipse.microprofile.graphql-client>1.1-SNAPSHOT</version.eclipse.microprofile.graphql-client>-->
<version.eclipse.microprofile.metrics>3.0</version.eclipse.microprofile.metrics>
<version.eclipse.microprofile.context-propagation>1.3</version.eclipse.microprofile.context-propagation>
<version.org.jboss.jandex>2.4.3.Final</version.org.jboss.jandex> <!-- won't be needed with SmallRye Parent v36 -->
<version.smallrye-config>2.10.0</version.smallrye-config>
<version.smallrye.metrics>3.0.4</version.smallrye.metrics>
<version.smallrye-common>1.11.0</version.smallrye-common>
Expand Down Expand Up @@ -81,7 +82,6 @@
<module>server</module>
<module>client</module>
<module>tools</module>
<module>power-annotations</module>
<module>docs</module>
</modules>

Expand Down Expand Up @@ -417,13 +417,6 @@
<modules>
<module>server/integration-tests-jdk16</module>
</modules>
<properties>
<!-- FIXME: hack to allow powerannotations TCK to pass on JDK 16 -->
<powerannotations.tck.argLine>--add-opens java.base/java.util=ALL-UNNAMED</powerannotations.tck.argLine>
<!-- FIXME: find out why Gradle build doesn't work on JDK 16 in GH actions,
but seems to work locally -->
<skip.gradle.build>true</skip.gradle.build>
</properties>
</profile>

<profile>
Expand Down
14 changes: 0 additions & 14 deletions power-annotations/annotations/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions power-annotations/common/pom.xml

This file was deleted.

Loading

0 comments on commit 94164da

Please sign in to comment.