Age | Commit message (Collapse) | Author |
|
Annotated "this" arguments for instance methods and non-static nested
class constructors were added in Java 8. This special cases "this" and
"OuterClass.this" so that they are allowed as parameter names.
|
|
* Don't copy parameter annotations when creating a ParameterSpec.
This further preserves the behaviour discussed in https://github.com/square/javapoet/issues/482.
Unifying it for both MethodSpec.overriding and ParameterSpec.get.
* Add compilation test for when overriding a method with private annotations.
* Address PR comments:
* Remove unused import
* Rename newly added test
|
|
|
|
- Change to not copy parameter annotations was first introduced in
9505ad0e027a1f125b5352ac722ea141831fbf1c.
- Change to properly copy mirror annotations in ParameterSpec.get
was introduced in a0eadbbf0e7b70f0fbbc66043536e4328c3808fd,
breaking the behavior of MethodSpec.overriding.
- This change preserves the correct behavior of ParameterSpec.get
while also removing annotations in MethodSpec.overriding.
|
|
|
|
|
|
* Add alwaysQualify() API to avoid collisions with known colliding types
Implementation based on https://github.com/square/javapoet/issues/77#issuecomment-507387399
Resolves #77
CC @eamonnmcmanus
* Add utility avoidClashesWithNestedClasses methods for Class/TypeElement
* Fix style issues
* Move scope to TypeSpecs
* Check superclasses and superinterfaces
* Add superclass and superinterface overloads
* Style fixes
* Add qualified names to toBuilder test
* Add Map.Entry test + doc regression tests
|
|
* added convenience overloads for code blocks in control flow
* added javadoc and test
* added test for do while block
* fixed continuation space count
|
|
* Use regex for new line character to cover both dos and unix endings when calling emitAndIndent - fixes #552
* Update CodeWriter to use linebreak matcher instead of \r\n
|
|
* Copy originating elements in toBuilder() as well
Fixes #749
* Add test
|
|
* Add RecordingAppendable in LineWrapper for tracking last emitted char
* Check lastChar in javadoc emission to emit newline if necessary
Resolves #731
* Move trailing newline check to emit() overload for reuse
Allows using from anywhere emitting a CodeBlock
* Ensure trailing newlines in method bodies
Resolves #722
* Add dedicated trailing newline in javadoc test
* Fix modifier ordering
* Fix rebase conflict
Co-authored-by: Egor Andreevich <andreevich.egor@gmail.com>
|
|
* Make modifiers and annotations in FieldSpec public
* Make AnnotationSpec members public
* Make JavaFile staticImports public
* Make modifiers and annotations in parameterspec public
* Make methodspec modifiers, params, typevars, and annotations public
* Make typespec builder lists public
* Move TypeSpec.Builder validations to build() where appropriate
* Move AnnotationSpec.Builder validations to build() where appropriate
* Fix line length style
|
|
* Add checks to ParameterSpec with VariableElement + copy over annotations
Signed-off-by: shaishavgandhi05 <shaishgandhi@gmail.com>
* Add test for variable element
Signed-off-by: shaishavgandhi05 <shaishgandhi@gmail.com>
* Extract util methods into TestUtil
* Fix formatting
* Make findFirst more generic
Co-authored-by: Egor Andreevich <andreevich.egor@gmail.com>
|
|
Analogous to the change added in KotlinPoet
|
|
* provide an easier way for an other encoding than UTF-8
* formatting
* no final on argument and fix for javadoc
* checkstyle line length
checkstyle line length
|
|
|
|
package
|
|
In addition to being used repeatedly in CodeWriter.lookupName(), the current implementation is N^2 (albeit for a usually low N) since it recursively calls itself on the enclosing class name. This should get rid of some of the garbage created in code writing.
|
|
The single-argument overload will use the end of the String as the end index automatically.
|
|
nested simple names of a TypeSpec
For one large (100K lines) file, this saved 3.5s/build
|
|
* Allow setting method name on MethodSpec.Builder
* Fix indentation
|
|
|
|
* Add Javadoc to ParameterSpec
Signed-off-by: shaishavgandhi05 <shaishgandhi@gmail.com>
* Move emission to same CodeBlock
Signed-off-by: shaishavgandhi05 <shaishgandhi@gmail.com>
* Remove eager javadoc addition and fallback to adding doc when emitting
Signed-off-by: shaishavgandhi05 <shaishgandhi@gmail.com>
* Fix formatting
Signed-off-by: shaishavgandhi05 <shaishgandhi@gmail.com>
* Add new line before emitting parameter javadoc
Signed-off-by: shaishavgandhi05 <shaishgandhi@gmail.com>
* Emit new line before @param only if method javadoc is present
Signed-off-by: shaishavgandhi05 <shaishgandhi@gmail.com>
|
|
* Check parameter modifiers for non final modifiers
Signed-off-by: shaishavgandhi05 <shaishgandhi@gmail.com>
* Add extra line
Signed-off-by: shaishavgandhi05 <shaishgandhi@gmail.com>
* Fix formatting
Signed-off-by: shaishavgandhi05 <shaishgandhi@gmail.com>
|
|
* Use fully qualified names if a type variable masks a type name, even if it is in the same package
* Add a makeshift multiset to handle https://github.com/square/javapoet/pull/657\#discussion_r205514292
|
|
... but `java.util.List` does :)
|
|
* Fix TypeName.get() on top-level error types
Discussion: https://github.com/square/javapoet/commit/1c897e44ddd6b50e22180b6d32e4a3c69223614a#commitcomment-28905786
* Use an ElementVisitor instead of instanceof checks
* Remove unused import
|
|
There's some bug that's triggered by Buck's ABI builds and avoiding this
API avoids triggering that bug.
|
|
I found the previous code difficult to follow. Hopefully this is less so.
|
|
|
|
|
|
* Add tests for Java 8 TYPE_USE annotations on arrays (#614).
* Implement TYPE_USE annotations semantics.
* Cleanup in AnnotatedTypeTest.
* Nits from review
|
|
|
|
|
|
|
|
|
|
I was scanning through this file and this error message seemed wrong to me. If the checkState fails, the packageName _not_ be set, right?
|
|
😬😬😬 (#608)
|
|
Now we wrap automatically after the method name, if appropriate.
|
|
|
|
|
|
Closes https://github.com/square/javapoet/issues/595
|
|
* Adds `$B` as an optional newline if a line will exceed 100 chars
Closes https://github.com/square/javapoet/issues/588
* Switch from $B to $Z
|
|
Turns out this was already covered in a test but we had the wrong expected output declared.
|
|
The former has needless synchronization.
|
|
|
|
|
|
* Support anonymous inner classes in ClassName#get
ClassName#get incorrectly used Class#getSimpleName for anonymous inner classes, which is an empty string.
With this change it falls back to using Class#getName for anonymous classes and taking the compiler generated name for the class.
* fix automatic import rearrangement
* remove try-catch block from test
|
|
* Add failing tests for types conflicting with type being declared
Also removes previous (flawed) test, which should have
been in JavaFileTest anyway, and add a separate test for
the "superclass references self" case (already handled
in TypeSpecTest#interfaceExtends btw, but this makes it
clearer what is tested and expected).
And add a separate test for classes in the same package
conflicting with a superclass, for completeness.
Reproduces #470
* Fix conflicts with types with same name as type being declared
Those types (annotations, or referenced in annotation values,
in type variable bounds, superclass, or superinterfaces)
were erroneously imported rather than being emitted with their
qualified name.
Fixes #470
|
|
* Add convenience anonymousClassBuilder(CodeBlock)
Resolves #558
* Fix indent
|