Skip to content
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

Checker-Annotation #1260

Open
wants to merge 3 commits into
base: master
from
Open

Checker-Annotation #1260

wants to merge 3 commits into from

Conversation

@guy34code
Copy link

guy34code commented Mar 25, 2020

No description provided.

@@ -123,7 +125,7 @@ public Graph(Edge[] edges) {
/**
* Runs dijkstra using a specified source vertex
*/
public void dijkstra(String startName) {
public void dijkstra(@NonNull String startName) {

This comment has been minimized.

Copy link
@Maxi17

Maxi17 Mar 26, 2020

You don't need to add @NonNull because it is the default qualifier.

This comment has been minimized.

Copy link
@guy34code

guy34code Mar 29, 2020

Author

Okay, Done!

@@ -104,7 +106,7 @@ public String toString() {
/**
* Builds a graph from a set of edges
*/
public Graph(Edge[] edges) {
public Graph(@Positive Edge[] edges) {

This comment has been minimized.

Copy link
@Maxi17

Maxi17 Mar 26, 2020

The @Positive annotation is not in the NullnessChecker hierarchy. You mixed the NullnessChecker and IndexChecker qualifiers in this case study. It is not wrong to annotate a file using 2 type systems, but it is not the usual way a case study is done.

Also, the annotation is incorrect. What you meant is that the array edges contains objects of type Edge, which can't be @Positive, because it is meaningless. Only types like int, which represent a number can be @Positive, @NonNegative and some other IndexChecker qualifiers.

This comment has been minimized.

Copy link
@guy34code

guy34code Mar 29, 2020

Author

Sorry, I'll keep in mind next time.

@@ -95,7 +97,7 @@ public int compareTo(Vertex other) {
return Integer.compare(dist, other.dist);
}

@Override
@Override

This comment has been minimized.

Copy link
@Maxi17

Maxi17 Mar 26, 2020

Avoid making changes that add no value to the PR.

@@ -56,7 +58,7 @@ public static void main(String[] args) {
public final String v1, v2;
public final int dist;

public Edge(String v1, String v2, int dist) {
public Edge(@NonNull String v1, @NonNull String v2, @NonNegative int dist) {

This comment has been minimized.

Copy link
@Maxi17

Maxi17 Mar 26, 2020

`@NonNull is not needed, see the explanation below.

This comment has been minimized.

Copy link
@guy34code
@@ -56,7 +58,7 @@ public static void main(String[] args) {
public final String v1, v2;
public final int dist;

This comment has been minimized.

Copy link
@Maxi17

Maxi17 Mar 26, 2020

I expected a @NonNegative annotation here, too. This field is initialized in the constructor with a non-negative value.

This comment has been minimized.

Copy link
@guy34code
guy34code added 2 commits Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.