Making a no-op change to the settings and then saving causes the
preferences file to be updated with defaults from the newer version.
Change-Id: I5c321ce1196af9a328d6f97c69c23686e57cd464
We already have the warning "Incomplete 'switch' cases on enum" enabled,
but it does not warn when a case is missing if the switch has a default
block.
Enable the "Signal even if 'default' case exists" option. This would
have enabled us to catch the problem that was fixed in Ied8ff0f8f.
In most instances of the warning we can simply add the missing case(s)
above the 'default', meaning there is no change in behaviour.
However there are some instances where the missing case is a bug and
should be handled correctly. These are fixed separately in follow-up
commits.
Change-Id: I3675d29981423043266a26b1a78932c5708a6272
Fix warnings about unmatched {} in inline tags.
Enabling any more than this set of warnings introduces hundreds of
warnings about things like missing @throws tags, which we may want to
fix, but is a lot more work.
Change-Id: Ic671fb600d2e1ba49b7e855158811c6c98b6cda1
Eclipse installations disagree about where to put unmatched top-level
packages. Settle this ambiguity by listing all top-level packages used
by Gerrit. Also explicitly include unmatched static imports.
The import order thus listed corresponds to the Google Java Style
Guide:
https://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s3.3.3-import-ordering-and-spacing
Organize all imports to reflect the new reality.
Change-Id: I7c541b1c522e66869669d2291dcf78ff1d8784d0
New settings introduced with upgrade to version 3.0.1.20150306-5afe4d1
of the FindBugs plugin for Eclipse.
Change-Id: I42e9dd32e4e8a74c5bb994166fc0f5357ea04dd2
Enable the "'switch' case fall-through" warning in Eclipse to catch
unintentional fall-through to the following 'case' block when a 'break'
statement is omitted.
All warnings raised in the current codebase are caused by intentional
fall-throughs, so add "//$FALL-THROUGH$" comments to suppress those
warnings.
This change was inspired by the coverity report [1] which found the
problem in PutConfig (see CID 19880) but interestingly did not report
anything for the other ones.
RFC because I'm not sure if the "//$FALL-THROUGH$" comments will cause
the warnings to be suppressed on subsequent coverity scans.
[1] https://scan.coverity.com/projects/4032
Change-Id: Iad003bd7d086c67cccdbfb1312c8bd82d17fcc57
AutoValue[1] is a lightweight annotation-processor-based library for
implementing classes with simple, obvious value semantics.
Add support for AutoValue to build rules and Eclipse project
generation. Buck does not currently have an officially-supported
interface for specifying annotation processor dependencies[2], so we
have to take the slightly ugly approach of monkey-patching
java_library and java_test to add annotation processor arguments to
each rule that requires annotation processing; hopefully this ugliness
can be reduced in the future.
[1] https://github.com/google/auto/tree/master/value
[2] https://github.com/facebook/buck/issues/85
Change-Id: I8b49d6f9f25d61688b667d964848c6ce106ae4ec
Enable and fix warnings:
- Missing `hashCode` method on classes that define `equals`
- Redundant null check
Also enable "possible accidental boolean assignment" warning. There
are currently no instances of this but it might be useful to enable.
Change-Id: I7659ae66bedb6a17e088c90d2165282b7fe33695
Since Java 7 it is possible to replace the type arguments required to
invoke the constructor of a generic class with an empty set of type
parameters (<>) as long as the compiler can infer the type arguments
from the context [1].
Enable the Eclipse warning about redundant type arguments, and remove
the ones it warns about.
[1] http://goo.gl/SG21kM
Change-Id: I422882949a6a6a57391580d881f73120b2843a0e
These don't introduce any new warnings, but are automatically added
every time I click "Apply" in the errors/warnings project properties,
so add them to reduce churn.
Change-Id: Ie42de594ba0f33d4e66cca97bb05e04e5b2a1dfc
Somehow between turning this on and submitting I743917787 I managed to
turn this back off.
Suppress this warning in an instance where a new interface method was
added in Servlet API 3.0, as the code needs to continue to compile
against earlier versions. Unfortunately Eclipse does not give us a
more specific suppression token than "all", but in this case the
method body is small enough we're probably not missing anything.
Change-Id: I78ecf82f6cd4042417c9f3b1f6a4b473d29182d9
- Warn on empty statements, e.g. "for (;;);". These may be
typos and are easily replaced by "for (;;) {}" which is more
explicit.
- Warn on field hiding. This allows cleanup of many acceptance test
members, at the cost of a couple of renames and the occasional
suppression (when the field is in a public nested enum that shadows
a public constant).
- Warn on unnecessary casts.
- Warn on unused declared thrown exceptions. In addition to reducing
method signature length and number of imports, this also eliminated
some impossible catch blocks.
- Warn on missing @Override annotations.
- Warn on unused parameters. This is likely the most controversial,
as a few relatively common patterns require unused parameters in a
way that Eclipse can't ignore. However, it also resulted in cleanup
of a lot of unnecessary injections and method parameters, so I
think the cost was worth it.
Change-Id: I7224be8b1c798613a127c88507e8cce400679e5d
This warning was suppressed on subprojects with commit f1264f4, but that
is no longer effective with the new Eclipse project structure after the
buck build was integrated.
Now we suppress the warning on the top level project.
Change-Id: I0e9a22a62d9950d2c364b48aa76cf914a185aafd
Implement a new build system using Buck[1], Facebook's
open source clone of Google's internal build system.
Pros:
- Concise build language
- Test and build output is concise
- Test failures and stack traces show on terminal
- Reliable incrementals; clean is unnecessary
- Extensible with simple blocks of Python
- Fast
buck: clean: 0.452s, full 1m21.083s [*], no-op: 7.145s,
mvn: clean: 4.596s, full 2m53.776s, no-op: 59.108s,
[*] full build includes downloading all dependencies,
time can vary due to remote server performance.
Cons:
- No Windows support
- No native Maven Central support (added by macros)
- No native GWT, Prolog, or WAR support (added by macros)
- Bootstrap of buck requires Ant
Getting started:
git clone https://gerrit.googlesource.com/buck
cd buck
ant
Mac OS X:
PATH="`pwd`/bin:/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands:$PATH"
Linux:
PATH="`pwd`/bin:$PATH"
Importing into Eclipse:
$ time buck build :eclipse
0m48.949s
Import existing project from `pwd`
Import 'gerrit' (do not import other Maven based projects)
Expand 'gerrit'
Right click 'buck-out' > Properties
Under Attributes check 'Derived'
If the code doesn't currently compile but an updated classpath
is needed, refresh the configs and obtain missing JARs:
$ buck build :eclipse_project :download
Running JUnit tests:
$ time buck test --all -e slow # skip slow tests
0m19.320s
$ time buck test --all # includes acceptance tests
5m17.517s
Building WAR:
$ buck build :gerrit
$ java -jar buck-out/gen/gerrit.war
Building release:
$ buck test --all && buck build :api :release
$ java -jar buck-out/gen/release.war
$ ls -lh buck-out/gen/{extension,plugin}-api.jar
Downloading dependencies:
Dependencies are normally downloaded automatically, but Buck can
inspect its graph and download missing dependencies so future
compiles can run without the network:
$ buck build :download
[1] http://facebook.github.io/buck/
Change-Id: I40853b108bd8e153cefa0896a5280a9a5ff81655
This refactoring splits the code up into different components, with
their own per-component CLASSPATH. By moving all of our classes
into isolated components we can better isolate the classpaths and
try to avoid unexpected dependency problems. It also allows us to
more clearly define which components are used by the GWT UI and
thus must be compiled under GWT, and which components are run on
the server and can therefore use more of the J2SE API.
Change-Id: I833cc22bacc5655d1c9099ed7c2b0e0a5b08855a
Signed-off-by: Shawn O. Pearce <sop@google.com>
gwtjsonrpc 1.1 and later is targeted for Java 1.6 source and bytecode,
so we might as well start doing the same here in Gerrit before we move
to the 1.1 code line.
Signed-off-by: Shawn O. Pearce <sop@google.com>
In general we map one Maven project description to one Git
repository, as each Maven project has its own unique version
number for its artifact.
This change pulls everything up one level so its a much more
typical directory layout, where the pom.xml is at the root
of the directory structure.
Signed-off-by: Shawn O. Pearce <sop@google.com>