Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KSP returns the same constructor twice for java sources #99

Closed
yigit opened this issue Oct 1, 2020 · 0 comments
Closed

KSP returns the same constructor twice for java sources #99

yigit opened this issue Oct 1, 2020 · 0 comments
Assignees
Labels
bug Something isn't working P1 major features or blocking bugs
Milestone

Comments

@yigit
Copy link
Collaborator

yigit commented Oct 1, 2020

Given an input like:

class Base {
    Base(int x){}
}

ksClassDeclaration.getDeclaredFunctions return two methods for Base

Interestingly, they are both the same instance:

image

@neetopia neetopia self-assigned this Oct 2, 2020
@neetopia neetopia added the bug Something isn't working label Oct 2, 2020
@neetopia neetopia modified the milestones: 2020Q3, 2020Q4 Oct 2, 2020
@ting-yuan ting-yuan added the P1 major features or blocking bugs label Oct 3, 2020
copybara-service bot pushed a commit to androidx/androidx that referenced this issue Oct 8, 2020
This CL implements findPrimaryConstructor in KspTypeElement.

I've also found a bug in KotlinMetadata implementation where
we would crash if it does not have a primary contructor.

I've also added tests for Java sources which required adding
a new synthetic constructor element for Java classes which
are not abstract but has no explicit constructor.
google/ksp#98

Also discovered another bug w/ KSP java interop where it could
return the same function declaration twice if it is coming from
java, added a workaround for it.

google/ksp#99

With this change, we can enable more of XProcessingEnv tests to
include KSP. I've enabled all except for the primitive types test.

Bug: 160322705
Test: KspTypeElementTest#constructors, XProcessingEnvTest
Change-Id: I2def5651fb3d7d693e7256646168d12622eb6928
@neetopia neetopia closed this as completed Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 major features or blocking bugs
Projects
None yet
Development

No branches or pull requests

3 participants