NoSuchFieldError after code changes

63 views
Skip to first unread message

sschaef

unread,
Aug 16, 2012, 7:09:59 AM8/16/12
to scala-...@googlegroups.com
After some edits to code completion I got the following exception after
running core inside of eclipse to test the changes:

2012-08-16 12:49:27,791 DEBUG [main] - System.out -
java.lang.NoSuchFieldError: block$3
at
scala.tools.eclipse.ui.ScalaCompletionProposal.apply(ScalaCompletionProposal.scala:107)
at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:933)
at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertSelectedProposalWithMask(CompletionProposalPopup.java:881)
at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(CompletionProposalPopup.java:1307)
at
org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:807)
...

It looks like binary incompatibility. Interestingly all works fine after
a clean and rebuild of the project, but with each new change it is
broken again. How can that be?

Mirco Dotta

unread,
Aug 18, 2012, 1:33:07 PM8/18/12
to scala-...@googlegroups.com
Hey Simon,

That is weird, can you tell us how to reproduce it?

-- Mirco

sschaef

unread,
Aug 18, 2012, 3:42:12 PM8/18/12
to scala-...@googlegroups.com
I did a change in the body of foreach
https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/refactoring/EditorHelpers.scala#L127

After compiling I started core (in Run or Debug mode; it doesn't
matter) and tried to do some code completion. After choosing one of the
methods, suggested by the completion pop-up, the exception occurs when
control flow arrives at the changed foreach block.

Mirco Dotta

unread,
Aug 18, 2012, 4:28:00 PM8/18/12
to scala-...@googlegroups.com
And what did you change (or is it irrelevant?)

> After compiling I started core (in Run or Debug mode; it doesn't matter) and tried to do some code completion. After choosing one of the methods, suggested by the completion pop-up, the exception occurs when control flow arrives at the changed foreach block.

The linked EditorHelpers is used only by refactoring, and it shouldn't be triggered during code completion, so how is the change in EditorHelpers relevant?

Simon Schäfer

unread,
Aug 18, 2012, 5:01:34 PM8/18/12
to scala-...@googlegroups.com


On Sa 18 Aug 2012 22:28:00 CEST, Mirco Dotta wrote:
>> I did a change in the body of foreach https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/refactoring/EditorHelpers.scala#L127
>
> And what did you change (or is it irrelevant?)
It is irrelevant. The only thing which should be achieved is a
recompile.
>
>> After compiling I started core (in Run or Debug mode; it doesn't matter) and tried to do some code completion. After choosing one of the methods, suggested by the completion pop-up, the exception occurs when control flow arrives at the changed foreach block.
>
> The linked EditorHelpers is used only by refactoring, and it shouldn't be triggered during code completion, so how is the change in EditorHelpers relevant?
The error occurs after code completion (I think). Debugger said me that
code completion is used to construct the items which can be completed
and refactoring to insert this items into the sources (the error occurs
not while constructing the list of items to complete, but while trying
to execute one specific completion).

iulian dragos

unread,
Aug 21, 2012, 8:23:03 AM8/21/12
to scala-...@googlegroups.com
On Sat, Aug 18, 2012 at 9:42 PM, sschaef <ma...@antoras.de> wrote:
I did a change in the body of foreach https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/refactoring/EditorHelpers.scala#L127

After compiling I started core (in Run or Debug mode; it doesn't matter) and tried to do some code completion. After choosing one of the methods, suggested by the completion pop-up, the exception occurs when control flow arrives at the changed foreach block.

Are you using -optimize? Are you using Scala 2.9 or 2.10? If you're using the optimizer, it might be that some method in EditorHelpers is inlined at the call site, including the access to that field. After recompiling EditorHelpers, that field may have been renamed (looks synthetic anyway), but de call-site is not recompiled (since the incremental compiler only recompiles calling code if *signatures* change -- meaning it's not -optimize proof).

iulian
 


On Sa 18 Aug 2012 19:33:07 CEST, Mirco Dotta wrote:
Hey Simon,

That is weird, can you tell us how to reproduce it?

-- Mirco

On Aug 16, 2012, at 1:09 PM, sschaef wrote:

After some edits to code completion I got the following exception after running core inside of eclipse to test the changes:

2012-08-16 12:49:27,791 DEBUG [main] - System.out - java.lang.NoSuchFieldError: block$3
        at scala.tools.eclipse.ui.ScalaCompletionProposal.apply(ScalaCompletionProposal.scala:107)
        at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:933)
        at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertSelectedProposalWithMask(CompletionProposalPopup.java:881)
        at org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(CompletionProposalPopup.java:1307)
        at org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:807)
...

It looks like binary incompatibility. Interestingly all works fine after a clean and rebuild of the project, but with each new change it is broken again. How can that be?






--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais

Simon Schäfer

unread,
Aug 25, 2012, 4:49:56 PM8/25/12
to scala-...@googlegroups.com
Thanks for the help, Iulian. After deactivating -optimise the exception
is gone and the code change can be succesfuly used.
I think this issue should be go into the FAQ or at least somewhere else
in the documentation, shouldn't it?

On Di 21 Aug 2012 14:23:03 CEST, iulian dragos wrote:
>
>
> On Sat, Aug 18, 2012 at 9:42 PM, sschaef <ma...@antoras.de
> <mailto:ma...@antoras.de>> wrote:
>
> I did a change in the body of foreach
> https://github.com/scala-ide/__scala-ide/blob/master/org.__scala-ide.sdt.core/src/scala/__tools/eclipse/refactoring/__EditorHelpers.scala#L127
> <https://github.com/scala-ide/scala-ide/blob/master/org.scala-ide.sdt.core/src/scala/tools/eclipse/refactoring/EditorHelpers.scala#L127>
>
> After compiling I started core (in Run or Debug mode; it doesn't
> matter) and tried to do some code completion. After choosing one
> of the methods, suggested by the completion pop-up, the exception
> occurs when control flow arrives at the changed foreach block.
>
>
> Are you using -optimize? Are you using Scala 2.9 or 2.10? If you're
> using the optimizer, it might be that some method in EditorHelpers is
> inlined at the call site, including the access to that field. After
> recompiling EditorHelpers, that field may have been renamed (looks
> synthetic anyway), but de call-site is not recompiled (since the
> incremental compiler only recompiles calling code if *signatures*
> change -- meaning it's not -optimize proof).
>
> iulian
>
>
>
> On Sa 18 Aug 2012 19:33:07 CEST, Mirco Dotta wrote:
>
> Hey Simon,
>
> That is weird, can you tell us how to reproduce it?
>
> -- Mirco
>
> On Aug 16, 2012, at 1:09 PM, sschaef wrote:
>
> After some edits to code completion I got the following
> exception after running core inside of eclipse to test the
> changes:
>
> 2012-08-16 12:49:27,791 DEBUG [main] - System.out -
> java.lang.NoSuchFieldError: block$3
> at
> scala.tools.eclipse.ui.__ScalaCompletionProposal.apply(__ScalaCompletionProposal.scala:__107)
> at
> org.eclipse.jface.text.__contentassist.__CompletionProposalPopup.__insertProposal(__CompletionProposalPopup.java:__933)
> at
> org.eclipse.jface.text.__contentassist.__CompletionProposalPopup.__insertSelectedProposalWithMask__(CompletionProposalPopup.java:__881)
> at
> org.eclipse.jface.text.__contentassist.__CompletionProposalPopup.__verifyKey(__CompletionProposalPopup.java:__1307)
> at
> org.eclipse.jface.text.__contentassist.__ContentAssistant$__InternalListener.verifyKey(__ContentAssistant.java:807)
Reply all
Reply to author
Forward
0 new messages