Skip to content

Commit

Permalink
chore(deps): bump javaparser-symbol-solver-core from 3.15.1 to 3.23.0 (
Browse files Browse the repository at this point in the history
…#11712)

* chore(deps): bump javaparser-symbol-solver-core from 3.15.1 to 3.23.0

Bumps [javaparser-symbol-solver-core](https://github.com/javaparser/javaparser) from 3.15.1 to 3.23.0.
- [Release notes](https://github.com/javaparser/javaparser/releases)
- [Changelog](https://github.com/javaparser/javaparser/blob/master/changelog.md)
- [Commits](javaparser/javaparser@javaparser-parent-3.15.1...javaparser-parent-3.23.0)

---
updated-dependencies:
- dependency-name: com.github.javaparser:javaparser-symbol-solver-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Fix for getTypeDeclaration() returning Optional<>

* Fix code formatting

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Artem Godin <[email protected]>
  • Loading branch information
dependabot[bot] and fluorumlabs authored Sep 2, 2021
1 parent 144bc34 commit da12629
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion fusion-endpoint/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<spring.version>5.3.0</spring.version>
<spring.autoconfigure.version>2.2.0.RELEASE</spring.autoconfigure.version>
<javax.annotation.api.version>1.3.2</javax.annotation.api.version>
<javaparser.version>3.15.1</javaparser.version>
<javaparser.version>3.23.0</javaparser.version>
<swagger.codegen.version>3.0.2</swagger.codegen.version>
<swagger.codegen.generators.version>1.0.2</swagger.codegen.generators.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,8 @@ private List<Schema> parseReferencedTypeAsSchema(GeneratorType type) {

List<ResolvedReferenceType> directAncestors = resolvedReferenceType
.getDirectAncestors().stream()
.filter(parent -> parent.getTypeDeclaration().isClass()
.filter(parent -> parent.getTypeDeclaration()
.orElseThrow(IllegalArgumentException::new).isClass()
&& !Object.class.getName()
.equals(parent.getQualifiedName()))
.collect(Collectors.toList());
Expand Down Expand Up @@ -864,7 +865,8 @@ private List<Schema> generatedRelatedSchemas(Schema schema) {
*/
private String getFullyQualifiedName(GeneratorType type) {
ResolvedReferenceTypeDeclaration typeDeclaration = type.asResolvedType()
.asReferenceType().getTypeDeclaration();
.asReferenceType().getTypeDeclaration()
.orElseThrow(IllegalArgumentException::new);
String packageName = typeDeclaration.getPackageName();
String canonicalName = typeDeclaration.getQualifiedName();
if (GeneratorUtils.isBlank(packageName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.resolution.declarations.ResolvedEnumConstantDeclaration;
import com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration;
import com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration;
import com.github.javaparser.resolution.types.ResolvedReferenceType;
import com.github.javaparser.resolution.types.ResolvedType;

Expand Down Expand Up @@ -115,7 +116,8 @@ Schema createSingleSchemaFromResolvedType(GeneratorType type) {

if (type.isEnum()) {
List<String> entries = resolvedReferenceType.getTypeDeclaration()
.asEnum().getEnumConstants().stream()
.orElseThrow(IllegalArgumentException::new).asEnum()
.getEnumConstants().stream()
.map(ResolvedEnumConstantDeclaration::getName)
.collect(Collectors.toList());
StringSchema schema = new StringSchema();
Expand All @@ -127,7 +129,8 @@ Schema createSingleSchemaFromResolvedType(GeneratorType type) {
.name(resolvedReferenceType.getQualifiedName());
Map<String, Boolean> fieldsOptionalMap = getFieldsAndOptionalMap(type);
List<ResolvedFieldDeclaration> serializableFields = resolvedReferenceType
.getTypeDeclaration().getDeclaredFields().stream()
.getTypeDeclaration().orElseThrow(IllegalArgumentException::new)
.getDeclaredFields().stream()
.filter(resolvedFieldDeclaration -> fieldsOptionalMap
.containsKey(resolvedFieldDeclaration.getName()))
.collect(Collectors.toList());
Expand Down Expand Up @@ -167,9 +170,11 @@ private Map<String, Boolean> getFieldsAndOptionalMap(GeneratorType type) {
ResolvedReferenceType resolvedReferenceType = type.asResolvedType()
.asReferenceType();

if (!resolvedReferenceType.getTypeDeclaration().isClass()
|| resolvedReferenceType.getTypeDeclaration()
.isAnonymousClass()) {
Optional<ResolvedReferenceTypeDeclaration> typeDeclaration = resolvedReferenceType
.getTypeDeclaration();
if (!typeDeclaration
.filter(td -> td.isClass() && !td.isAnonymousClass())
.isPresent()) {
return Collections.emptyMap();
}
HashMap<String, Boolean> validFields = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ private Schema createEnumTypeSchema() {
ResolvedReferenceType resolvedReferenceType = type.asResolvedType()
.asReferenceType();
List<String> entries = resolvedReferenceType.getTypeDeclaration()
.asEnum().getEnumConstants().stream()
.orElseThrow(IllegalArgumentException::new).asEnum()
.getEnumConstants().stream()
.map(ResolvedEnumConstantDeclaration::getName)
.collect(Collectors.toList());
String qualifiedName = resolvedReferenceType.getQualifiedName();
Expand Down

0 comments on commit da12629

Please sign in to comment.