-
Notifications
You must be signed in to change notification settings - Fork 13
Update region computation. #91
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
Changes from 14 commits
d820b07
6a5b075
38a79a6
af9fd46
74b7b3b
440608d
d218d29
c4e9d89
55cd6ae
7ee9a7b
28c52a1
898be2f
605171e
a0db707
adeaf9a
035053f
6a2898e
eba2200
c818b9f
21c8112
08d9e2c
b51475a
ba70c68
69e537b
851f8eb
2ae2b00
204ec6b
94d4efe
2db1d9a
e86efcd
606de6e
69e46e4
2218ea3
335ee94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,4 +56,15 @@ jobs: | |
| uses: actions/upload-artifact@v2 | ||
| with: | ||
| name: Test report | ||
| path: build/reports/tests/test | ||
| path: build/reports/tests/test | ||
| build-with-nullaway-serialization-0: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Set up JDK 11 | ||
| uses: actions/setup-java@v2 | ||
| with: | ||
| java-version: 11 | ||
| distribution: 'adopt' | ||
|
||
| - name: Build with Gradle | ||
| run: ./gradlew :core:test --scan --no-daemon -Pnullaway-test-version=0 | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| /* | ||
| * MIT License | ||
| * | ||
| * Copyright (c) 2022 Nima Karimipour | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| * THE SOFTWARE. | ||
| */ | ||
|
|
||
| package edu.ucr.cs.riple.core.adapters; | ||
|
|
||
| import edu.ucr.cs.riple.core.metadata.index.Error; | ||
| import edu.ucr.cs.riple.core.metadata.index.Fix; | ||
| import edu.ucr.cs.riple.core.metadata.trackers.Region; | ||
| import edu.ucr.cs.riple.core.metadata.trackers.TrackerNode; | ||
| import edu.ucr.cs.riple.injector.location.Location; | ||
| import edu.ucr.cs.riple.injector.location.OnField; | ||
| import java.util.Set; | ||
|
|
||
| /** | ||
| * Responsible for performing tasks related to NullAway / Type Annotator Scanner serialization | ||
| * features. | ||
| */ | ||
| public interface Adapter { | ||
|
||
|
|
||
| /** | ||
| * Deserializes values produced by NullAway in a tsv file and creates a corresponding {@link Fix} | ||
| * instance. | ||
| * | ||
| * @param location Location of the targeted element. | ||
| * @param values Values in row of a TSV file. | ||
| * @return Corresponding Error instance with the passed values. | ||
| */ | ||
| Fix deserializeFix(Location location, String[] values); | ||
|
|
||
| /** | ||
| * Deserializes values produced by NullAway in a tsv file and creates a corresponding {@link | ||
| * Error} instance. | ||
| * | ||
| * @param values Values in row of a TSV file. | ||
| * @return Corresponding Error instance with the passed values. | ||
| */ | ||
| Error deserializeError(String[] values); | ||
|
|
||
| /** | ||
| * Deserializes values produced by Type Annotator Scanner in a tsv file and creates a | ||
| * corresponding {@link TrackerNode} instance. | ||
| * | ||
| * @param values Values in row of a TSV file. | ||
| * @return Corresponding Error instance with the passed values. | ||
| */ | ||
| TrackerNode deserializeTrackerNode(String[] values); | ||
|
|
||
| /** | ||
| * Returns a set of regions enclosed by a field. Returns a set since there can multiple inline | ||
| * field declarations. | ||
| * | ||
| * @param onField The target field. | ||
| * @return Set of regions enclosed by the passed location. | ||
| */ | ||
| Set<Region> getFieldRegionScope(OnField onField); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * MIT License | ||
| * | ||
| * Copyright (c) 2022 Nima Karimipour | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| * THE SOFTWARE. | ||
| */ | ||
|
|
||
| package edu.ucr.cs.riple.core.adapters; | ||
|
|
||
| import edu.ucr.cs.riple.core.Config; | ||
|
|
||
| /** Base class for all adapters. */ | ||
| public abstract class AdapterAbstractClass implements Adapter { | ||
|
||
|
|
||
| /** Annotator config. */ | ||
| protected final Config config; | ||
|
|
||
| public AdapterAbstractClass(Config config) { | ||
| this.config = config; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume either now or in a follow up diff, we want to change all the above
distribution: 'adopt'totemurin. Not really needed for this PR (and it's already quite large) but worth keeping in mind.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#98