Bug 251539 - [1.6][compiler] java.lang.IllegalArgumentException: info cannot be null (StackMapFrame.java)
Summary: [1.6][compiler] java.lang.IllegalArgumentException: info cannot be null (Stac...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-21 10:03 EDT by Peter Larsen CLA
Modified: 2009-06-08 06:16 EDT (History)
4 users (show)

See Also:
Olivier_Thomann: review? (philippe_mulet)


Attachments
Proposed fix (3.68 KB, patch)
2009-03-18 09:20 EDT, Olivier Thomann CLA
no flags Details | Diff
Test case (730 bytes, application/octet-stream)
2009-03-18 09:48 EDT, Irwin CLA
no flags Details
Proposed fix + regression tests (8.61 KB, patch)
2009-03-18 10:10 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Larsen CLA 2008-10-21 10:03:03 EDT
Found this in .log after upgrading to 3.4.1. The java source have not
been touched for a long time, so its valid and have been compiled with 
older eclipse versions.

!SESSION 2008-10-21 15:27:57.010 -----------------------------------------------
eclipse.buildId=M20080911-1700
java.version=1.6.0_07
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=da_DK
Command-line arguments:  -os win32 -ws win32 -arch x86

!ENTRY org.eclipse.core.resources 4 2 2008-10-21 15:36:13.926
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.IllegalArgumentException: info cannot be null
	at org.eclipse.jdt.internal.compiler.codegen.StackMapFrame.addStackItem(StackMapFrame.java:81)
	at org.eclipse.jdt.internal.compiler.ClassFile.traverse(ClassFile.java:7539)
	at org.eclipse.jdt.internal.compiler.ClassFile.completeCodeAttribute(ClassFile.java:1613)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:244)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:179)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:530)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:564)
	at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.generateCode(QualifiedAllocationExpression.java:169)
	at org.eclipse.jdt.internal.compiler.ast.ReturnStatement.generateCode(ReturnStatement.java:122)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:232)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:179)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:530)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:564)
	at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.generateCode(QualifiedAllocationExpression.java:169)
	at org.eclipse.jdt.internal.compiler.ast.FieldDeclaration.generateCode(FieldDeclaration.java:104)
	at org.eclipse.jdt.internal.compiler.ast.Clinit.generateCode(Clinit.java:253)
	at org.eclipse.jdt.internal.compiler.ast.Clinit.generateCode(Clinit.java:103)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:530)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:581)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:356)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:755)
	at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137)
	at java.lang.Thread.run(Unknown Source)
Comment 1 Olivier Thomann CLA 2008-10-21 10:09:40 EDT
Could you please provide a test case to reproduce ?
Comment 2 Peter Larsen CLA 2008-10-21 12:29:55 EDT
That is not as simple as giving a java file, I have tried.
It is the same file as reported in

https://bugs.eclipse.org/bugs/show_bug.cgi?id=232062

I can comment out everything except one method in the
static class in the interface and I will still get the
mentioned exception. As soon as the last method is
commented out, the exception is gone and I can _not_
get it back by uncommenting (nor by replacing from cvs)

The only way to reproduce is by checking out the project
again.
Comment 3 Olivier Thomann CLA 2008-10-21 21:20:16 EDT
I could not reproduce the failure using the test case from bug 232062.
If you have a test case that reproduces the pb reliably, it would be good if you could share it even if the test case is pretty big. 
Comment 4 Peter Larsen CLA 2008-10-22 09:09:03 EDT
I have no small reproducible way of getting this exception.
It currently hits me every time the project is rebuild.
After rebuild I add a parse error - and eclipse seems to rebuild all
and finds the parse error (without throwing the exception). 
When correcting the parse error everything is ok and only rebuilds
the single file.

Comment 5 Olivier Thomann CLA 2008-10-22 09:13:31 EDT
Would it be possible to get access to this project?
I'd like to reproduce it as close as possible from the way you get it to make sure it is fixed once for all.
Thanks.
Comment 6 Peter Larsen CLA 2008-10-23 09:20:47 EDT
No, but we could do debugging over chat/phone etc.
Comment 7 Olivier Thomann CLA 2008-10-23 14:09:59 EDT
Is it ok if I send you a patch version so that you can get a dump when the problem occurs ?
Comment 8 Peter Larsen CLA 2008-10-23 14:34:45 EDT
Yes.
Comment 9 Olivier Thomann CLA 2008-10-23 14:51:10 EDT
What is your time zone ?
Comment 10 Peter Larsen CLA 2008-10-23 15:41:58 EDT
GMT+2
Comment 11 Olivier Thomann CLA 2008-10-24 09:10:34 EDT
Patch sent. Please let me know as soon as you can get the dump.
Comment 12 Peter Larsen CLA 2008-10-24 10:54:42 EDT
Received and dump sent.
Comment 13 Olivier Thomann CLA 2008-11-03 13:27:08 EST
If it is not possible to get access to the source code, is it possible to organize a remote debugging ?
I cannot retrieve enough informations through the dumps to reproduce this issue.

Would it be possible for you to attach the 3 .class files in question once they compile fine to see the shape of the local variable table?

Thanks.
Comment 14 Olivier Thomann CLA 2008-11-13 09:33:25 EST
Looking at the 3 .class files, it looks like one of them at least has been produced with the patch. It is missing the StackMap attribute when I would expect it to have some.

The only way I see to make progress in this case is to try remote debugging. Would this be possible ?
Comment 15 Olivier Thomann CLA 2008-11-28 12:14:04 EST
Peter,

Can we try to set up a remote debugging to fix this problem?
Thanks.
Comment 16 Irwin CLA 2009-03-13 16:41:42 EDT
I am able to reproduce what seems like a similar bug. However like Peter I am not able to extract a simple test case. The good thing though is i can reproduce this bug with latest eclipse 3.5. Need to debug... 

Where can i find the code for org.eclipse.jdt.internal.compiler.codegen.StackMapFrame (and source) ? lazy me :)


Comment 17 Olivier Thomann CLA 2009-03-13 16:50:11 EDT
Inside the JDT/Core bundle.
If you can provide a test case (even if it is big), I am ready to spend the required time to debug it and understand what is going on.
I could also do remote debugging on demand. Let me know what you can provide to fix this issue.
I never got an answer from Peter about setting remote debugging with him.
Comment 18 Olivier Thomann CLA 2009-03-18 09:20:10 EDT
Created attachment 129205 [details]
Proposed fix

I'll prepare a regression test.
Comment 19 Olivier Thomann CLA 2009-03-18 09:25:37 EDT
Thanks to Irwin I could get a test case to reproduce the issue.
It is related to the way the maxFieldCount is set during the compilation.

In this case we had a mismatch between the max field count used in the code stream to find out if a local is definitely assigned and the max field count used in the flow analysis to store the definitely assigned information for locals.

So the consequence was that some locals were closed too earlier and therefore the 1.6 stack map frame generation was not capable of retrieving the locals. This caused the IllegalArgumentException.

The .class files in 1.5 was also wrong as the local variable range was too short for some locals.

I will add a regression test for this one and review the patch with Philippe.

Thanks again Irwin for the time we spent over the phone and the time you spent extracting the test case.

Peter, once we have a build with the fix in it, would it be possible for you to verify that your test case is also fixed?
Comment 20 Irwin CLA 2009-03-18 09:48:35 EDT
Created attachment 129210 [details]
Test case

Classes do not compile properly.
Comment 21 Olivier Thomann CLA 2009-03-18 10:06:32 EDT
Philippe, please review the patch.
Comment 22 Olivier Thomann CLA 2009-03-18 10:10:25 EDT
Created attachment 129213 [details]
Proposed fix + regression tests

Same patch including regression tests.
Comment 23 Olivier Thomann CLA 2009-03-19 19:21:00 EDT
Released for 3.5M7.
Regression tests added in:
org.eclipse.jdt.core.tests.compiler.regression.StackMapAttributeTest#test040
org.eclipse.jdt.core.tests.compiler.regression.StackMapAttributeTest#test041

Review is still required.
Comment 24 Jay Arthanareeswaran CLA 2009-04-29 01:27:21 EDT
Verified for 3.5M7 using build I20090426-2000
Comment 25 Peter Larsen CLA 2009-06-08 06:16:23 EDT
I can no longer reproduce the bug with rc3.
Nor can I reproduce bug 232062, so it can 
be closed too. (mentioned in comment #2)

Peter