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

Don't erase the type argument of receiver #793

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
14 changes: 14 additions & 0 deletions checker/jtreg/nullness/type-argument/TypeArgument.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* @test
* @summary Test case for type argument in method invocation.
*
* @compile/fail/ref=TypeArgument.out -XDrawDiagnostics -processor org.checkerframework.checker.nullness.NullnessChecker TypeArgument.java
*/
public class TypeArgument<T> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeArgument is not a very descriptive name for this test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to NonRawTypeArgumentTest


TypeArgument() {
foo();
}

void foo() {}
}
4 changes: 4 additions & 0 deletions checker/jtreg/nullness/type-argument/TypeArgument.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TypeArgument.java:10:12: compiler.err.proc.messager: [method.invocation.invalid] call to foo() not allowed on the given receiver.
Ao-senXiong marked this conversation as resolved.
Show resolved Hide resolved
found : @UnderInitialization(TypeArgument.class) TypeArgument<T extends @Initialized Object>
required: @Initialized TypeArgument<T extends @Initialized Object>
1 error
Original file line number Diff line number Diff line change
Expand Up @@ -3772,7 +3772,7 @@ protected void checkMethodInvocability(
return;
}

AnnotatedTypeMirror methodReceiver = method.getReceiverType().getErased();
AnnotatedTypeMirror methodReceiver = method.getReceiverType();
AnnotatedTypeMirror treeReceiver = methodReceiver.shallowCopy(false);
AnnotatedTypeMirror rcv = atypeFactory.getReceiverType(tree);
Ao-senXiong marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
Loading