JetBrains developers: Constant Conditions & Exceptions questions

For an undergraduate Independent Study, I'm (by myself) developing an IDEA
compiler plugin + inspection plugin which respects Java 5 annotations for
specifying non-null value invariants for variables, fields, etc. (and maybe
other invariants, to come later). I have chosen to do it within PSI as a
source processor (this also allows compilation-time checks as well as editor
inspections).

Complex data flow is necessary to know when values may be null and when they
are not null. I am very new to compilers, dataflow, and things like that.
I've read most of Tiger compiler book, and Optimization section of Dragon
compiler book, but neither seems specific enough to address how to do dataflow
such that is required for my plugin. So, I'm having some trouble designing
and implementing the plugin.

The Constant Conditions & Exceptions inspections already present in IDEA
appear to share a great deal of functionality with my project. My project
needs to check whether values may be null, and Constant Conditions already
does this.

I plan to look at Sable optimisation framework, and Sun HotSpot source code
to see how they handle null checks, but I thought I would ask here first,
because you guys have implemented something very similar to what I need,
using the same PSI API.

So, I ask you, IDEA developers, a few questions:

1. What books, papers, open-source research projects would you recommend
I look at, to learn more about what I need for implementing such dataflow
algorithm?

2. Would it be possible for you to expose Constant Conditions & Exceptions
as OpenAPI, for example some API to compute constant conditions at a given
PSI element's execution?

3. Would it be possible for you to release the Constant Conditions inspection
source code, under a license such that I could extend it or include it in
my project?

Thanks, any pointers that you JetBrains, or anyone, can give me for this
project would be great. My college's CS department has only one faculty member
with knowledge about static analysis, and she is away for the semester, so
I'm mostly on my own with this project.


4 comments
Comment actions Permalink

I don't mean to irritate anyone, but I'd like to make sure - no one can answer
these questions? Any answer at all would help me out.

-Keith

For an undergraduate Independent Study, I'm (by myself) developing an
IDEA compiler plugin + inspection plugin which respects Java 5
annotations for specifying non-null value invariants for variables,
fields, etc. (and maybe other invariants, to come later). I have
chosen to do it within PSI as a source processor (this also allows
compilation-time checks as well as editor inspections).

Complex data flow is necessary to know when values may be null and
when they are not null. I am very new to compilers, dataflow, and
things like that. I've read most of Tiger compiler book, and
Optimization section of Dragon compiler book, but neither seems
specific enough to address how to do dataflow such that is required
for my plugin. So, I'm having some trouble designing and implementing
the plugin.

The Constant Conditions & Exceptions inspections already present in
IDEA appear to share a great deal of functionality with my project. My
project needs to check whether values may be null, and Constant
Conditions already does this.

I plan to look at Sable optimisation framework, and Sun HotSpot source
code to see how they handle null checks, but I thought I would ask
here first, because you guys have implemented something very similar
to what I need, using the same PSI API.

So, I ask you, IDEA developers, a few questions:

1. What books, papers, open-source research projects would you
recommend I look at, to learn more about what I need for implementing
such dataflow algorithm?

2. Would it be possible for you to expose Constant Conditions &
Exceptions as OpenAPI, for example some API to compute constant
conditions at a given PSI element's execution?

3. Would it be possible for you to release the Constant Conditions
inspection source code, under a license such that I could extend it or
include it in my project?

Thanks, any pointers that you JetBrains, or anyone, can give me for
this project would be great. My college's CS department has only one
faculty member with knowledge about static analysis, and she is away
for the semester, so I'm mostly on my own with this project.




0
Comment actions Permalink

1. What books, papers, open-source research projects would you
recommend I look at, to learn more about what I need for implementing
such dataflow algorithm?

Honestly we haven't read anything special prior implementing those inspections.

2. Would it be possible for you to expose Constant Conditions &
Exceptions as OpenAPI, for example some API to compute constant
conditions at a given PSI element's execution?

This is quite possible but doesn't help in your case IMO since you wan't
be able to extend existing DFA to benefit from knowledge you going to extract
from annotations, right?

3. Would it be possible for you to release the Constant Conditions
inspection source code, under a license such that I could extend it
or include it in my project?

I'll ask Eugene but seriously doubt he well accept that. It's a ~130KB of
a know-how finally.

The answers weren't quite useful, right? I'm sorry Keith. I could mail you
a basic idea of implementation if you'd like.


0
Comment actions Permalink

>> 1. What books, papers, open-source research projects would you
>> recommend I look at, to learn more about what I need for implementing
>> such dataflow algorithm?
>>

Honestly we haven't read anything special prior implementing those
inspections.


I think you guys knew something about dataflow and compilers.

>> 2. Would it be possible for you to expose Constant Conditions &
>> Exceptions as OpenAPI, for example some API to compute constant
>> conditions at a given PSI element's execution?
>>

This is quite possible but doesn't help in your case IMO since you
wan't be able to extend existing DFA to benefit from knowledge you
going to extract from annotations, right?


Yes, but if the API were open in those ways, maybe I could use it. Projects
like JML could possibly use this API to write plugins similar to mine with
such an API.

>> 3. Would it be possible for you to release the Constant Conditions
>> inspection source code, under a license such that I could extend it
>> or include it in my project?
>>

I'll ask Eugene but seriously doubt he well accept that. It's a ~130KB
of a know-how finally.


I understand. However, it's IDEA-specific, right?, so it would mainly help
people trying to contribute to IDEA. But, maybe there aren't many people
trying to write inspections for IDEA.

The answers weren't quite useful, right? I'm sorry Keith. I could mail
you a basic idea of implementation if you'd like.


The answers were helpful, thank you. If you want to mail me a basic idea
of implementation that would be cool, I don't want to take up your time but
any tips or pointers to where to start would help me. I also plan to look
at other optimization and analysis frameworks to see how they do this sort
of thing, but those are pretty complicated so it might take me a while.


0
Comment actions Permalink

Hi Keith,

I'm contemplating doing something very similiar to what you mention :)
It would be really great to hear how your experience with this went - could you possibly share that information?

Cheers
Alan

0

Please sign in to leave a comment.