A collection of source code generators for Java.

Related tags

Metaprogramming auto
Overview

Auto

Build Status

A collection of source code generators for Java.

Auto‽

Java is full of code that is mechanical, repetitive, typically untested and sometimes the source of subtle bugs. Sounds like a job for robots!

The Auto subprojects are a collection of code generators that automate those types of tasks. They create the code you would have written, but without the bugs.

Save time. Save code. Save sanity.

Subprojects

License

Copyright 2013 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • address issue#615: support incremental annotation processing

    address issue#615: support incremental annotation processing

    opened by stephanenicolas 43
  • Separate AutoValue Annotations and Processor into different dependencies.

    Separate AutoValue Annotations and Processor into different dependencies.

    It would be really helpful, especially in constrained environments like Android, to have the Annotations and the Processor separated into different dependencies. The current structure leads to unnecessarily bloated output binaries.

    Currently on Android, if the user includes AutoValue using compile 'com.google.auto.value:auto-value:1.2' then all of the processing classes and all of the shaded classes are included in the final binary. There are ways around this, but they are hacky and unclear.

    Separating the annotations from the processor would allow something like the following:

    compile 'com.google.auto.value:auto-value-annotation:1.2'
    apt `com.google.auto.value:auto-value:1.2
    

    This naming would allow existing users to update smoothly (assuming auto-value depends on auto-value-annotation)

    This would only include the minimal set of classes (annotations) required in the output binary and ensure that all other classes, including shaded classes, aren't unnecessarily included.

    Component: value 
    opened by rharter 43
  • Extensibility API for AutoValue

    Extensibility API for AutoValue

    Issues #87, #162, and #201 are examples of use cases that are a bit too specialized to put into the core of AutoValue, but which are still important when they apply. We should define an extensibility API so that users can build extensions that run at the same time as AutoValue. The general idea would be that there would be an interface, say AutoValueExtension, and that the AutoValue processor would use ServiceLoader to find implementations of this interface. So if you include on your -processorpath a jar that contains such an implementation, AutoValue will invoke it when it runs.

    A possible sketch of the interface is this:

    public interface AutoValueExtension {
      interface Context {
        ProcessingEnvironment processingEnvironment();
        String packageName();
        TypeElement autoValueClass();
        Map<String, ExecutableElement> properties();
      }
    
      boolean applicable(Context context);
    
      String generateClass(Context context, String classToExtend, String classToImplement);
    }
    

    The idea is that every extension gets its applicable method called, and those that return true get their generateClass method called. That method can return a String that is an implementation of the class called classToImplement that extends the class called classToExtend; or it can return null (for example if it has generated some related code but doesn't need to intervene in the AutoValue hierarchy). So if you have two extensions, @AutoValue class Foo might result in a hierarchy AutoValue_Foo extends $AutoValue_Foo extends $$AutoValue_Foo extends Foo, where AutoValue_Foo is generated by one of the extensions, $AutoValue_Foo is generated by the other, and $$AutoValue_Foo contains the logic generated by the AutoValue processor. This means that extensions can override the implementations of toString() etc.

    type=addition Component: value 
    opened by eamonnmcmanus 35
  • Adds read only builder properties to Extensions API

    Adds read only builder properties to Extensions API

    This is a first pass implementation of issue #421, adding read only builder properties to the Extensions API.

    The AutoValueExtension interface has been updated to overload the generateClass method to include an Optional<BuilderContext> parameter which is populated with information about the Builder, if there is one. The default implementation for this new method will call the older deprecated method if it is not overridden.

    The AutoValueExtension.Context interface has been updated with a hasBuilder method. An Extension may require a Builder and should be informed by the applicable callback. We cannot provide a valid BuilderContext to the extension before the call generateClass, because we cannot validate the builder until all extensions have specified which methods they consume.

    cla: no 
    opened by bryanstern 33
  • AutoValue: Support Optional<T> similar to @Nullable

    AutoValue: Support Optional similar to @Nullable

    I'd like to have "optional" value properties but instead of annotating my properties with @Nullable and then checking for null when using the property I'd rather use java.util.Optional<T> and/or com.google.common.base.Optional<T>.

    Here's what I'm doing today:

    import com.google.auto.value.AutoValue;
    
    import java.util.Optional;
    
    class Example {
      @AutoValue
      abstract static class Animal {
        static Builder builder() {
          return new AutoValue_Example_Animal.Builder()
              .name(Optional.empty)
              .numberOfLegs(Optional.empty());
        }
    
        abstract Optional<String> name();
        abstract Optional<Integer> numberOfLegs();
    
        @AutoValue.Builder
        abstract static class Builder {
          Builder name(String s) { return name(Optional.ofNullable(s)); }
          abstract Builder name(Optional<String> s);
          Builder name(Integer n) { return name(Optional.ofNullable(n)); }
          abstract Builder numberOfLegs(Optional<Integer> n);
          abstract Animal build();
        }
      }
    }
    

    Here's what I want to do:

    import com.google.auto.value.AutoValue;
    
    import java.util.Optional;
    
    class Example {
      @AutoValue
      abstract static class Animal {
        static Builder builder() {
          return new AutoValue_Example_Animal.Builder();
        }
    
        abstract Optional<String> name();
        abstract Optional<Integer> numberOfLegs();
    
        @AutoValue.Builder
        abstract static class Builder {
          abstract Builder name(String s);
          abstract Builder numberOfLegs(Integer n);
          abstract Animal build();
        }
      }
    }
    

    i.e. I want Optional<T> properties to default to Optional.empty()/Optional.absent() instead of null and to be able to define Builder methods (or constructors) that use T instead of Optional<T>. I'm using Optional.ofNullable(T)/Optional.fromNullable(T) instead of Optional.of(T)/Optional.of(T) so that I can still set a property to Optional.empty()/Optional.absent() by passing in null to the appropriate Builder method.

    Component: value 
    opened by mfulton26 32
  • Support incremental annotation processing

    Support incremental annotation processing

    Gradle 4.7 provides support for incremental annotation processing. https://docs.gradle.org/nightly/userguide/java_plugin.html#sec:incremental_annotation_processing

    It would be nice to see auto (at least auto-value) supporting it. The change is not that big as auto value is an isolating AP, and even simpler as it doesn't handle inheritance.

    Component: value P3 
    opened by stephanenicolas 29
  • Separate AutoValue artifacts into an annotation and a processor

    Separate AutoValue artifacts into an annotation and a processor

    Is there a good way to direct generated output to a different directory than [build_folder]/intermediates/classes.... This gets a bit messy from using it in the IDE and linking to a build output folder as a src directory.

    Status: duplicate Component: value 
    opened by cantrowitz 29
  • AutoValue: Support for extending a class.

    AutoValue: Support for extending a class.

    Suppose I have a set of base arguments that I need to share with two classes, and I define the following base class.

    abstract class BaseArgs {
      abstract Object getFoo();
      abstract Object getBar();
    
      abstract static class Builder<T extends Builder<T>>{
        abstract T setFoo(Object foo);
        abstract T setBar(Object bar);
      }
    }
    

    Now I want to add baz for class A and qux for class B.

    @AutoValue
    abstract class ArgsA extends BaseArgs {
      abstract Object getBaz();
    
      @AutoValue.Builder
      abstract static class Builder extends BaseArgs.Builder<Builder> {
        abstract Builder setBaz(Object baz);
    
        abstract build();
      }
    }
    

    And similarly for ArgsB. However this fails with: Setter methods must return ArgsA.Builder, despite the generic annotation.

    Is this something sane to do? Could it be fixed in the way the types are being compared to support the generic annotation? I could have optional parameters in BaseArgs but I would like to keep separate definitions of these arguments, and reuse any validations in the base class.

    For now my only solution is to rewrite the builder setters in each of the two "concrete" classes.

    Component: value 
    opened by dballesteros7 26
  • Extensibility

    Extensibility

    This is a first pass implementation of issue #202, providing two options for extending AutoValue through the use of compile time plugins.

    The first method, is by having your extension create an intermediate class between the abstract template class and the final AutoValue implementation of the class. The provides a good mechanism for adding functionality to an AutoValue class, while still keeping the implementation segregated.

    The second method is to alter the final AutoValue class itself. This was required to support Android Parcelable implementations, as Parcels are required to have static factory objects, and this isn't achievable via inheritance. Using this method, extensions have to option of adding imports, interfaces and code to the resulting AutoValue class implementation. You can see a working example of one such plugin here.

    You can view a test Android app that makes use of the auto-parcel extension here.

    cla: yes 
    opened by rharter 26
  • Intermittent

    Intermittent "Error reading configuration file" while processing

    We get the following error message from time to time in our CI builds: warning: An exception occurred while looking for AutoValue extensions. No extensions will function. This may be due to a corrupt jar file in the compiler's classpath. Exception: java.util.ServiceConfigurationError: com.google.auto.value.extension.AutoValueExtension: Error reading configuration file This has no discernible pattern, but of course leads to breaking builds.

    We're currently using com.google.auto.value:auto-value:1.6.3 and the latest module that failed randomly was also using com.google.auto.factory:auto-factory:1.0-beta5 (which also has beta6, but it looks like it's essentially the same version?) The JDK version is 1.8.0_162-b12 (which does not suffer from the dreaded "zip file closed" issue).

    Is there any way to include more stack trace in the failure? Or is there any other clue to what's going on?

    opened by davidburstromspotify 25
  • Moves method verification after extensions have had the chance to consume properties.

    Moves method verification after extensions have had the chance to consume properties.

    Since compile-testing doesn't support checking warnings, I've simply tested for the inverse here, ensuring that invalid properties fail with the appropriate error. This move should also remove the warning for "abstract methods other than property getters and builder converters" for consumed methods.

    cla: yes 
    opened by rharter 25
  • BasicAnnotationProcessor:: Changing deferral policy

    BasicAnnotationProcessor:: Changing deferral policy

    Following the discussion at https://github.com/google/auto/discussions/1340, I believe changing the defer policy to individual rejected elements as opposed to their enclosing TypeElement (if not PackageElement) is a sound and beneficial choice for the following reasons.

    For my convenience whenever I refer to an element, please assume that I am talking about a non-package element.

    Before I explain I want to note that in my solution superficial validation for each element is still done starting from its enclosing TypeElement; therefore, the deferral policy when it comes to well-informedness has not changed. Deferral policy is changed only for those elements that are rejected by a processor which are guaranteed to be well-informed.

    Is it backward compatible?

    I believe it should be. Unless someone uses some hacks to overcome similar (rare) difficulties like that of the discussion.

    Why is it a sound choice?

    1. The main problem in our discussion was that according to process() in Processor Javadoc (and only here) the input is TypeElements originating from the prior round and not any Elements. (Oddly enough, as it is verified in the discussion in practicality this is not the behavior of the checked Java compilers, more on this later.) I believe this is still the case especially if the current behavior of BasicAnnotationProcessor is acceptable.

      Presently, the aforementioned process() is overridden, and within it another process() method Is called. To distinguish between them let's call the latter process2(). The input of process2() is not restricted to TypeElements and in fact it gets any Element in general. With the current policy. the step deferred elements are only considered again in process2() and have nothing to do with process(). The only exception is when in process() the missing elements are to be reported, where now only enclosing types are reported but with my solution, the exact problematic elements are reported. I can only report the violating TypeElements as well if required. For this reason, I believe the solution does not violate the aforementioned Javadoc.

    2. As hinted before, the checked processing tools (like OpenJDK) do not adhere to only sending the TypeElements and in that case, the new solution is the more appropriate behavior to have.

    Why beneficial?

    As discussed in the discussion because of the current behavior of common processing tools (like OpenJDK) if the annotation target something other than Types, it may happen that some elements correctly get processed and just because one other element within the same enclosing TypeElement gets rejected, all of these elements will be sent to be processed again. This is not optimized and also causes some headaches for the users (including me :)) of Google's BasicAnnotationProcessor to handle multiple processing scenarios.

    Asking for some favors :)

    1. I would greatly appreciate it if you check the Javadoc of ElementName and let me know if I am correct and give me your opinion. I think the main purpose of ElementName instead of Element is the information presented here.
    2. For the unit test I could not figure out the API to say more than 1 file is created with the processor. I would appreciate your help in this regard as well.

    Edits:

    Now the retrieval of overloaded executable elements is done correctly. For now to gain access to erasedParameterTypes() I have added an instance of ExplicitOverrides in ExecutableElementName. While this is not bad it is subjective and for me is less than ideal, if this proposal gets accepted please let me know your opinion about a slight change in structure so that this method is more generally accessible.

    I would still greatly appreciate your comments about the questions that I have asked before.

    Thank you!

    Component: common P3 
    opened by AriaAdibi 2
  • Migrate from legacy com.google.gwt to org.gwtproject.

    Migrate from legacy com.google.gwt to org.gwtproject.

    Migrate from legacy com.google.gwt to org.gwtproject.

    org.gwtproject starts being available at the 2.10.0 release, so upgrade to that where necessary.

    See https://github.com/google/auto/pull/1342#issuecomment-1165230080

    RELNOTES=n/a

    opened by copybara-service[bot] 0
  • Bump gwt from 2.9.0 to 2.10.0 in /value

    Bump gwt from 2.9.0 to 2.10.0 in /value

    Bumps gwt from 2.9.0 to 2.10.0.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Component: value type=other P2 dependencies java 
    opened by dependabot[bot] 0
  • Nullable field nondeterministically has null check inserted anyhow

    Nullable field nondeterministically has null check inserted anyhow

    Summary of issue: A field that is nullable is nondeterministically having a null check in the generated code, depending on what other build tasks occurred.

    See https://lists.apache.org/thread/cdw4y50r3hl37z8y7x470m2mddclkqgv (from here you can gather more info from the thread)

    Inline, paraphrasing the thread...

    To reproduce:

    git clone https://github.com/apache/beam
    cd beam
    git checkout 4ffeae4d2b800f2df36d2ea2eab549f2204d5691~1
    ./gradlew :runners:direct-java:compileJava
    less
    ./runners/direct-java/build/generated/sources/annotationProcessor/java/main/org/apache/beam/runners/direct/AutoValue_ImmutableListBundleFactory_CommittedImmutableListBundle.java
    
    git checkout 4ffeae4d2b800f2df36d2ea2eab549f2204d5691
    ./gradlew :runners:direct-java:compileJava
    less
    ./runners/direct-java/build/generated/sources/annotationProcessor/java/main/org/apache/beam/runners/direct/AutoValue_ImmutableListBundleFactory_CommittedImmutableListBundle.java
    
    ./gradlew :runners:direct-java:compileJava --rerun-tasks
    less
    ./runners/direct-java/build/generated/sources/annotationProcessor/java/main/org/apache/beam/runners/direct/AutoValue_ImmutableListBundleFactory_CommittedImmutableListBundle.java
    

    The class at https://github.com/apache/beam/blob/1dff59b4ff26310f88f927edfcf44709ed6ea9c2/runners/direct-java/src/main/java/org/apache/beam/runners/direct/ImmutableListBundleFactory.java#L130

    abstract static class CommittedImmutableListBundle<T> implements CommittedBundle<T> {
        public static <T> CommittedImmutableListBundle<T> create(
            @Nullable PCollection<T> pcollection,
            StructuralKey<?> key,
            Iterable<WindowedValue<T>> committedElements,
            Instant minElementTimestamp,
            Instant synchronizedCompletionTime) {
          return new AutoValue_ImmutableListBundleFactory_CommittedImmutableListBundle<>(
              pcollection, key, committedElements, minElementTimestamp, synchronizedCompletionTime);
        }
      ...
    }
    

    extends https://github.com/apache/beam/blob/1dff59b4ff26310f88f927edfcf44709ed6ea9c2/runners/direct-java/src/main/java/org/apache/beam/runners/direct/CommittedBundle.java#L35

    interface CommittedBundle<T> extends Bundle<T, PCollection<T>> {
      /** Returns the PCollection that the elements of this bundle belong to. */
      @Override
      @Nullable
      PCollection<T> getPCollection();
    
      ...
    }
    

    In all cases the PCollection field should be nullable.

    In a "good" build, the AutoValue generated code constructor does not check for null

    AutoValue_ImmutableListBundleFactory_CommittedImmutableListBundle(
        @Nullable PCollection<T> PCollection,
        StructuralKey<?> key,
        Iterable<WindowedValue<T>> elements,
        Instant minimumTimestamp,
        Instant synchronizedProcessingOutputWatermark) {
      this.PCollection = PCollection;
    

    in a 'bad' build, the autovalue java is re-generated, but has an added nullness check:

    AutoValue_ImmutableListBundleFactory_CommittedImmutableListBundle(
        PCollection<T> PCollection,
        StructuralKey<?> key,
        Iterable<WindowedValue<T>> elements,
        Instant minimumTimestamp,
        Instant synchronizedProcessingOutputWatermark) {
      if (PCollection == null) {
        throw new NullPointerException("Null PCollection");
      }
      this.PCollection = PCollection;
    

    and then with --rerun-tasks it gets re-re-generated without the nullness check.

    type=defect Component: value P3 
    opened by kennknowles 3
  • Generic-typed fields include erroneous non-null check

    Generic-typed fields include erroneous non-null check

    Discovered during apache/beam#16721 here is a summary example:

    @AutoValue
    public abstract class ValueInSingleWindow<T> {
      T getValue();
      ... other fields ...
    }
    

    It is valid to create ValueInSingleWindow<@Nullable String> in the usual way via ValueInSingleWindow.<@Nullable String>of(null, ...).

    However, autovalue creates a check that the value is non-null, rejecting type-safe code.

    Component: value P3 type=enhancement 
    opened by kennknowles 6
  • generate @CheckReturnValue annotations

    generate @CheckReturnValue annotations

    It would be useful to have the @CheckReturnValue annotation automatically be added to the AutoValue generated getters and builder methods. Calling these without using their return value (i.e. writing them as statement) is probably always an error (e.g. configuring a builder, but never actually building the final object). The CheckReturnValue annotation is validated at least by errorprone and spotbugs. To my knowledge both tools care only about the simple class name, therefore the annotation could be cloned into the AutoValue annotations namespace, to not create a dependency to any of those tools.

    Currently the developer can add the annotation to the AutoValue fields and they will be copied (so there is a workaround for the getters). However, it seems impossible to have the annotation at the generated builder methods. With our without using @AutoValue.CopyAnnotations they are missing from the generated code.

    Component: value P4 
    opened by Bananeweizen 1
Releases(auto-value-1.10.1)
  • auto-value-1.10.1(Nov 17, 2022)

    • Two annotations from org.jetbrains.annotations were accidentally included unshaded in the AutoValue jar. That has been fixed. (6de325b0c)
    • Fixed an issue when a builder has a property foo with both a getter foo() and a builder fooBuilder(). (3659a0e64)
    Source code(tar.gz)
    Source code(zip)
  • auto-value-1.10(Oct 6, 2022)

    • AutoBuilder is now stable and supported. (2e44a5327)
      • AutoBuilder now allows you to omit a Kotlin default parameter when building a Kotlin class. (d2f91bf32)
      • An @AutoBuilder class can now have @AutoValue.CopyAnnotations so annotations are copied from the class to its generated subclass. (3a15c8834)
      • The generated AutoBuilder class now has a "copy constructor" if values for the builder properties can be obtained from the built type. (b3b53a344)
      • AutoBuilder can now be used to build annotation implementations directly. (196c8100d)
    • Fixed an issue when Serializable and Memoized extensions are used together. (e01968d16)
    • @AutoAnnotation now has CLASS rather than SOURCE retention, making for better operation with Gradle incremental compilation. (34c3be569)
    • @AutoAnnotation methods no longer need to be static. This makes it easier to use AutoAnnotation with Kotlin. (cf55dc644)
    • AutoValue and AutoBuilder builders now use bitmasks to track unset primitive properties, which will typically lead to smaller builder objects and faster build times. (b5d398977)
    Source code(tar.gz)
    Source code(zip)
  • auto-value-1.9(Dec 15, 2021)

    • The @AutoBuilder annotation documented here is now fully stable and supported. (1f8d7f26)
      • AutoBuilder now uses annotation defaults when building a call to an @AutoAnnotation method. (fb96c836)
    • Making a step-builder for AutoValue is now easier because the inherited setters don't need to be restated in the Builder class so that they return Builder. (0820e2e2)
    • We now handle better the case where an annotation being copied references a missing class. (e0740327)
    • The order of annotations copied into generated code is now deterministic. (8ad800ed)
    Source code(tar.gz)
    Source code(zip)
  • auto-common-1.2.1(Nov 16, 2021)

  • auto-service-1.0.1(Nov 3, 2021)

    • AutoService no longer throws an exception for a missing service class. (d8083fde)
    • Fixed a bug in AutoServiceProcessor that could lead to some services not being processed. (d4c865be)
    Source code(tar.gz)
    Source code(zip)
  • auto-common-1.2(Oct 15, 2021)

    • In MoreElements.overrides and .getLocalAndInheritedMethods, an interface method is no longer considered to override another interface method unless the first interface inherits from the second. This means that .getLocalAndInheritedMethods may now return two methods with the same signature where before it only returned one. (d8c19343)
    Source code(tar.gz)
    Source code(zip)
  • auto-common-1.1.2(Jul 25, 2021)

    • Add AnnotationMirrors.toString and AnnotationValues.toString (00cb81ed)

    (The AutoCommon 1.1.1 release was incorrect and should not be used.)

    Source code(tar.gz)
    Source code(zip)
  • auto-value-1.8.2(Jul 16, 2021)

    • Fixed a bug with AutoBuilder and property builder methods. (05ea1356)
    • Generated builder code is now slightly friendly to null-analysis. (f00c32a5)
    • Fixed a problem where @SerializableAutoValue could generate incorrect code for complex types. (689c8d49)
    • Implicitly exclude Kotlin @Metadata annotations from @CopyAnnotations (7d3aa66e)
    Source code(tar.gz)
    Source code(zip)
  • auto-common-1.1(Jul 1, 2021)

    • com.google.auto.common is annotated for null-safety. (9d79ce1e)
    • Add String and TypeElement versions of auto-common APIs that currently take in Class. (dec3bf0e)
    Source code(tar.gz)
    Source code(zip)
  • auto-common-1.0.1(Jun 1, 2021)

    • Added some methods to allow annotation processors to use Streams functionality that is present in mainline Guava but not Android Guava. This can be useful if Android Guava might be on the processor path.
    Source code(tar.gz)
    Source code(zip)
  • auto-value-1.8.1(Apr 21, 2021)

  • auto-factory-1.0.1(Apr 21, 2021)

  • auto-value-1.8(Apr 6, 2021)

    • The parameter of equals(Object) is annotated with @Nullable if any method signature mentions @Nullable. (4d01ce62)
    • If an @AutoOneOf class has a serialVersionUID this is now copied to its generated subclasses. THIS BREAKS SERIAL COMPATIBILITY for @AutoOneOf classes with explicit serialVersionUID declarations, though those were already liable to be broken by arbitrary changes to the generated AutoOneOf code. (71d81210)
    Source code(tar.gz)
    Source code(zip)
  • auto-service-1.0(Apr 6, 2021)

    • @AutoService classes can now reference generic services and still pass -Averify=true. (afe607c3)
    • AutoServiceProcessor no longer claims the @AutoService annotation. (c27b527a)
    Source code(tar.gz)
    Source code(zip)
  • auto-common-1.0(Apr 6, 2021)

  • auto-value-1.7.5(Mar 22, 2021)

    • Added @ToPrettyString for generating pretty String versions for AutoValue types. (9e9be9fa)
    • AutoValue property builders can now have a single parameter which is passed to the constructor of the new builder. (f19117aa)
    • AutoValue now copies annotations from type parameters of an @AutoValue class to the subclass generated by the @Memoized extension. (77de95c3)
    • Avoid surprising behaviour when getters are prefixed and setters are not, and a property name begins with two capital letters. (1bfc3b53)
    • The methods returned by BuilderContext.buildMethod() and .toBuilderMethods() can be inherited. (f2cb2247)
    • Fixed a bug which could lead to the same AutoValue extension being run more than once. (f40317ae)
    • AutoAnnotationProcessor and AutoServiceProcessor no longer claim their annotations. (c27b527a)
    • @AutoAnnotation instances are now serializable. (7eb2d47a)
    • Fully qualify @Override to avoid name conflicts (85af4437)
    • AutoValue error messages now have short [tags] so they can be correlated by tools. (c6e35e68)
    Source code(tar.gz)
    Source code(zip)
  • auto-factory-1.0-beta9(Mar 16, 2021)

    • AutoFactory type annotations are now placed correctly even for nested types. (f26d2df)
    • @AutoFactory constructors can now declare checked exceptions. The same exceptions will be declared on the generated create method. (3141e79)
    • google-java-format is no longer referenced in pom.xml. (aa47801)
    Source code(tar.gz)
    Source code(zip)
  • auto-common-0.11(Aug 16, 2020)

    • Add javadoc for SuperficialValidation methods. (5384b30)
    • Open SuperficialValidation#validateType(TypeMirror) to public visibility (6c39b13)
    • Adding String-based Step as a replacement for ProcessingStep to BasicAnnotationProcessor. Allows for fully-qualified Annotation names to be specified in a processing Step in order to remove the requirement that implementation processors depend directly on their Annotation classes. (df5641b)
    • Added MoreTypes.isConversionFromObjectUnchecked to test whether casting to a type will elicit an "unchecked" compiler warning. (13a0b24)
    • Adding helper methods for getting different types of annotation values with AnnotationValueVisitor. (6c2c1a3)
    • Suppress error noise in com.google.auto.common.BasicAnnotationProcessor (3966280)
    • Adds MoreElements#getAllMethods(), which returns all local and inherited methods (including static methods), but does not include any methods that have been overridden. (93fb9c5)
    • Suppress TypeEquals check (e1beeff)
    • Added MoreTypes.asIntersection() (c16ef66)
    • Fix bug where ProcessingStep.process(...) was called with too many elements when there had been deferred elements. (46718eb)
    • Add MoreElements.asTypeParameter() (19474fc)
    • Add an overrides() method to MoreElements that is more consistent between javac and ECJ. (b1ba2e3)
    • Document MoreTypes.equivalence(). (df5eb3a)
    Source code(tar.gz)
    Source code(zip)
  • auto-value-1.7.4(Jul 8, 2020)

    • Stop the LazyInit annotation from getting shaded by Maven, so that AutoValue can find it on the classpath. (b484417)
    • Fixed handling of @Nullable Optional<T> foo() properties being set by setFoo(@Nullable T) setters. Now setFoo(null) results in Optional.empty(), not null. (d9d66ad)
    Source code(tar.gz)
    Source code(zip)
  • auto-factory-1.0-beta8(Jun 30, 2020)

  • auto-value-1.7.3(Jun 10, 2020)

    • Optionally copy annotations from the @AutoValue.Builder class to the generated subclass. (b22f969)
    • Drop unnecessary parentheses in AutoAnnotation equals and hashCode methods. (b9ba06a)
    • Fixed a problem when an @AutoValue class references types that are generated by other annotation processors. (2797d38)
    Source code(tar.gz)
    Source code(zip)
  • auto-value-1.7.2(May 13, 2020)

  • auto-service-1.0-rc7(May 13, 2020)

  • auto-value-1.7.1(May 1, 2020)

    New features

    • SerializableAutoValue extension. This can be used to serialize @AutoValue classes with properties of type java.util.Optional, even though java.util.Optional is not serializable, and it can also be configured to serialize other arbitrary types. Thanks to @alvinlao for this contribution! (f91d2fe)
    • The logic for determining if we can make a BarBuilder out of a Bar has been generalized. For example, if your @AutoValue class Foo has a property IntList ints(), then your builder can have IntListBuilder intsBuilder(). Previously this worked if there was no Foo.toBuilder() method, or if IntList had its own toBuilder() method. Now it also works if it is possible to call IntListBuilder.addAll(IntList). (6aeb44f)
    • AutoValue now allows boxed properties to be set from the corresponding primitive type, for example Integer from int. (2bbe506)

    Behaviour changes

    • AutoValue now gives a warning if the static builder() method is inside the @AutoValue.Builder class instead of directly in the @AutoValue class. (fcccded)
    • AutoValue doesn't generate code or invoke extensions if it detects a problem, for example a mismatch between getters and setters. (ecb6032)
    • AutoOneOf factory methods for void values now have type parameters if the @AutoOneOf class does. (4ab1b53)
    • It is now a compilation error if a setter method in a builder has a parameter marked @Nullable when the corresponding property is not in fact @Nullable. Calling such a method with a null parameter already generated a NullPointerException at runtime. (bd7bed2)
    • The @Memoized annotation now has class-level retention, rather than source-level. (107694b)

    Bug fixes

    • We fixed an issue with type checking of setter parameters in the presence of inheritance and generics. (e97d1f0)
    • We now generate a better toString() for arrays in AutoOneOf (0a7c049)

    Miscellaneous

    • We added CompileWithEclipseTest, which checks that AutoValue works with ecj, the Eclipse compiler. (05e983c)
    Source code(tar.gz)
    Source code(zip)
  • auto-value-1.7(Oct 10, 2019)

    This is the same as 1.7rc1, with one small addition:

    • Add a way for extensions to retrieve the name of the final AutoValue_Foo class. (4543619)

    Thanks to @bryanstern for checking that the API changes for builder introspection do indeed work in a real extension.

    Source code(tar.gz)
    Source code(zip)
  • auto-value-1.7rc1(Oct 1, 2019)

    • Add an API to allow AutoValue extensions to find out about builders. (86f4563)
    • The generated AutoValue builder class is no longer final if there are extensions generating code. This means that extensions can subclass Builder to modify or extend its functionality. (49fbf55)
    • Property builders now work correctly when their actual return type is different from the corresponding property type because of type variable substitution. (7646889)
    • Allow @AutoValue getters to define properties that are not valid Java identifiers, for example get1st(). (6dfa04e)
    • Add a propertyTypes() method to AutoValueExtension.Context, to allow extensions to see the true type of every property. In preference to properties().get(p).getReturnType(), extensions should use propertyTypes().get(p). (99ae134)
    Source code(tar.gz)
    Source code(zip)
  • auto-factory-1.0-beta7(Sep 24, 2019)

    • Prevent stack overflow caused by self referencing types (ex: E extends Enum). (c35f5c3)
    • Add support for generics to @AutoFactory (e63019a)
    • Gradle: @AutoFactory is now an isolating annotation processor (2a52c55)
    Source code(tar.gz)
    Source code(zip)
  • auto-value-1.6.6(Aug 19, 2019)

    • Allow @AutoOneOf properties to be void. An abstract void method means that the associated kind has no value. The factory method has no parameter and calling the implementation of the void method does nothing unless the instance is of another kind. (48d6557)
    • Shade org.checkerframework in the auto-value jar. (f89da91)
    • Primitive arrays now work in @AutoOneOf classes. (81134b5)
    • In AutoValue code, include type annotations in bounds of type-parameter declarations. (ca013a2)
    • Handle inner classes correctly when the outer class has a type parameter. (4259261)
    • Use the short form of annotations in generated code. For example, instead of @SuppressWarnings(value = {"mutable"}), write @SuppressWarnings("mutable"). (b2eb535)
    • Use ImmutableSortedSet.copyOfSorted and .naturalOrder where appropriate. (a0de99b)
    • Work around an Eclipse compiler bug where static interface methods are incorrectly shown as being inherited. (3854a65)
    • Handle GWT serialization when some of the properties use property builders. (445b9ed)
    Source code(tar.gz)
    Source code(zip)
  • auto-service-1.0-rc6(Jul 16, 2019)

  • auto-value-1.6.5(Apr 10, 2019)

Owner
Google
Google ❤️ Open Source
Google
A Java API for generating .java source files.

JavaPoet JavaPoet is a Java API for generating .java source files. Source file generation can be useful when doing things such as annotation processin

Square 10k Jan 5, 2023
This open source project allows you to easily integrate Camunda's External Task Clients into Micronaut projects: simply add a dependency in your Micronaut project

micronaut-camunda-external-client This open source project allows you to easily integrate Camunda 's External Task Clients into Micronaut projects. Mi

Novatec Consulting GmbH 19 Dec 18, 2022
Projeto final Luiza Code.

Luiza Code 2a Edição Desafio Final - Wishlist ?? Objetivo O desafio final consiste em desenvolver API REST resolvendo a funcionalidade de wishlist par

Jokebede Coimbra 5 Dec 19, 2021
Java 1-15 Parser and Abstract Syntax Tree for Java, including preview features to Java 13

JavaParser This project contains a set of libraries implementing a Java 1.0 - Java 14 Parser with advanced analysis functionalities. This includes pre

JavaParser 4.5k Jan 9, 2023
Java 8 annotation processor and framework for deriving algebraic data types constructors, pattern-matching, folds, optics and typeclasses.

Derive4J: Java 8 annotation processor for deriving algebraic data types constructors, pattern matching and more! tl;dr Show me how to write, say, the

null 543 Nov 23, 2022
Catch common Java mistakes as compile-time errors

Error Prone Error Prone is a static analysis tool for Java that catches common programming mistakes at compile-time. public class ShortSet { public

Google 6.3k Dec 31, 2022
Write parsers for arbitrary text inputs, entirely in Java, with no preprocessing phase

Read me first The license of this project is Apache 2.0. Requires Java 7 or later. The latest versions are: development: 2.1.0-beta.3; requires Java 8

Francis Galiegue 62 Oct 13, 2022
Build parsers in Java

jparsec Builds mini parsers in pure Java. Latest version: 3.0 (requires Java 8+) News 2016-12-05 Removed references to Codehaus in copyright and packa

null 324 Dec 31, 2022
Elegant parsing in Java and Scala - lightweight, easy-to-use, powerful.

Please see https://repo1.maven.org/maven2/org/parboiled/ for download access to the artifacts https://github.com/sirthias/parboiled/wiki for all docum

Mathias 1.2k Dec 21, 2022
Compiler of Java bytecode to JavaScript

TeaVM See documentation at the project web site. Useful links: Getting started Gallery Flavour source code repository Site source code repository Disc

Alexey Andreev 2.1k Jan 3, 2023
Kodlama.io'da verilen ödev gereği Engin Demiroğ'un düzenlediği C# ile birlikte gerçek hayatta interface ve abstract konulu yayının Java uyarlaması yapılmıştır.

GercekHayattaInterfaceVeAbstract Kodlama.io'da verilen ödev gereği Engin Demiroğ'un düzenlediği C# ile birlikte gerçek hayatta interface ve abstract k

Baran Emre Türkmen 7 May 11, 2021
Chamomile is a Java Virtual Machine class file assembler and disassembler.

Chamomile is a Java Virtual Machine class file assembler and disassembler. Installation Maven <repositories> <repository> <id>jitpack.io</

null 15 May 24, 2022
A collection of source code generators for Java.

Auto A collection of source code generators for Java. Auto‽ Java is full of code that is mechanical, repetitive, typically untested and sometimes the

Google 10k Jan 9, 2023
A factory and generators framework for Java 7 and up.

Factorium-J7 A simple generator and factory framework. Compatibility Compatibility is guaranteed for Java 7 and up. How to use it The core interfaces

Samuel Beausoleil 0 Jul 20, 2022
A collection of JUnit rules for testing code which uses java.lang.System.

System Rules System Rules is a collection of JUnit rules for testing code which uses java.lang.System. System Lambda is an alternative to System Rules

Stefan Birkner 536 Dec 22, 2022
Twitter's collection of LZO and Protocol Buffer-related Hadoop, Pig, Hive, and HBase code.

Elephant Bird About Elephant Bird is Twitter's open source library of LZO, Thrift, and/or Protocol Buffer-related Hadoop InputFormats, OutputFormats,

Twitter 1.1k Jan 5, 2023
Inria 1.4k Dec 29, 2022
Source code of APK-Explorer-Editor (AEE), an open-source tool to explore the contents of an installed APK!

APK Explorer & Editor (AEE) APK Explorer & Editor, an open-source tool to explore the contents of an installed APK, is strictly made with an aim to in

APK Explorer & Editor 271 Jan 8, 2023
mobsfscan is a static analysis tool that can find insecure code patterns in your Android and iOS source code.

mobsfscan is a static analysis tool that can find insecure code patterns in your Android and iOS source code. Supports Java, Kotlin, Swift, and Objective C Code. mobsfscan uses MobSF static analysis rules and is powered by semgrep and libsast pattern matcher.

Mobile Security Framework 347 Dec 29, 2022
A simple fast search engine written in java with the help of the Collection API which takes in multiple queries and outputs results accordingly.

A simple fast search engine written in java with the help of the Collection API which takes in multiple queries and outputs results accordingly.

Adnan Hossain 6 Oct 24, 2022