We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using -Ainfer=stubs, creating stub files for classes with inner classes fails to include type arguments in the outer class. Consider this class
-Ainfer=stubs
public class GenericClass<T> { public class InnerClass { // Create error to force generation of stub file, ignore. Object o = null; } }
I compiled it with,
$CHECKERFRAMEWORK/checker/bin/javac -processor NullnessChecker -Ainfer=stubs GenericClass.java
When I inspect the generated stub file, I see
import org.checkerframework.checker.initialization.qual.Initialized; import org.checkerframework.checker.nullness.qual.Nullable; class GenericClass { class InnerClass { // fields: @Initialized @Nullable java.lang.Object o; } }
Notice that GenericClass has no type parameter.
GenericClass
When I try to use this stub file, I get an error:
$CHECKERFRAMEWORK/checker/bin/javac -processor NullnessChecker -Astubs=build GenericClass.java
warning: StubParser: annotateTypeParameters: mismatched sizes: typeParameters (size 0)=[]; typeArguments (size 1)=[T extends Object]; decl=class GenericClass { class InnerClass { @Initialized @Nullable java.lang.Object o; } }; elt=GenericClass (class com.sun.tools.javac.code.Symbol$ClassSymbol).; for more details, run with -AstubDebug GenericClass.java:4: error: [assignment.type.incompatible] incompatible types in assignment. Object o = null; ^ found : null required: @Initialized @NonNull Object 1 error 1 warning
Output for
$CHECKERFRAMEWORK/checker/bin/javac -processor NullnessChecker -Ainfer=stubs GenericClass.java -version -verbose -AprintAllQualifiers
javac_create_stubs_output.txt
$CHECKERFRAMEWORK/checker/bin/javac -processor NullnessChecker -Astubs=build GenericClass.java -version -verbose -AprintAllQualifiers
javac_use_stubs_output.txt
The text was updated successfully, but these errors were encountered:
Adde test for typetools#3438
92f4bfc
Successfully merging a pull request may close this issue.
When using
-Ainfer=stubs
, creating stub files for classes with inner classes fails to include type arguments in the outer class. Consider this classI compiled it with,
$CHECKERFRAMEWORK/checker/bin/javac -processor NullnessChecker -Ainfer=stubs GenericClass.java
When I inspect the generated stub file, I see
Notice that
GenericClass
has no type parameter.When I try to use this stub file, I get an error:
$CHECKERFRAMEWORK/checker/bin/javac -processor NullnessChecker -Astubs=build GenericClass.java
Output for
$CHECKERFRAMEWORK/checker/bin/javac -processor NullnessChecker -Ainfer=stubs GenericClass.java -version -verbose -AprintAllQualifiers
javac_create_stubs_output.txt
Output for
$CHECKERFRAMEWORK/checker/bin/javac -processor NullnessChecker -Astubs=build GenericClass.java -version -verbose -AprintAllQualifiers
javac_use_stubs_output.txt
The text was updated successfully, but these errors were encountered: