typetools / typetools/checker-framework
Preventing unannotated reflection APIs
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
Currently, every type system needs to include, in its annotated libraries,
a conservative annotation for reflection methods such as
java.lang.reflect.Method.invoke(Object...)
java.lang.reflect.InvocationHandler.invoke(Object, Method,
java.lang.Object[])
javax.xml.ws.spi.Invoker(Method, Object...)
This is error-prone: the designer of a type system may forget this detail. It
would be nicer to prevent this error from occurring, and then reflection would
not be a source of unsoundness in the Checker Framework.
I propose to define a method annotation @ReflectionMethod, and to write it on
the above methods in the annotated JDK.
The Checker Framework will treat any method annotated with @ReflectionMethod as
having maximally-conservative annotations.
Original issue reported on code.google.com by michael.ernst@gmail.com on 28 Aug 2014 at 8:09
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names reflection APIs in java.lang.reflect and javax.xml.ws.spi, plus the annotated JDK and Checker Framework. Start by locating how method annotations are defined and how annotated JDK declarations are processed. Done means @ReflectionMethod is recognized and the listed reflection methods receive maximally conservative treatment, with corresponding tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100