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

Feature Request: Support the use of jetbrains "external annotations" annotation.xml format for stubbing. #6258

Open
sir-maniac opened this issue Oct 23, 2023 · 2 comments
Labels
enhancement good first issue A beginner-friendly place to start contributing to the Checker Framework

Comments

@sir-maniac
Copy link

sir-maniac commented Oct 23, 2023

ItelliJ Idea keeps track of external annotations using a simple xml format and directory tree.

The documentation can be found here .

Examples of the format can be found here in the intellij community source code

For example, to stub java.lang.String:
File: java/lang/annotations.xml

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <item name="java.lang.String java.lang.String intern()">
    <annotation name="org.checkerframework.checker.interning.qual.Interned" />
  </item>
</root>

The xml format is simple so it should be easy to implement.

This would make it easier to work with the Check Framework for IntelliJ users, as they can easily add the information through the IDE and pass the information to the checker. It is also easy to share with others, and can be distributed like a source jar.

This is likely more performant than stubs as well.

EDIT: wrong link to intellij repository

@mernst mernst added the good first issue A beginner-friendly place to start contributing to the Checker Framework label Oct 23, 2023
@mernst
Copy link
Member

mernst commented Oct 23, 2023

That's a cool idea. We would gladly accept a pull request. I wish that the format was actually documented...

@sir-maniac
Copy link
Author

sir-maniac commented Oct 23, 2023

Probably the best 'document' would be the unit tests. A cursory search shows just one main test class.

Most of the action seems to be handled in ExternalAnnotationsManager(and subclasses).

I won't promise, but I'll spend a little time and see what I can do myself.

@typetools typetools deleted a comment from 555vedant Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue A beginner-friendly place to start contributing to the Checker Framework
Projects
None yet
Development

No branches or pull requests

2 participants