-
Notifications
You must be signed in to change notification settings - Fork 196
Enable strict compiler settings #413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
15e39ec
enable compiler warnings and linting
bpkroth d66eaba
address some trailing whitespace warnings
bpkroth 9fde340
Merge branch 'main' into strict-compiler
bpkroth 3b3906c
compiler fixups
bpkroth 092e06d
compiler fixups
bpkroth 8038636
add some warning suppressions for unused variables
bpkroth 139c953
omit those entirely
bpkroth 259cca6
fixups
bpkroth 77c74ae
whitespace
bpkroth 7abe2e8
use autoclose
bpkroth a3f7fec
remove more suppressed cast issues
bpkroth 554406d
unnecessary cast
bpkroth 79e7187
avoid unused errors
bpkroth d93caf7
add serialization requirements
bpkroth 7f89237
whitespace
bpkroth ff5507d
more minor avoid raw type issues
bpkroth fc97c1e
in the couple of utility classes, just suppress more warnings
bpkroth 5220c3f
convert throw type to avoid InterruptedException handling warnings
bpkroth df432f3
docs
bpkroth d93c61d
enable deprecations
bpkroth b0398b1
more compiler warning fixups
bpkroth db891e9
Merge branch 'main' into strict-compiler
bpkroth c53ea80
revert order
bpkroth e5e9c00
need the col++
bpkroth 94385e7
address some unused and other lint issues
bpkroth 448ca24
fixup
bpkroth 1e411d4
fixup
bpkroth 2937b46
add a readme with additional developer notes per PR suggestion
bpkroth 4b22f8d
tweak comment
bpkroth fa34754
add more developer notes
bpkroth be0f414
include some extension recommendations
bpkroth 43b5cee
update extensions
bpkroth 4556f10
address more unused warnings
bpkroth 5939e2d
ignore another error
bpkroth 4f0fe4c
Merge branch 'main' into strict-compiler
bpkroth ebb52de
addressing some new serialization warnings
bpkroth adb1a96
comments
bpkroth acd47aa
adjust constructor to avoid this-escape errors
bpkroth d350c6e
convert a pile of classes to 'final' to avoid this-escape errors
bpkroth 3437b2d
auto-whitespace
bpkroth b2e7489
comments about this-escape warnings
bpkroth b526294
exception
bpkroth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"recommendations": [ | ||
"EditorConfig.EditorConfig", | ||
"github.vscode-pull-request-github", | ||
"huntertran.auto-markdown-toc", | ||
"vscjava.vscode-java-pack" | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Contributing | ||
|
||
We welcome all contributions! Please open a [pull request](https://github.com/cmu-db/benchbase/pulls). Common contributions may include: | ||
|
||
- Adding support for a new DBMS. | ||
- Adding more tests of existing benchmarks. | ||
- Fixing any bugs or known issues. | ||
|
||
## Contents | ||
|
||
<!-- TOC --> | ||
|
||
- [Contributing](#contributing) | ||
- [Contents](#contents) | ||
- [IDE](#ide) | ||
- [Adding a new DBMS](#adding-a-new-dbms) | ||
- [Java Development Notes](#java-development-notes) | ||
- [Avoid var keyword](#avoid-var-keyword) | ||
- [Compiler Warnings](#compiler-warnings) | ||
- [Alternatives to arrays of generics](#alternatives-to-arrays-of-generics) | ||
|
||
<!-- /TOC --> | ||
|
||
## IDE | ||
|
||
Although you can use any IDE you prefer, there are some configurations for [VSCode](https://code.visualstudio.com/) that you may find useful included in the repository, including [Github Codespaces](https://github.com/features/codespaces) and [VSCode devcontainer](https://code.visualstudio.com/docs/remote/containers) support to automatically handle dependencies, environment setup, code formatting, and more. | ||
|
||
## Adding a new DBMS | ||
|
||
Please see the existing MySQL and PostgreSQL code for an example. | ||
|
||
## Java Development Notes | ||
|
||
### Compiler Warnings | ||
|
||
In an effort to enforce clean, safe, maintainable code, [PR #413](https://github.com/cmu-db/benchbase/pull/413) enabled the `-Werror` and `-Xlint:all` options for the `javac` compiler. | ||
|
||
This means that any compiler warnings will cause the build to fail. | ||
|
||
If you are seeing a build failure due to a compiler warning, please fix the warning or (on rare occassions) add an exception to the line causing the issue. | ||
|
||
### Avoid `var` keyword | ||
|
||
In general, we prefer to avoid the `var` keyword in favor of explicit types. | ||
|
||
#### Alternatives to arrays of generics | ||
|
||
Per the [Java Language Specification](https://docs.oracle.com/javase/tutorial/java/generics/restrictions.html#createArrays), arrays of generic types are not allowed and will cause compiler warnings (e.g., `unchecked cast`) | ||
|
||
In some cases, you can extend a generic type to create a non-generic type that can be used in an array. | ||
|
||
For instance, | ||
|
||
```java | ||
// Simple generic class overload to avoid some cast warnings. | ||
class SomeTypeList extends LinkedList<SomeType> {} | ||
|
||
SomeTypeList[] someTypeLists = new SomeTypeList[] { | ||
new SomeTypeList(), | ||
new SomeTypeList(), | ||
new SomeTypeList(), | ||
}; | ||
``` | ||
|
||
#### `this-escape` warnings | ||
|
||
`possible 'this' escape before subclass is fully initialized` | ||
|
||
The `this-escape` warning above is caused by passing using `this.someOverridableMethod()` in a constructor. | ||
This could in theory cause problems with a subclass not being fully initialized when the method is called. | ||
|
||
Since many of our classes are not designed to be subclassed, we can safely ignore this warning by marking the class as `final` rather than completely rewrite the class initialization. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.