Skip to content

Commit

Permalink
Update the version of the JDK used to generate Javadocs.
Browse files Browse the repository at this point in the history
and remove the ugly workarounds for https://bugs.openjdk.org/browse/JDK-8241780.

RELNOTES=n/a
PiperOrigin-RevId: 690766069
  • Loading branch information
chaoren authored and Google Java Core Libraries committed Oct 28, 2024
1 parent 721bb14 commit 38b6fbb
Show file tree
Hide file tree
Showing 14 changed files with 223 additions and 212 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ jobs:
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-
- name: 'Set up JDK 11'
- name: 'Set up JDK 17' # need 15+ to avoid https://bugs.openjdk.org/browse/JDK-8241780
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73
with:
java-version: 11
java-version: 17
distribution: 'zulu'
- name: 'Generate latest docs'
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,16 @@ private ImmutableSetMultimap<TypeElement, Element> indexByAnnotation(
* {@code @X}, then {@code Outer}, {@code Outer.foo}, and {@code Outer.foo()} will be added to the
* multimap, but neither {@code Inner} nor its members will.
*
* <pre><code>
* {@literal @}X class Outer {
* {@literal @}X Object foo;
* {@literal @}X void foo() {}
* {@literal @}X static class Inner {
* {@literal @}X Object bar;
* {@literal @}X void bar() {}
* }
* <pre>{@code
* @X class Outer {
* @X Object foo;
* @X void foo() {}
* @X static class Inner {
* @X Object bar;
* @X void bar() {}
* }
* </code></pre>
* }
* }</pre>
*/
private static void findAnnotatedElements(
Element element,
Expand Down
11 changes: 6 additions & 5 deletions common/src/main/java/com/google/auto/common/MoreElements.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,17 @@ public static <T extends Element> Predicate<T> hasModifiers(Modifier... modifier
}

/**
* Returns a {@link Predicate} that can be used to filter elements by {@link Modifier}.
* The predicate returns {@code true} if the input {@link Element} has all of the given
* {@code modifiers}, perhaps in addition to others.
* Returns a {@link Predicate} that can be used to filter elements by {@link Modifier}. The
* predicate returns {@code true} if the input {@link Element} has all of the given {@code
* modifiers}, perhaps in addition to others.
*
* <p>Here is an example how one could get a List of methods with certain modifiers of a class:
*
* <pre>{@code
* Set<Modifier> modifiers = ...;
* FluentIterable.from(ElementFilter.methodsIn(clazzElement.getEnclosedElements()))
* .filter(MoreElements.hasModifiers(modifiers)).toList();}
* </pre>
* .filter(MoreElements.hasModifiers(modifiers)).toList();
* }</pre>
*/
public static <T extends Element> Predicate<T> hasModifiers(final Set<Modifier> modifiers) {
return new Predicate<T>() {
Expand Down
32 changes: 16 additions & 16 deletions factory/src/main/java/com/google/auto/factory/AutoFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,36 +67,36 @@
/**
* Specifies that an annotation should be used to determine how to annotate generated AutoFactory
* classes. For example, suppose you have this annotation:
* <pre>
* {@code @AutoFactory.AnnotationsToApply}
* {@code @interface} ApplyImmutableAndSuppressWarnings {
* <pre>{@code
* @AutoFactory.AnnotationsToApply
* @interface ApplyImmutableAndSuppressWarnings {
* Immutable immutable() default @Immutable;
* SuppressWarnings suppressWarnings() default @SuppressWarnings("Immutable");
* }
* </pre>
* }</pre>
*
* And suppose you use it like this:
* <pre>
* {@code @ApplyImmutableAndSuppressWarnings}
* {@code @AutoFactory}
* <pre>{@code
* @ApplyImmutableAndSuppressWarnings
* @AutoFactory
* public class Foo {...}
* </pre>
* }</pre>
*
* Then the generated {@code FooFactory} would look like this:
* <pre>
* {@code @Immutable}
* {@code @SuppressWarnings("Immutable")}
* <pre>{@code
* @Immutable
* @SuppressWarnings("Immutable")
* public class FooFactory {...}
* </pre>
* }</pre>
*
* The same would be true if you used it like this:
* <pre>
* {@code @ApplyImmutableAndSuppressWarnings}(
* <pre>{@code
* @ApplyImmutableAndSuppressWarnings(
* immutable = @Immutable,
* suppressWarnings = @SuppressWarnings("Immutable"))
* {@code @AutoFactory}
* @AutoFactory
* public class Foo {...}
* </pre>
* }</pre>
*
* You could also have {@code suppressWarnings = @SuppressWarnings({"Immutable", "unchecked"})},
* etc, to specify a value different from the default.
Expand Down
18 changes: 10 additions & 8 deletions value/src/main/java/com/google/auto/value/AutoAnnotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,24 @@
*
* <p>For example, suppose you have an annotation like this:
*
* <pre>
* <pre>{@code
* package com.google.inject.name;
*
* public &#64;interface Named {
* public @interface Named {
* String value();
* }
* }</pre>
*
* <p>You could write a method like this to construct implementations of the interface:
*
* <pre>
* <pre>{@code
* package com.example;
*
* public class Names {
* &#64;AutoAnnotation public static Named named(String value) {
* @AutoAnnotation public static Named named(String value) {
* return new AutoAnnotation_Names_named(value);
* }
* }
* }</pre>
*
* <p>Because the annotated method is called {@code Names.named}, the generated class is called
Expand Down Expand Up @@ -75,14 +77,14 @@
* {@code @AutoAnnotation} to make it easier to construct instances. In that case, {@code default}
* values from the annotation will become default values for the values in the builder. For example:
*
* <pre>
* <pre>{@code
* class Example {
* {@code @interface} MyAnnotation {
* @interface MyAnnotation {
* String name() default "foo";
* int number() default 23;
* }
*
* {@code @AutoBuilder(ofClass = MyAnnotation.class)}
* @AutoBuilder(ofClass = MyAnnotation.class)
* interface MyAnnotationBuilder {
* MyAnnotationBuilder name(String name);
* MyAnnotationBuilder number(int number);
Expand All @@ -93,7 +95,7 @@
* return new AutoBuilder_Example_MyAnnotationBuilder();
* }
* }
* </pre>
* }</pre>
*
* Here, {@code myAnnotationBuilder().build()} is the same as {@code
* myAnnotationBuilder().name("foo").number(23).build()} because those are the defaults in the
Expand Down
28 changes: 14 additions & 14 deletions value/src/main/java/com/google/auto/value/AutoBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@
*
* <p>A simple example:
*
* <pre>
*
* {@code @}AutoBuilder(ofClass = Person.class)
* abstract class PersonBuilder {
* static PersonBuilder builder() {
* return new AutoBuilder_PersonBuilder();
* }
*
* abstract PersonBuilder setName(String name);
* abstract PersonBuilder setId(int id);
* abstract Person build();
* }</pre>
* <pre>{@code
* @AutoBuilder(ofClass = Person.class)
* abstract class PersonBuilder {
* static PersonBuilder builder() {
* return new AutoBuilder_PersonBuilder();
* }
*
* abstract PersonBuilder setName(String name);
* abstract PersonBuilder setId(int id);
* abstract Person build();
* }
* }</pre>
*
* @see <a
* href="https://github.com/google/auto/blob/main/value/userguide/autobuilder.md">AutoBuilder
* User's Guide</a>
* href="https://github.com/google/auto/blob/main/value/userguide/autobuilder.md">AutoBuilder
* User's Guide</a>
*/
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
Expand Down
6 changes: 4 additions & 2 deletions value/src/main/java/com/google/auto/value/AutoOneOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
* abstract methods define a set of properties. But unlike {@code @AutoValue}, only one of those
* properties is defined in any given instance.
*
* <pre>{@code @AutoOneOf(StringOrInteger.Kind.class)
* <pre>{@code
* @AutoOneOf(StringOrInteger.Kind.class)
* public abstract class StringOrInteger {
* public enum Kind {STRING, INTEGER}
*
Expand All @@ -53,7 +54,8 @@
* return "the integer " + stringOrInteger.integer();
* }
* throw new AssertionError();
* }}</pre>
* }
* }</pre>
*
* <p>{@code @AutoOneOf} is explained in more detail in the <a
* href="https://github.com/google/auto/blob/main/value/userguide/howto.md#oneof">user guide</a>.
Expand Down
Loading

0 comments on commit 38b6fbb

Please sign in to comment.