Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 497597

Summary: Unable to compile code with System.getSecurityManager() call under Java 9 build 126
Product: [Eclipse Project] JDT Reporter: Scott M Stark <starksm64>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, szegedia
Version: 4.6   
Target Milestone: BETA J9   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Screenshot of the SecurityManager.class open in package explorer none

Description Scott M Stark CLA 2016-07-08 23:37:05 EDT
I'm using the Eclipse JDT (Java Development Tools) Patch with Java 9 support (BETA) for Neon development stream	1.1.1.v20160606-0010_BETA_JAVA9	to enable Java 9 support, and I am unable to compile any code that has a System.getSecurityManager() call. The problem is that the compiler is not resolving the return type to java.lang.SecurityManager. It is instead resolving to com.sun.org.apache.xerces.internal.util.SecurityManager.

This simple class:

public class TestSecurityManager {
	public static void main(String[] args) {
		SecurityManager sm = System.getSecurityManager();
	}
}


has the following error in the Problems view:
The type java.lang.SecurityManager cannot be resolved. It is indirectly referenced from required .class files
Comment 1 Attila Szegedi CLA 2016-07-19 16:32:24 EDT
Created attachment 263194 [details]
Screenshot of the SecurityManager.class open in package explorer

I have the same issue. 

I'm attaching a screenshot of the Package Explorer window descending into "JRE System Library [Java SE-9]/java.base/java.lang" branch. You can see that there's an entry for "SecurityManager.class", but it is empty (there's no triangle next to it and no green circle "C" node for the class). I opened the adjacent .class files, SecurityException.class and Short.class and you can see Eclipse can see the classes in them.

It seems Eclipse is unable to parse the SecurityManager.class file for some reason.
Comment 2 Jay Arthanareeswaran CLA 2016-07-19 21:41:13 EDT
This is already fixed via bug 497218. Please wait for the next feature patch to get this.

*** This bug has been marked as a duplicate of bug 497218 ***
Comment 3 Attila Szegedi CLA 2016-07-25 09:01:14 EDT
Thanks Jay, appreciate it.