aboutsummaryrefslogtreecommitdiff
path: root/common/src/test/java/com
AgeCommit message (Collapse)Author
2021-06-30Annotate auto-common for nullness.Éamonn McManus
RELNOTES=`com.google.auto.common` is annotated for null-safety. PiperOrigin-RevId: 382311770
2021-06-03Apply a few automated suggestions.Éamonn McManus
RELNOTES=n/a PiperOrigin-RevId: 377297134
2021-06-03Add String and TypeElement versions of auto-common APIs that currently take ↵Brad Corso
in Class. These changes continue the effort to move away from referencing classes from the user API directly in processors, which can cause issues especially with Android dependencies. Note: I decided not to do anything with isTypeOf yet because I'm not sure of a great way to support that. RELNOTES=Add String and TypeElement versions of auto-common APIs that currently take in Class. PiperOrigin-RevId: 377287397
2021-06-02Reformat all the Auto projects using google-java-format. For now, javadoc ↵Éamonn McManus
reformatting is excluded. RELNOTES=n/a PiperOrigin-RevId: 377145832
2021-05-13Fix a crash when `getLocalAndInheritedMethods` is called with a raw-type ↵Éamonn McManus
ancestor. RELNOTES=Fixed a crash when `getLocalAndInheritedMethods` is called with a raw-type ancestor. PiperOrigin-RevId: 373583104
2021-04-20`MoreTypes.isTypeOf` returns false for `ErrorType` rather than throwing.Éamonn McManus
Throwing `IllegalArgumentException` can mask the real source of a problem, or prevent code that would have handled the `ErrorType` from running. The `ErrorType` typically (maybe always) corresponds to an identifier in the source code, so it is in fact a class, just one that doesn't exist. RELNOTES=MoreTypes.isTypeOf returns false for ErrorType rather than throwing. PiperOrigin-RevId: 369464743
2020-08-27Automatic code cleanup.Google Java Core Libraries
PiperOrigin-RevId: 326930055
2020-06-18[ #HiltMigration ] Updating BasicAnnotationProcessor to support a ↵armandgray
String-based API. Context: Per discussion in [] this change adds a String-based `Step` class as a replacement for `ProcessingStep`. The new `Step` contains the same two methods (annotations() & process()) which return and accept fully-qualified annotation names. To support the potential absence of the annotation classes from the processor classpath the corresponding methods were changed to no longer depend on explicit Class types. RELNOTES=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. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=316968142
2020-03-13Apply a hack to OverridesTest so that it will work with newer versions of ecj.emcmanus
In Google's internal java8 compilation environment, problems with symbolic links mean that ecj can't find the standard system classes without this workaround. In other environments, including Google's java11, this problem doesn't arise. RELNOTES=Make OverridesTest work with Google's internal java8 compilation environment. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=300664328
2020-01-10Add MoreTypes.isConversionFromObjectUnchecked. This method tells, for a ↵emcmanus
given type, whether casting Object to that type will elicit an "unchecked" warning from the compiler. RELNOTES=Added MoreTypes.isConversionFromObjectUnchecked to test whether casting to a type will elicit an "unchecked" compiler warning. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=288896286
2019-11-13Optimize MoreTypes.nonObjectSuperclassbcorso
This CL tries to avoid using expensive method calls like Elements#getTypeElement, TypeElement#getKind(), and Types#directSupertypes. Of all of these, TypeElement#getKind() had the largest cost because it requires symbol completion. In addition, getKind() was being called on unnecessarily on all supertypes, even though only the first type can possibly be an ElementKind.CLASS. RELNOTES=N/A ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=280196697
2019-10-22Helper Methods in AnnotationValuesmahsabadian
RELNOTES=Adding helper methods for getting different types of annotation values with AnnotationValueVisitor. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=275921910
2019-09-23Suppress emitting errors about unprocessed elements when there are already ↵clayb
errors in the processing round. The extra errors don't add any information and end up hiding the real errors. I found this substantially reduced the issue highlighted in b/141176717. RELNOTES=Suppress error noise in `com.google.auto.common.BasicAnnotationProcessor` ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=270454309
2019-08-19Replace new T[dim].getClass() with class literals: T[].classawturner
Tested: TAP --sample ran all affected tests and none failed [] ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=259328073
2019-08-19Fix PeerBaseMethod to not rely on implicit ordering of Elements.getAllMethods.bcorso
This CL adds a new method, MoreElements#getAllMethods(), which returns all local and inherited methods (including static methods), but does not include any methods that have been overridden. Note: we are still relying on an explicit ordering for static methods to ensure we don't include hidden static methods from super classes. RELNOTES=Adds MoreElements#getAllMethods(), which returns all local and inherited methods (including static methods), but does not include any methods that have been overridden. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=257649768
2019-08-14Migrate off the overload of fail(...) that accepts a message.cpovirk
We're removing it from open-source Truth, since we're about to permanently commit to the remaining open-source Truth APIs, and we're not sure if assert_().fail(...) offers positive value when assertWithMessage(...).fail() is more in line with normal Truth practices. MOE_MIGRATED_REVID=254043172
2019-05-27Migrate Correspondence subclasses to instead call Correspondence.from.cpovirk
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=249869914
2019-05-05Migrate from containsAllOf to containsAtLeast.cpovirk
The two behave identically, and containsAllOf is being removed. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=245840719
2019-05-05Migrate from containsAllIn to containsAtLeastElementsIn.cpovirk
The two behave identically, and containsAllIn is being removed. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=245837617
2019-04-29Migrate from assertThat(foo).named("foo") to assertWithMessage("foo").that(foo).cpovirk
(The exact change is slightly different in some cases, like when using custom subjects or check(), but it's always a migration from named(...) to [assert]WithMessage(...).) named(...) is being removed. This CL may slightly modify the failure messages produced, but all the old information will still be present. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=245027656
2019-04-29Update copyrights to say Google LLC instead of Google Inc.emcmanus
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=244250754
2019-03-22Refactor exception-message assertions to use ↵diamondm
ThrowableSubject.hasMessageThat(). This replaces assertions of the form assertThat(e).hasMessage(...) and assertThat(e.getMessage()) with assertThat(e).hasMessageThat(). ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=239181584
2018-12-23Fix GeneratedAnnotationsTest so that it works on JDKs 8 through 11.emcmanus
RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=226067929
2018-12-03Ignore ECJ test in JDK 10 and 11 since ECJ doesn't work for us in those ↵dpb
versions of the JDK. RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=223350143
2018-11-28Replace usages of @Deprecated methods in com.google.common.io.Files with ↵glorioso
non-deprecated replacements. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=223170828
2018-11-06Enable a test for a bug that's been fixed for a whileronshapiro
RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=219712298
2018-10-29Fix bug where ProcessingStep.process(...) was called with too many elements ↵dpb
when there had been deferred elements. RELNOTES=Fix bug where `ProcessingStep.process(...)` was called with too many elements when there had been deferred elements. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=218513715
2018-07-23Add MoreElements.asTypeParameter()ronshapiro
RELNOTES=(auto.common) Add `MoreElements.asTypeParameter()` ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=205449221
2018-02-15Add a test for GeneratedAnnotationscushon
RELNOTES=N/A ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=185615476
2017-12-28Graduate SimpleAnnotationMirror and SimpleTypeAnnotationValue from Dagger's ↵ronshapiro
internal code to auto-common RELNOTES=Added `SimpleAnnotationMirror` and `SimpleTypeAnnotationValue` to easily create new `AnnotationMirror`s in code. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179840730
2017-09-07Fix Visibility.ofElement() for ModuleElements for JDK 9.ronshapiro
Without this, effectiveVisibilityOfElement() will always return at least DEFAULT, since there are no modifiers on a module. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167283498
2017-09-07Stop OverridesTest from trying to use ECJ on Java 9, until we can run it ↵emcmanus
with an ECJ that works properly there. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167210566
2017-04-27Add an API to collect @SuppressedWarnings on all enclosing elementsronshapiro
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=154221087
2017-04-20Fix a typo in MoreTypes that meant that, when comparing types, the ↵emcmanus
containing type was not being compared correctly. Closes https://github.com/google/auto/pull/476 Thanks to Dusan Bartos <doodeec@gmail.com> for pointing out the bug. His one-character change might reasonably have been expected to fix the problem, but alas things are rarely so simple. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=153296509
2016-10-12Fix a number of incompatibilities between javac and ecj in the area of ↵emcmanus
overrides, by reworking the logic of the explicit override implementation. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=135954107
2016-09-21Replace the use of Elements.overrides in ↵emcmanus
MoreElements.getLocalAndInheritedMethods with a reimplementation that should work with Eclipse. Fixes https://github.com/google/auto/issues/372. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133716523
2016-08-29Fix Java source files under third_party/java_src/auto so that they follow ↵emcmanus
the new simplified import rules. One test, AutoFactoryProcessorTest, had to be updated with modified line numbers because unused imports in bad/MixedFinals.java were deleted. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=129643318
2016-01-10Improve the logic of MoreTypes.equivalence() so that it no longer considers ↵emcmanus
that Set<Set<Object>> is the same as Set<Set<String>>. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=108368220
2015-09-11When looking for annotated elements within deferred types, don't traverse ↵dpb
nested type boundaries. We deferred the type because some annotated element within that type itself, and not within a nested type, had to be deferred; don't overtraverse when looking for those elements again. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=100847273
2015-08-04Move the findLocalAndInheritedMethods method out of AutoValueProcessor and ↵emcmanus
into MoreElements. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=98943442
2015-08-04Make the other auto projects constrained to java source level 6 or 7 (as ↵cgruber
appropriate) ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=98172107
2015-08-04Let each `BasicAnnotationProcessor.ProcessingStep` reject elements that are ↵dpb
not ready for processing, but might be in a later round. This lets us impose a partial order over annotation processors when required. For instance, if a Dagger component can't be generated until some AutoFactory class is generated, the Dagger processor could use this mechanism instead of failing arbitrarily when the processors happen to run out of order. API difference notes: This changes `ProcessingStep.process` from a void method to one that returns `Set<Element>`. For implementing classes to compile with no behavioral changes, they must simply return an empty set. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=97822074
2015-08-04Fix BasicAnnotationProcessor to deal w/ annotations on method argumentsmboyington
------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=94596593
2015-05-06Fixed BasicAnnotationProcessorTest.David Baker
Its logic to test that GeneratesCodeProcessor had run before RequiresGeneratedCodeProcessor was incorrect. Specifically: 1. Filer.getResource() does not throw for nonexisting files if the location is the output location. 2. The resource to test should have a ".java" extension. 3. The filer fails if you even try to read a resource that exists. Instead, we just keep track of whether the GeneratesCodeProcessor has run on elements and check that explicitly. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=92832468
2015-02-02Add a method to MoreTypes that does the same operation as Types.asElement, ↵gak
but can be called statically. Then, clean up all of the places that callers to MoreTypes.asTypeElement were passing through a Types instance just for that reason. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=84753119
2015-02-02Hack MoreTypes so that it handles equality of intersection types better on ↵emcmanus
JDK 7. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=84581037
2015-02-02Add MoreTypes.asMemberOf() to allow for easier construction of parameterized ↵sameb
types (supporting, for instance, generics provides methods in dagger. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=84577408
2015-01-21Add a nonObjectSuperclass method to MoreTypes that takes a DeclaredType andsameb
returns an Optional<DeclaredType>, in support of deriving superclasses with proper type parameters. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=83959294
2015-01-21Fix MoreTypes equivalence for TypeVariables so that in Map<K, V>, K & V aren'tsameb
considered equal. Also add MoreElements.isType(Element) and MoreTypes.isType(TypeMirror) as parallels to MoreElements.asType & MoreTypes.isTypeOf (to guard against exceptions from calling them). ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=83672418
2015-01-21Ensure that MoreTypes.equivalence() works in the presence of ↵emcmanus
intersection-type bounds, even though the representation of those differs between Java 7 and Java 8. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=83567846