Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ checker/tests/nullness-extra/issue3597/testpkg/Issue3597A.class
checker/tests/nullness-extra/issue3597/testpkg/Issue3597B.class
checker/tests/nullness-extra/issue502/Issue502.class
checker/tests/nullness-extra/issue502/Out.txt
checker/tests/nullness-extra/issue5174/*.class
checker/tests/nullness-extra/issue5174/Out.txt
checker/tests/nullness-extra/issue594/Out.txt
checker/tests/nullness-extra/issue607/Issue607.class
checker/tests/nullness-extra/issue607/Issue607Interface.class
Expand Down
5 changes: 4 additions & 1 deletion checker/tests/nullness-extra/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Tests that are currently passing
PASSING_TESTS = Bug109 compat issue265 issue594 issue607 multiple-errors package-anno shorthand issue3597
PASSING_TESTS = Bug109 compat issue265 issue594 issue607 multiple-errors package-anno shorthand issue3597 issue5174
ifeq (,$(findstring 1.8,$(shell javac -version)))
# issue309 and issue502 fail with Java 11 because of differences between Java 8 and Java 11 bytecode.
# TODO: issue559 should work with an annotated jdk11.
Expand Down Expand Up @@ -56,5 +56,8 @@ issue607:
issue3597:
$(MAKE) -C issue3597

issue5174:
$(MAKE) -C issue5174

# All tests: passing and failing
.PHONY: all skipped ${PASSING_TESTS}
69 changes: 69 additions & 0 deletions checker/tests/nullness-extra/issue5174/Issue5174.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Test case for Issue 5174:
// https://github.com/typetools/checker-framework/issues/5174

class Issue5174Super<S> {
S methodInner(S in) {
return in;
}

S f;
static Object sf = "";

Issue5174Super(S f) {
this.f = f;
}
}

class Issue5174Sub<T> extends Issue5174Super<T> {
Issue5174Sub(T f) {
super(f);
}

void accMethImpl(T in) {
Object o = methodInner(in);
}

void accMethExpl(T in) {
Object o = this.methodInner(in);
}

void accFieldImpl() {
Object o = f;
}

void accFieldExpl() {
Object o = this.f;
}

void accStaticField() {
Object o;
o = sf;
o = Issue5174Sub.sf;
o = Issue5174Super.sf;
}

class SubNested {
void nestedaccMethImpl(T in) {
Object o = methodInner(in);
}

void nestedaccMethExpl(T in) {
Object o = Issue5174Sub.this.methodInner(in);
}

void nestedaccFieldImpl() {
Object o = f;
}

void nestedaccFieldExpl() {
Object o = Issue5174Sub.this.f;
}

void nestedaccStaticField() {
Object o;
o = sf;
o = Issue5174Sub.sf;
o = Issue5174Super.sf;
}
}
}
Loading