Skip to content

Commit

Permalink
Record supporting fork
Browse files Browse the repository at this point in the history
- square#934
- square#925
- square#913
- square#840
- more support for records
- slight fixes
  • Loading branch information
cassandrus committed Feb 1, 2023
1 parent e59f44d commit 3af056c
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 109 deletions.
17 changes: 0 additions & 17 deletions .github/CONTRIBUTING.md

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/build.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .github/workflows/settings.xml

This file was deleted.

3 changes: 0 additions & 3 deletions src/main/java/com/squareup/javapoet/AnnotationSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,6 @@ Builder addMemberForValue(String memberName, Object value) {
if (value instanceof String) {
return addMember(memberName, "$S", value);
}
if (value instanceof Float) {
return addMember(memberName, "$Lf", value);
}
if (value instanceof Character) {
return addMember(memberName, "'$L'", characterLiteralWithoutSingleQuotes((char) value));
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/squareup/javapoet/CodeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* <li>{@code $L} emits a <em>literal</em> value with no escaping. Arguments for literals may be
* strings, primitives, {@linkplain TypeSpec type declarations}, {@linkplain AnnotationSpec
* annotations} and even other code blocks.
* <li>{@code $N} emits a <em>name</em>, using name collision avoidance where necessary. Arguments
* <li>{@code $N} emits a <em>name</em>. Arguments
* for names may be strings (actually any {@linkplain CharSequence character sequence}),
* {@linkplain ParameterSpec parameters}, {@linkplain FieldSpec fields}, {@linkplain
* MethodSpec methods}, and {@linkplain TypeSpec types}.
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/squareup/javapoet/CodeWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ private void emitLiteral(Object o) throws IOException {
} else if (o instanceof CodeBlock) {
CodeBlock codeBlock = (CodeBlock) o;
emit(codeBlock);
} else if (o instanceof Long) {
emitAndIndent(String.valueOf(o) + "L");
} else if (o instanceof Float) {
emitAndIndent(String.valueOf(o) + "f");
} else {
emitAndIndent(String.valueOf(o));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private ParameterizedTypeName(ParameterizedTypeName enclosingType, ClassName raw

@Override public ParameterizedTypeName annotated(List<AnnotationSpec> annotations) {
return new ParameterizedTypeName(
enclosingType, rawType, typeArguments, concatAnnotations(annotations));
enclosingType, rawType.withoutAnnotations(), typeArguments, concatAnnotations(annotations));
}

@Override
Expand Down
Loading

0 comments on commit 3af056c

Please sign in to comment.