Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322154 - Compiler bug that does not occur in Galileo 3.5.2
Summary: Compiler bug that does not occur in Galileo 3.5.2
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.6.1   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-09 12:24 EDT by David Wright CLA
Modified: 2010-09-14 10:43 EDT (History)
3 users (show)

See Also:


Attachments
Patch under consideration (3.79 KB, text/plain)
2010-08-11 14:17 EDT, Srikanth Sankaran CLA
no flags Details
Revised patch (4.50 KB, patch)
2010-08-12 01:19 EDT, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Wright CLA 2010-08-09 12:24:37 EDT
Build Identifier: In Helios download ?jdt 3.6.0

/**
<p>This code sample demonstrates what appears to be a bug in the Helios compiler.
<p>The code as it stands generates the error 
"Internal compiler error: java.lang.NullPointerException at org.eclipse.jdt.core.compiler.CharOperation.hashCode(CharOperation.java:1930)"
<p>The code compiles Ok with the Galileo compiler, or if any of the changes noted is made. 
 */
public final class HeliosCompileBug{
	private HeliosCompileBug(){
		//Ok if final
//		final 
		boolean flagSet = 
			//Makes no difference if true or false
			true;

		Object first = 
			//Ok if false
//			false
			true
			? null : "";		
		Object second = flagSet || first == null ? null :
			//Ok if not anonymous class
			new Object()
		{}
		;
	}
}


Reproducible: Always

Steps to Reproduce:
1.Compile test code in Galileo, should be Ok
2.Compile in Helios, should fail
3.Make any of changes marked, should be Ok.
Comment 1 Srikanth Sankaran CLA 2010-08-09 17:38:34 EDT
(In reply to comment #0)
> Build Identifier: In Helios download ?jdt 3.6.0
> 
> /**
> <p>This code sample demonstrates what appears to be a bug in the Helios
> compiler.


Reproduced on HEAD. Thanks for the report, 
I'll follow up.
Comment 2 Srikanth Sankaran CLA 2010-08-09 18:38:31 EDT
Problem related to null references and flow analysis.
We don't set the constant pool name since the code
containing the anonymous type is found to be unreachable
by one phase. But then another phase ignores the reachability
and attempts to retrieve the constant pool name and operates
on it ending up with NPE. Thus the left hand is unaware of
what the right hand is doing.

Ayush, please follow up. This is a regression in 3.6, so
needs to be fixed for 3.6.1
Comment 3 Srikanth Sankaran CLA 2010-08-11 14:17:31 EDT
Created attachment 176386 [details]
Patch under consideration
Comment 4 Srikanth Sankaran CLA 2010-08-12 01:19:20 EDT
Created attachment 176434 [details]
Revised patch


This patch passes all tests, Ayush, please review, TIA.

I have left the hacks done for bug 102284 and bug intact.
Comment 5 Srikanth Sankaran CLA 2010-08-12 01:21:51 EDT
(In reply to comment #4)

> I have left the hacks done for bug 102284 and bug intact.
     
Should read : I have left the hacks done for bug 102284
and bug 99686 intact.
Comment 6 Ayushman Jain CLA 2010-08-12 03:26:39 EDT
(In reply to comment #4)
> Created an attachment (id=176434) [details]
> Revised patch
> 
> 
> This patch passes all tests, Ayush, please review, TIA.
> 
> I have left the hacks done for bug 102284 and bug intact.

Patch looks good.
+1 for 3.6.1
Comment 7 Srikanth Sankaran CLA 2010-08-12 05:14:43 EDT
Released in HEAD for 3.7 M2
         in 3.6 maintenance stream for 3.6.1
Comment 8 Frederic Fusier CLA 2010-08-26 10:50:35 EDT
Verified for 3.6.1 using build M20100825-0800.
Comment 9 Olivier Thomann CLA 2010-09-14 10:43:46 EDT
Verified for 3.7M2 using I20100914-0100