Summary: | Unnecessary checkast from null | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Eugene Kuleshov <ekuleshov> | ||||||||
Component: | Core | Assignee: | Ayushman Jain <amj87.iitr> | ||||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||||
Severity: | normal | ||||||||||
Priority: | P3 | CC: | amj87.iitr, jarthana, Olivier_Thomann, remy.suen | ||||||||
Version: | 3.7 | Flags: | srikanth_sankaran:
review+
|
||||||||
Target Milestone: | 3.8 M4 | ||||||||||
Hardware: | All | ||||||||||
OS: | All | ||||||||||
Whiteboard: | |||||||||||
Attachments: |
|
Description
Eugene Kuleshov
2011-09-28 13:44:18 EDT
This is a consequence of bug 26903. It looks like this is no longer an issue. Srikanth, please follow up. All references need to be updated. (In reply to comment #1) > This is a consequence of bug 26903. It looks like this is no longer an issue. > Srikanth, please follow up. All references need to be updated. Looks like bug 26903 + bug 51300 modified only: ArrayReference, SingleNameReference, LocalDeclaration. Testing after backing out the change in progress. (In reply to comment #3) > (In reply to comment #1) > > This is a consequence of bug 26903. It looks like this is no longer an issue. > > Srikanth, please follow up. All references need to be updated. > > Looks like bug 26903 + bug 51300 modified only: > > ArrayReference, SingleNameReference, LocalDeclaration. > > Testing after backing out the change in progress. All tests pass. I also verified that the code generated for the test case attached to this bug and bug 26903 and bug 51300 verify alright and run alright with JDK5,6,7. Released for 3.8 M3 via commit id 237f280b16d1b493931020623a0e18d446c4fadf Srikanth, after this fix I now get this error with 1.4 VM - java.lang.VerifyError: (class: A, method: main signature: ([Ljava/lang/String;)V) Incompatible types for storing into array of arrays or objects class A { public static void main(String[] args) { try { int[][] tab = (int[][]) null; tab[0] = new int[1]; } catch (NullPointerException e) { System.out.print("OK"); } } } I tried with 1.4 because bug 26903 mentioned that javac 1.4 has a checkcast to make such a program run. Now we just omit that checkcast. OTOH, even javac7 still generates a checkcast for the above class. Perhaps there's something here? (In reply to comment #5) > Srikanth, after this fix I now get this error with 1.4 VM - > java.lang.VerifyError: (class: A, method: main signature: > ([Ljava/lang/String;)V) Incompatible types for storing into array of arrays or > objects That's bad, thanks for catching it, I'll roll back the fix for M3 and take a look at it in leisure. Created attachment 205874 [details]
Patch to roll back fix & tests
Ayush, please release and tag. I am unable to push to upstream. (Auth failures and timeouts)
Created attachment 205875 [details]
proposed fix
(to be applied on HEAD after the earlier changes have been reverted).
Basically, we dont need a checkcast for
int[][] aray = null;
but do need it for
int[][] aray = (int[][])null;
to satisfy 1.4 VM
(In reply to comment #7) > Created attachment 205874 [details] [diff] > Patch to roll back fix & tests > > Ayush, please release and tag. I am unable to push to upstream. (Auth failures > and timeouts) Released via commit 4fdb8fd78fd76e33e8dba33f80633397bdb28e98 I verified with build id: I20111025-1800, that the problem reported in comment#6 does not show up anymore i.e the roll back is effective and there are no issues. Srikanth, patch in comment 8 needs to be reviewed. Thanks. (In reply to comment #11) > Srikanth, patch in comment 8 needs to be reviewed. Thanks. Patch looks good, Thanks Ayush. Could you please restore the test from the previous patch that was rolled back. The test is testing comment# 0 case and is still a valid test for the limited fix made by the current patch. Created attachment 206766 [details]
proposed fix + regression tests
restored the test from rolled back patch and added another test for the
Object[] o = (Object[])null case, to verify generated bytecode contains checkcast
Released in HEAD via commit 9eac203f2453ab21a49dee5eceed3025656c3aee Verified for 3.8M4 with build I20111202-0800. |