How does StubGenerator find classes?

5 views
Skip to first unread message

Jon Schewe

unread,
Apr 11, 2021, 11:18:43 AM4/11/21
to 'Hunter Knepshield' via Checker Framework discussion
I'm trying to create a stub file for an existing class. The example of java.lang.String in the manual works fine. However when I try and generate a stub for a class outside the JDK I get an error that the class cannot be found. Here is the command line that I'm using:

StubGenerator: Couldn't find a package or a class named org.slf4j.Logger

This shows that the class that I'm looking for is inside a jar on the classpath:
>jar -tf ~/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.30/b5a4b6d16ab13e34a88fae84c35cd5d68cac922c/slf4j-api-1.7.30.jar | grep org/slf4j/Logger
org/slf4j/Logger.class
org/slf4j/LoggerFactory.class

How does StubGenerator search for the classes to annotate?

Thank you,

Jon


Michael Ernst

unread,
Apr 11, 2021, 3:26:06 PM4/11/21
to Jon Schewe, 'Hunter Knepshield' via Checker Framework discussion
Jon-

> How does StubGenerator search for the classes to annotate?

It uses javac programmatically; here is the code.

Unfortunately, changes in JDK 11 seem to have broken the StubGenerator program.

Since SLF4J is open source, you don't need StubGenerator.  You can follow the instructions in the "If you have access to the Java source code" section of the manual: https://checkerframework.org/manual/#stub-creating-with-source

Mike

--

---
You received this message because you are subscribed to the Google Groups "Checker Framework discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to checker-framework-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/checker-framework-discuss/9dd0d023b5b7bb63dbff298891ea3fc54d8fcac7.camel%40mtu.net.

Jon Schewe

unread,
Apr 11, 2021, 9:29:54 PM4/11/21
to Michael Ernst, 'Hunter Knepshield' via Checker Framework discussion
Thank you. Where would you like the stub file submitted?
Reply all
Reply to author
Forward
0 new messages