Make it an error if a setter has a @Nullable parameter when the property being set is not @Nullable. We will generate code that rejects a null parameter whether or not @Nullable is present, so allowing it is just misleading users of the API.

The mirror situation, where the property is @Nullable but the setter is not, is arguably also incorrect. In that case the generated code does *not* reject a null parameter, even though we might expect it to in the absence of @Nullable on the parameter. However, changing that would surely break a lot of existing code.

Fixes https://github.com/google/auto/issues/777.

RELNOTES=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. This already generated a NullPointerException at runtime.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=289103954
3 files changed
tree: 34ad368c635a131b57efe3d9b66fb62c7ebfb280
  1. common/
  2. factory/
  3. service/
  4. util/
  5. value/
  6. .gitignore
  7. .travis.yml
  8. build-pom.xml
  9. CONTRIBUTING.md
  10. LICENSE
  11. README.md
README.md

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.