[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jdt-dev] More fine-grained error-recovery and code generation for Java
|
Hi list,
we're building interactive Java environment supporting exploratory
programming in Java. We use eclipse java compiler to compile Java code
because it can deal with incomplete/invalid code. That's great.
However we would like to improve the support for compiling erroneous
code. For example, assume following code:
class X {
public void foo(int a) {
if (a == 1) {
this.bar();
}
System.out.println("Hello World");
}
}
Now, because bar() cannot be resolved, the eclipse compiler
effectively compiles:
...
public void foo(int a) {
throw java.lang.Error("Unresolved compilation problem");
}
...
(i.e., once the **method** that contains error is executed, an exception
is thrown)
However, we would like something like:
...
public void foo(int a) {
if (a == 1) {
throw java.lang.Error("X#bar() cannot be resolved");
}
System.out.println("Hello World");
}
...
(i.e., once the **statement** that contains error is executed, an
exception is thrown)
Also, we would like to embed metadata about errors into the classfile
so later on we could use that data to figure out what has to be
recompiled/updated.
I'm ready to start working on that, but I'm not sure where to start
and not even sure if it is feasible or not. Hence I'm asking for your
opinion as you have more in-depth knowledge than I.
- Do you think it is feasible to modify eclipse compiler in that way?
Do you see any obstacle preventing such a compilation scheme?
- Do you think we can build a modified compiler on top of JDT without
need to actually fork it? (Personally, I doubt it)
- Would Eclipse team be interested in such changes?
Thank you very much for any comment/thought on this matter.
Best, Jan