Skip to content

KON-650 Change KoGenericTypeDeclaration API#1410

Merged
igorwojda merged 44 commits intodevelopfrom
KON-650-change-kogenerictypedeclaration-api
Oct 10, 2024
Merged

KON-650 Change KoGenericTypeDeclaration API#1410
igorwojda merged 44 commits intodevelopfrom
KON-650-change-kogenerictypedeclaration-api

Conversation

@nataliapeterwas
Copy link
Contributor

@nataliapeterwas nataliapeterwas commented Oct 2, 2024

This pull request introduces several updates to the code structure around type arguments and generic type providers, along with some breaking API changes to improve clarity and consistency.

Main Changes:

  1. Added KoTypeArgumentDeclaration

    • Introduced KoTypeArgumentDeclaration to encapsulate type argument information.

    Example:

    scope
    	.functions()
    	.returnTypes
    	.genericTypeDeclarations()
    	.typeArguments
    	.assertTrue { ... }
  2. Breaking API Change: Modified KoGenericTypeProvider

    • Removed the isGenericType property from KoGenericTypeProvider.
    • Added properties and methods directly related to genericType, enhancing the provider’s specificity.

    Example:

    // Before
    scope
    	.functions()
    	.returnTypes
    	.assertTrue { it.isGenericType } // `isGenericType` property still exist but in `KoTypeProvider`
    
    // After
    scope
    	.functions()
    	.returnTypes
    	.genericTypeDeclarations()
    	.assertTrue { it.genericType.name == "List" }
  3. Removed KoGenericTypeDeclarationProvider and Added New Providers

    • Replaced KoGenericTypeDeclarationProvider with two new providers:
      • KoGenericTypeProvider – for handling generic type.
      • KoTypeArgumentProvider – for managing type arguments specifically.
  4. Deprecated declaration Property and Added sourceDeclaration

    • Deprecated the declaration property to clarify the intent of referencing the declaration site.
    • Added sourceDeclaration, which now consistently refers to the declaration site.

    Example:

    // Before
    scope
    	.functions()
    	.returnTypes
    	.declarations
    
    // After
    scope
    	.functions()
    	.returnTypes
    	.sourceDeclarations()

@jira-ticket-bot
Copy link

@nataliapeterwas nataliapeterwas added improvement nhancements to existing features or code breaking-api-change Breaks existing API labels Oct 4, 2024
…enerictypedeclaration-api

# Conflicts:
#	lib/src/konsistTest/kotlin/com/lemonappdev/konsist/api/ApiKonsistTest.kt
@nataliapeterwas nataliapeterwas marked this pull request as ready for review October 9, 2024 08:22
@igorwojda igorwojda force-pushed the KON-650-change-kogenerictypedeclaration-api branch from 12c9a9c to 6c6a19e Compare October 10, 2024 08:36
@igorwojda igorwojda force-pushed the KON-650-change-kogenerictypedeclaration-api branch from 6c6a19e to 39f2f32 Compare October 10, 2024 08:37
@igorwojda igorwojda merged commit e45b633 into develop Oct 10, 2024
@igorwojda igorwojda deleted the KON-650-change-kogenerictypedeclaration-api branch October 10, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-api-change Breaks existing API improvement nhancements to existing features or code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants