Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 129213 Details for
Bug 251539
[1.6][compiler] java.lang.IllegalArgumentException: info cannot be null (StackMapFrame.java)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression tests
patch_251539_with_tests.txt (text/plain), 8.61 KB, created by
Olivier Thomann
on 2009-03-18 10:10:25 EDT
(
hide
)
Description:
Proposed fix + regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2009-03-18 10:10:25 EDT
Size:
8.61 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java,v >retrieving revision 1.37 >diff -u -r1.37 StackMapAttributeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java 8 Jul 2008 14:05:06 -0000 1.37 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java 18 Mar 2009 14:10:07 -0000 >@@ -11,7 +11,6 @@ > package org.eclipse.jdt.core.tests.compiler.regression; > > import java.io.File; >- > import junit.framework.Test; > > import org.eclipse.jdt.core.ToolFactory; >@@ -32,7 +31,7 @@ > static { > // TESTS_PREFIX = "testBug95521"; > // TESTS_NAMES = new String[] { "testBug83127a" }; >-// TESTS_NUMBERS = new int[] { 38 }; >+// TESTS_NUMBERS = new int[] { 40, 41 }; > // TESTS_RANGE = new int[] { 23 -1,}; > } > public static Test suite() { >@@ -6117,4 +6116,123 @@ > }, > "SUCCESS"); > } >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=251539 >+ public void test040() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "I.java", >+ "public interface I {\n" + >+ "\n" + >+ " public Object foo();\n" + >+ "\n" + >+ " public static class B implements I {\n" + >+ " public Object foo() {\n" + >+ " return X.myI.foo();\n" + >+ " }\n" + >+ " }\n" + >+ "}", >+ "X.java", >+ "public class X {\n" + >+ " public static final I myI = new I.B() {\n" + >+ " int a = 0;\n" + >+ " int b = 1;\n" + >+ " };\n" + >+ "\n" + >+ " private Object bar() {\n" + >+ " Object o = null;\n" + >+ " if (o != null) {\n" + >+ " o.toString();\n" + >+ " }\n" + >+ " return null;\n" + >+ " }\n" + >+ "\n" + >+ "}", >+ }, >+ ""); >+ String expectedOutput = >+ " // Stack: 1, Locals: 2\n" + >+ " private java.lang.Object bar();\n" + >+ " 0 aconst_null\n" + >+ " 1 astore_1 [o]\n" + >+ " 2 aload_1 [o]\n" + >+ " 3 ifnull 11\n" + >+ " 6 aload_1 [o]\n" + >+ " 7 invokevirtual java.lang.Object.toString() : java.lang.String [24]\n" + >+ " 10 pop\n" + >+ " 11 aconst_null\n" + >+ " 12 areturn\n" + >+ " Line numbers:\n" + >+ " [pc: 0, line: 8]\n" + >+ " [pc: 2, line: 9]\n" + >+ " [pc: 6, line: 10]\n" + >+ " [pc: 11, line: 12]\n" + >+ " Local variable table:\n" + >+ " [pc: 0, pc: 13] local: this index: 0 type: X\n" + >+ " [pc: 2, pc: 13] local: o index: 1 type: java.lang.Object\n" + >+ " Stack map table: number of frames 1\n" + >+ " [pc: 11, append: {java.lang.Object}]\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); >+ } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=251539 >+ public void test041() throws Exception { >+ this.runConformTest( >+ new String[] { >+ "I.java", >+ "public interface I {\n" + >+ "\n" + >+ " public Object foo();\n" + >+ "\n" + >+ " public static class B implements I {\n" + >+ " public Object foo() {\n" + >+ " return String.valueOf(X.myI.foo()) + String.valueOf(X.myU.foo());\n" + >+ " }\n" + >+ " }\n" + >+ "}", >+ "X.java", >+ "public class X {\n" + >+ " public static final I myI = new I.B() {\n" + >+ " int a = 0;\n" + >+ " int b = 1;\n" + >+ " };\n" + >+ " public static final I myU = new I.B() {\n" + >+ " int a = 0;\n" + >+ " int b = 1;\n" + >+ " int c = 2;\n" + >+ " };\n" + >+ " private Object bar() {\n" + >+ " Object o = null;\n" + >+ " if (o != null) {\n" + >+ " o.toString();\n" + >+ " }\n" + >+ " return null;\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+ >+ String expectedOutput = >+ " // Stack: 1, Locals: 2\n" + >+ " private java.lang.Object bar();\n" + >+ " 0 aconst_null\n" + >+ " 1 astore_1 [o]\n" + >+ " 2 aload_1 [o]\n" + >+ " 3 ifnull 11\n" + >+ " 6 aload_1 [o]\n" + >+ " 7 invokevirtual java.lang.Object.toString() : java.lang.String [30]\n" + >+ " 10 pop\n" + >+ " 11 aconst_null\n" + >+ " 12 areturn\n" + >+ " Line numbers:\n" + >+ " [pc: 0, line: 12]\n" + >+ " [pc: 2, line: 13]\n" + >+ " [pc: 6, line: 14]\n" + >+ " [pc: 11, line: 16]\n" + >+ " Local variable table:\n" + >+ " [pc: 0, pc: 13] local: this index: 0 type: X\n" + >+ " [pc: 2, pc: 13] local: o index: 1 type: java.lang.Object\n" + >+ " Stack map table: number of frames 1\n" + >+ " [pc: 11, append: {java.lang.Object}]\n"; >+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); >+ } > } >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java,v >retrieving revision 1.156 >diff -u -r1.156 TypeDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 13 Feb 2009 21:40:39 -0000 1.156 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 18 Mar 2009 14:10:09 -0000 >@@ -1016,7 +1016,8 @@ > } > } while ((current = current.enclosingType()) != null); > } >- this.maxFieldCount = 0; >+ // this.maxFieldCount might already be set >+ int localMaxFieldCount = 0; > int lastVisibleFieldID = -1; > boolean hasEnumConstants = false; > FieldDeclaration[] enumConstantsWithoutBody = null; >@@ -1057,7 +1058,7 @@ > && TypeBinding.LONG == fieldBinding.type) { > needSerialVersion = false; > } >- this.maxFieldCount++; >+ localMaxFieldCount++; > lastVisibleFieldID = field.binding.id; > break; > >@@ -1068,6 +1069,9 @@ > field.resolve(field.isStatic() ? this.staticInitializerScope : this.initializerScope); > } > } >+ if (this.maxFieldCount < localMaxFieldCount) { >+ this.maxFieldCount = localMaxFieldCount; >+ } > if (needSerialVersion) { > this.scope.problemReporter().missingSerialVersion(this); > } >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java,v >retrieving revision 1.48 >diff -u -r1.48 CodeSnippetClassFile.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java 7 Mar 2009 01:08:09 -0000 1.48 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java 18 Mar 2009 14:10:09 -0000 >@@ -127,12 +127,7 @@ > } > // retrieve the enclosing one guaranteed to be the one matching the propagated flow info > // 1FF9ZBU: LFCOM:ALL - Local variable attributes busted (Sanity check) >- if (this.enclosingClassFile == null) { >- this.codeStream.maxFieldCount = aType.scope.referenceType().maxFieldCount; >- } else { >- ClassFile outermostClassFile = outerMostEnclosingClassFile(); >- this.codeStream.maxFieldCount = outermostClassFile.codeStream.maxFieldCount; >- } >+ this.codeStream.maxFieldCount = aType.scope.outerMostClassScope().referenceType().maxFieldCount; > } > /** > * INTERNAL USE-ONLY >Index: compiler/org/eclipse/jdt/internal/compiler/ClassFile.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java,v >retrieving revision 1.185 >diff -u -r1.185 ClassFile.java >--- compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 7 Mar 2009 00:59:05 -0000 1.185 >+++ compiler/org/eclipse/jdt/internal/compiler/ClassFile.java 18 Mar 2009 14:10:09 -0000 >@@ -6915,12 +6915,7 @@ > > // retrieve the enclosing one guaranteed to be the one matching the propagated flow info > // 1FF9ZBU: LFCOM:ALL - Local variable attributes busted (Sanity check) >- if (this.enclosingClassFile == null) { >- this.codeStream.maxFieldCount = aType.scope.referenceType().maxFieldCount; >- } else { >- ClassFile outermostClassFile = outerMostEnclosingClassFile(); >- this.codeStream.maxFieldCount = outermostClassFile.codeStream.maxFieldCount; >- } >+ this.codeStream.maxFieldCount = aType.scope.outerMostClassScope().referenceType().maxFieldCount; > } > > private void initializeDefaultLocals(StackMapFrame frame,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 251539
:
129205
|
129210
| 129213