Bug 530308 - [9] check usage of ClassFileReader.classFileName

Change-Id: Ib51b7054d350c2c0e52b36f89391511668f3da55
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
index 4227b67..06ab4b6 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -226,21 +226,7 @@
 			String entryName = jarRoot.getClassFilePath(Util.concatWith(pkg.names, getElementName(), '/'));
 			byte[] contents = getClassFileContent(jarRoot, entryName);
 			if (contents != null) {
-				String fileName;
-				String rootPath = root.getPath().toOSString();
-				String rootIdentifier = root.getHandleIdentifier();
-				if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
-					int slash = rootIdentifier.lastIndexOf('/');
-					if (slash != -1) {
-						StringBuilder extract = new StringBuilder();
-						extract.append(rootIdentifier.substring(0, slash));
-						int modStart = rootIdentifier.indexOf(JavaElement.JEM_MODULE);
-						if (modStart != -1)
-							extract.append(rootIdentifier.substring(modStart));
-						rootIdentifier = extract.toString();
-					}
-				}
-				fileName = rootIdentifier + IDependent.JAR_FILE_ENTRY_SEPARATOR + entryName;
+				String fileName = root.getHandleIdentifier() + IDependent.JAR_FILE_ENTRY_SEPARATOR + entryName;
 				result = new ClassFileReader(contents, fileName.toCharArray(), false);
 			}
 		} else {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModularClassFile.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModularClassFile.java
index 0f00d8a..4766281 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModularClassFile.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModularClassFile.java
@@ -167,15 +167,7 @@
 				String entryName = jarRoot.getClassFilePath(Util.concatWith(pkg.names, getElementName(), '/'));
 				byte[] contents = getClassFileContent(jarRoot, entryName);
 				if (contents != null) {
-					String fileName;
-					String rootPath = root.getPath().toOSString();
-					String rootIdentifier = root.getHandleIdentifier();
-					if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
-						int slash = rootIdentifier.lastIndexOf('/');
-						if (slash != -1)
-							rootIdentifier = rootIdentifier.substring(0, slash);
-					}
-					fileName = rootIdentifier + IDependent.JAR_FILE_ENTRY_SEPARATOR + entryName;
+					String fileName = root.getHandleIdentifier() + IDependent.JAR_FILE_ENTRY_SEPARATOR + entryName;
 					ClassFileReader classFileReader = new ClassFileReader(contents, fileName.toCharArray(), false);
 					return classFileReader.getModuleDeclaration();
 				}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
index 47e44ed..1d37cba 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -752,7 +752,7 @@
 	}
 
 	private static IClassFile getClassFile(char[] fileName) {
-		int jarSeparator = CharOperation.lastIndexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName);
+		int jarSeparator = CharOperation.indexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName);
 		int pkgEnd = CharOperation.lastIndexOf('/', fileName); // pkgEnd is exclusive
 		if (pkgEnd == -1)
 			pkgEnd = CharOperation.lastIndexOf(File.separatorChar, fileName);
@@ -1485,7 +1485,7 @@
 		if (referenceBinding.isLocalType() || referenceBinding.isAnonymousType()) {
 			// local or anonymous type
 			if (org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(fileName)) {
-				int jarSeparator = CharOperation.lastIndexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName);
+				int jarSeparator = CharOperation.indexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName);
 				int pkgEnd = CharOperation.lastIndexOf('/', fileName); // pkgEnd is exclusive
 				if (pkgEnd == -1)
 					pkgEnd = CharOperation.lastIndexOf(File.separatorChar, fileName);