forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a bug where an @Inject method has a parameter name that is valid …
…on the JVM but invalid for the Java language. This can happen with the following code in Kotlin: class Test { @set:Inject internal var foo: String? = null } RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=251647410
- Loading branch information
1 parent
c4775c1
commit a11605c
Showing
1 changed file
with
28 additions
and
4 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
How about using JavaPoet's
NameAllocator.toJavaIdentifier()
instead of rolling your own? It does basically the same as you're doing here, except using code points rather than characters (and it does notprotectAgainstKeywords
;NameAllocator.newName
will do that separately, simply appending a_
to the result oftoJavaIdentifier
: https://github.com/square/javapoet/blob/e9460b84fc41464c2aa2ef85c84dd1ac87ae1692/src/main/java/com/squareup/javapoet/NameAllocator.java#L112-L116)