Exception while compiling custom file - why?

I'm implementing custom compiler and when I compile I get:

Original exception:
java.lang.NullPointerException
at com.intellij.compiler.impl.CompileDriver$17.write(CompileDriver.java:2)
at com.intellij.compiler.impl.CompileDriver$17.write(CompileDriver.java:3)
at com.intellij.compiler.impl.MapCache.save(MapCache.java:52)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:832)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:730)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:104)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:791)
at com.intellij.compiler.impl.CompileDriver.access$400(CompileDriver.java:638)
at com.intellij.compiler.impl.CompileDriver$4$1.run(CompileDriver.java:5)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:83)
at com.intellij.compiler.impl.CompileDriver$4.run(CompileDriver.java:2)


What am I doing wrong? Thanks

6 comments
Comment actions Permalink

what IDEA build are you using?

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

"Keith Lea" <keith@cs.oswego.edu> wrote in message news:10654023.1125525207342.JavaMail.javamailuser@localhost...

I'm implementing custom compiler and when I compile I get:

>

Original exception:
java.lang.NullPointerException
at com.intellij.compiler.impl.CompileDriver$17.write(CompileDriver.java:2)
at com.intellij.compiler.impl.CompileDriver$17.write(CompileDriver.java:3)
at com.intellij.compiler.impl.MapCache.save(MapCache.java:52)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:832)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:730)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:104)
at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:791)
at com.intellij.compiler.impl.CompileDriver.access$400(CompileDriver.java:638)
at com.intellij.compiler.impl.CompileDriver$4$1.run(CompileDriver.java:5)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:83)
at com.intellij.compiler.impl.CompileDriver$4.run(CompileDriver.java:2)

>
>

What am I doing wrong? Thanks



0
Comment actions Permalink

Nevermind.
Please make sure that your compiler does not return null ValidityState objects.

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

"Eugene Zhuravlev (JetBrains)" <jeka@intellij.com> wrote in message news:df6kdu$7tm$1@is.intellij.net...

what IDEA build are you using?

>

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

>

"Keith Lea" <keith@cs.oswego.edu> wrote in message news:10654023.1125525207342.JavaMail.javamailuser@localhost...

>> I'm implementing custom compiler and when I compile I get:
>>
>> Original exception:
>> java.lang.NullPointerException
>> at com.intellij.compiler.impl.CompileDriver$17.write(CompileDriver.java:2)
>> at com.intellij.compiler.impl.CompileDriver$17.write(CompileDriver.java:3)
>> at com.intellij.compiler.impl.MapCache.save(MapCache.java:52)
>> at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:832)
>> at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:730)
>> at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:104)
>> at com.intellij.compiler.impl.CompileDriver.a(CompileDriver.java:791)
>> at com.intellij.compiler.impl.CompileDriver.access$400(CompileDriver.java:638)
>> at com.intellij.compiler.impl.CompileDriver$4$1.run(CompileDriver.java:5)
>> at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:83)
>> at com.intellij.compiler.impl.CompileDriver$4.run(CompileDriver.java:2)
>>
>>
>> What am I doing wrong? Thanks
>



0
Comment actions Permalink

Eugene Zhuravlev (JetBrains) wrote:

Nevermind.
Please make sure that your compiler does not return null ValidityState objects.


What is createValidityState(DataInputStream) supposed to do?

I think you should add an assertion that validity state is not null so others
don't have this same problem. You should mark the related methods @NotNull as
well, and DummySourceGeneratingCompiler.createValidityState() should throw
IllegalStateException or something (currently I extend it, and call
super.createValidityState).

0
Comment actions Permalink

I see now. If I'm using TimestampValidityState I don't see how to read it from
DataInputStream. Is there some factory I'm missing?

Keith Lea wrote:

Eugene Zhuravlev (JetBrains) wrote:

>> Nevermind.
>> Please make sure that your compiler does not return null ValidityState
>> objects.
>>


What is createValidityState(DataInputStream) supposed to do?

I think you should add an assertion that validity state is not null so
others don't have this same problem. You should mark the related methods
@NotNull as well, and
DummySourceGeneratingCompiler.createValidityState() should throw
IllegalStateException or something (currently I extend it, and call
super.createValidityState).

0
Comment actions Permalink

Keith,
The timestamp value is placed on the input stream as a long. So just
read it from there with is.readLong:

public ValidityState createValidityState(DataInputStream is) throws
IOException {
return new TimestampValidityState(is.readLong());
}

This matches the corresponding method in TimestampValidityState:

public void save(DataOutputStream os) throws IOException {
os.writeLong(myTimestamp);
}

If you implement your own ValidityState, whatever you write to the
output stream in the save method has to be read again from the input
stream in createValidityState.

Keith Lea wrote:

I see now. If I'm using TimestampValidityState I don't see how to read
it from DataInputStream. Is there some factory I'm missing?

Keith Lea wrote:

>> Eugene Zhuravlev (JetBrains) wrote:
>>
>>> Nevermind.
>>> Please make sure that your compiler does not return null
>>> ValidityState objects.
>>>
>>
>> What is createValidityState(DataInputStream) supposed to do?
>>
>> I think you should add an assertion that validity state is not null so
>> others don't have this same problem. You should mark the related
>> methods @NotNull as well, and
>> DummySourceGeneratingCompiler.createValidityState() should throw
>> IllegalStateException or something (currently I extend it, and call
>> super.createValidityState).

--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com

0
Comment actions Permalink

Thanks. I've filed an issue about this.

Martin Fuhrer wrote:

Keith,
The timestamp value is placed on the input stream as a long. So just
read it from there with is.readLong:

public ValidityState createValidityState(DataInputStream is) throws
IOException {
return new TimestampValidityState(is.readLong());
}

This matches the corresponding method in TimestampValidityState:

public void save(DataOutputStream os) throws IOException {
os.writeLong(myTimestamp);
}

If you implement your own ValidityState, whatever you write to the
output stream in the save method has to be read again from the input
stream in createValidityState.

Keith Lea wrote:

>> I see now. If I'm using TimestampValidityState I don't see how to read
>> it from DataInputStream. Is there some factory I'm missing?
>>
>> Keith Lea wrote:
>>
>>> Eugene Zhuravlev (JetBrains) wrote:
>>>
>>>> Nevermind.
>>>> Please make sure that your compiler does not return null
>>>> ValidityState objects.
>>>>
>>>
>>> What is createValidityState(DataInputStream) supposed to do?
>>>
>>> I think you should add an assertion that validity state is not null
>>> so others don't have this same problem. You should mark the related
>>> methods @NotNull as well, and
>>> DummySourceGeneratingCompiler.createValidityState() should throw
>>> IllegalStateException or something (currently I extend it, and call
>>> super.createValidityState).


0

Please sign in to leave a comment.