-
Notifications
You must be signed in to change notification settings - Fork 19
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
Class literals in CFGs and their type with conservative nullness #548
Comments
Thanks, I have reproduced the result and CFG. I am working on it right now. |
@wmdietl Dear Prof. Dietl, for adding this test case to the repo, include the |
In general let's try to avoid |
Thanks for providing me with the resource. |
As described in the isFieldAccess method javadoc: I think this is wrong and cause the fieldaccess on class literal in Line 3561 in f50cbe3
I think we should use classnamenode for class literal. But I am not sure if is there any easy way to make sure the isFieldAccess method only returns true for field access. |
In
MyEnum.java
put the following and compile withjavac
:Then put the following into
ConservativeClassLiteral.java
:Class literals should always be initialized and non-null, independent of whether conservative defaults are used.
However, when compiling with
./checker/bin/javac -cp . -processor nullness -AuseConservativeDefaultsForUncheckedCode=bytecode,-source ConservativeClassLiteral.java
one gets:When looking at the CFG for the above example, one first sees a
ClassName
node forMyEnum
followed by aFieldAccess
node forMyEnum.class
.This is wrong, as the javadoc for
FieldAccess
explicitly states:It does not represent a class literal such as {@code SomeClass.class} or {@code int[].class}
; see https://github.com/eisop/checker-framework/blob/388fdb094942de42e871a96171fadb80c4d1a0e1/dataflow/src/main/java/org/checkerframework/dataflow/expression/FieldAccess.java#L19C45-L20C43 .The text was updated successfully, but these errors were encountered: